Session ID is Invalid (only for some users including the Admin)

Moderator: crythias

Post Reply
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

Okay so I have a really weird issue. I keep getting a "Session ID is Invalid" error when I try logging in and I am the Administrator of the application. I think what happened is that I was logged in when I left the shift yesterday and for some reason the servers shutdown (i.e. most likely an abnormal shutdown). When I came for my shift today I tried logging in and I keep getting this error. Two of my colleagues logged in and it is working absolutely okay for them. They are able to log in and perform actions without any hindrance.

The real twist in the story is that I am the Administrator of the application. I can't get into the application and "Kill All Sessions" because I think that's what I need to actually do to fix. Since I can't get into the application I connected to the database and I deleted all of the values in the "sessions" table. That didn't work either. I have reset the Oracle Virtualbox application and the server that OTRS is hosted on; however that didn't work either.

What are my options at this particular moment in time?
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Session ID is Invalid (only for some users including the Admin)

Post by RStraub »

Make sure that you are not using a session in the URL (OTRSAgentInterface=SessionKey). To reset Sessions you can use the script located:
~otrs/bin/otrs.DeleteSessionIDs.pl --all

Which is probably the better thing to do than empty the DB.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Re: Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

There is no session in the URL. I checked that before and after you highlighted it I checked it again.

I found the script when I connected to the OTRS server via FileZilla; however I don't know how to actually execute the script. How do I go about executing the script? I can connect to the OTRS server through SSH (i.e. via PuTTy) as well; however I don't know what command to use to actually execute the script. Can you please help me with that?
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Re: Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

Okay so I ran that particular script; however I am still getting the same "Session Invalid ID" error. What should I do now?
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Session ID is Invalid (only for some users including the Admin)

Post by RStraub »

Try to catch the apache log while you get the error.

The command for that is (probably):
tail -f /var/log/apache(2)/error.log

You might need to do that as root or apache user.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Re: Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

Okay so this is the output I am getting from the "error.log" file:

Code: Select all

[Thu Oct  1 16:53:29 2015] Defaults.pm: Subroutine LoadDefaults redefined at /opt/otrs//Kernel/Config/Defaults.pm line 40.
[Thu Oct  1 16:53:30 2015] Defaults.pm: Subroutine Get redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1697.
[Thu Oct  1 16:53:30 2015] Defaults.pm: Subroutine Set redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1709.
[Thu Oct  1 16:53:30 2015] Defaults.pm: Subroutine ConfigChecksum redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1752.
[Thu Oct  1 16:53:30 2015] Defaults.pm: Subroutine new redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1783.
[Thu Oct  1 16:55:43 2015] Defaults.pm: Subroutine LoadDefaults redefined at /opt/otrs//Kernel/Config/Defaults.pm line 40.
[Thu Oct  1 16:55:43 2015] Defaults.pm: Subroutine Get redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1697.
[Thu Oct  1 16:55:43 2015] Defaults.pm: Subroutine Set redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1709.
[Thu Oct  1 16:55:43 2015] Defaults.pm: Subroutine ConfigChecksum redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1752.
[Thu Oct  1 16:55:43 2015] Defaults.pm: Subroutine new redefined at /opt/otrs//Kernel/Config/Defaults.pm line 1783.
[Thu Oct  1 16:55:44 2015] -e: DBD::Pg::db do failed: FEHLER:  Wert zu lang für Typ character varying(100) at /opt/otrs//Kernel/System/DB.pm line 442.
ERROR: OTRS-CGI-93 Perl: 5.10.1 OS: linux Time: Thu Oct  1 16:55:44 2015

 Message: FEHLER:  Wert zu lang für Typ character varying(100), SQL: 'INSERT INTO sessions (session_id, data_key, data_value, serialized) VALUES (?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?),(?,?,?,?)'

 RemoteAddress: 192.168.0.76
 RequestURI: /otrs/index.pl

 Traceback (1221): 
   Module: Kernel::System::AuthSession::DB::CreateSessionID Line: 390
   Module: Kernel::System::AuthSession::CreateSessionID Line: 140
   Module: Kernel::System::Web::InterfaceAgent::Run Line: 360
   Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler Line: 41
   Module: (eval) (v1.99) Line: 204
   Module: ModPerl::RegistryCooker::run (v1.99) Line: 204
   Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 170
   Module: ModPerl::Registry::handler (v1.99) Line: 31
What does that even mean!? :o
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Session ID is Invalid (only for some users including the Admin)

Post by RStraub »

You can ignore the first half about the Subroutine redefined. That's just Perl "info" about function overloading.

The second half is way more interesting. From what I read - glad I'm germen, hehe - OTRS tries to insert a session ID, which is longer than 100 chars, into a column that only holds 100 chars.

The big question would now be, why does this happen...

For the english readers, if you have ideas, the error message reads:

Code: Select all

[Thu Oct  1 16:55:44 2015] -e: DBD::Pg::db do failed: ERROR: value too long for type character varying(100) at /opt/otrs//Kernel/System/DB.pm line 442.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Re: Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

I am glad you are German as well! :) My system language is in English. Shouldn't the error messages be in English as well? I guess that's a different topic and I can focus on that later.

Thank you for pointing me to the actual problem. Now that's just strange because many people within the organization are able to log in just fine; however for the life of me I can't seem to get into the system. Would it make sense for me to run an "ALTER" query and increase the size of the field the "Session ID" is being entered into? That might be a temporary workaround; however that may not actually fix and/or resolve the actual issue.

I guess the real question should be related to the behavior and how it changed all of a sudden.
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Session ID is Invalid (only for some users including the Admin)

Post by eandrex »

Did you upgrade your OTRS(I remember reading about session problem after upgrades)? or is it a clean OTRS 4.0 install?

As a workaround, you might try to switch the session backend.

Switch from DB to FS. To do so, add this to your Config.pm

Code: Select all

$Self->{SessionModule} = 'Kernel::System::AuthSession::FS';
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Re: Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

Yes I recently upgraded OTRS; however I don't think that's the cause for two reasons. The reasons are as follows:

1) I was still able to login for a day or two after I upgraded OTRS
2) Several of my colleagues are still able to login to OTRS right now. I can use their login on my PC and it works just fine; however I can't login using my own login no matter which PC I use.

With reference to the workaround that highlighted in the e-mail below, how would I go about doing this if I can't login? Is this something I can do directly in the code? If so can you please point me in the direction of the file I would find this particular setting in?
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Session ID is Invalid (only for some users including the Admin)

Post by eandrex »

It is a file.. it is located in

Code: Select all

/opt/otrs/Kernel/Config.pm
edit it only if you know what you are doing, else you may end screwing your system.

Another option(safer than before) is by creating a new admin user.. to do so, log in into your system using putty/ssh..after that go to /opt/otrs/bin

Code: Select all

cd /opt/otrs/bin
And exec this command

Code: Select all

perl otrs.AddUser.pl -f firstname -l lastname -p password -g admin -e email username
replace firstname, lastname, password, email and username as desired.. Do not change the "-g admin" part unless you created a new group for your admins. After doing so, try to logging as admin using your new username and password

If you are able to log in, go to "Admin" -> System configuration -> Select "Framework" -> "Core::Session" in SessionModule change from "DB" to "FS"..note that by doing so, everyone will have to relogin in your system.. once it is done, try to login with your old credentials or skip this part and continue using the new created admin.
zyousafi
Znuny newbie
Posts: 64
Joined: 09 Feb 2015, 12:03
Znuny Version: 4.0.5
Real Name: Zohair Yousafi

Re: Session ID is Invalid (only for some users including the Admin)

Post by zyousafi »

thank you eandrex for the incredibly simple solution! :) that worked like a charm and it got me logged back into the system.
Post Reply