Skip to main content
Topic: Session problems again... (Read 8601 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Session problems again...

Seems like I always have session problems. Just wiped out the elk install I have to install the latest. It shows the little section telling me I have an active admin session. I click the end session link, and it then tells me my session timed out.  At some point the session seems to clear. But now I can't seem to maintain one. After I login to admin anytime I click to go to any admin page it then asks me to login again.

Moving on... I then go into my profile to set an avatar for the first time. I click save and I then get a "Token verification failed. Please go back and try again." error.

Am I the only one running into these problems?

When I looked at my server error_log I'm seeing a TON of these errors for just about every single page I've been on in the install.
Quote2013/11/17 16:21:55 [error] 7548#0: *3385443 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Access to undeclared static property: Database_MySQL::$_db in /home/****/www/ichbin.us/elkarte/sources/database/Db-mysql.class.php on line 1396" while reading upstream, client: 55.55.55.55, server: www.ichbin.us, request: "GET /elkarte/index.php?action=profile;area=forumprofile HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "www.ichbin.us", referrer: "http://www.ichbin.us/elkarte/index.php"


PHP version = 5.3.27
Last Edit: November 17, 2013, 07:00:41 pm by IchBin
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Session problems again...

Reply #1

Don't know, but that is a strange error, means $db object is not available, at least thats what it looks like.   May need to provide access uid/pass so someone can take a look if you can't track it down.

I'm using an older version of php, I'll update my local and see if its something with a later PHP version (unless @emanuele  or @TE are already on a later version)

Re: Session problems again...

Reply #2

Using PHP 5.3.5 on one box (windows + Apache 2.2), PHP 5.2.6-1+lenny16 + lighttpd (debian linux) on another and IIRC PHP 5.5 (IIS on Windows) for the third environment. Never seen that Error..

@Spuds: I think we ran into that proxy issue again, can't see your avatar (just the red x from IE9)
Thorsten "TE" Eurich
------------------------

Re: Session problems again...

Reply #3

https://github.com/elkarte/Elkarte/issues/1023 (see Inter's last comment)
Thorsten "TE" Eurich
------------------------

Re: Session problems again...

Reply #4

At the moment I'm on 5.3 and virtual box is broken so I don't even have a VM to play with... :-(
Bugs creator.
Features destroyer.
Template killer.

Re: Session problems again...

Reply #5

Quote I think we ran into that proxy issue again, can't see your avatar (just the red x from IE9)
Yup, when I did the upgrade I did not disable those headers, I will do that and then make a PR to make that an optional thing.  Is it all the avatars or just mine? (curious if its site served or gravatar etc)

Sounds like from the github report it may be an APC issue ... interesting that, I'll enable that on my local and see what happens. 

 

Re: Session problems again...

Reply #6

Quote Is it all the avatars or just mine? (curious if its site served or gravatar etc)
Mine is fine (gravatar), the others (server stored avatars) are broken..
Thorsten "TE" Eurich
------------------------

Re: Session problems again...

Reply #7

Yep, running APC here. Once I disabled that setting everything seems to be working fine now.
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Session problems again...

Reply #8

IchBin,

If you get a change, please remove that line and instead add
Code: [Select]
apc.filters = "-database"
... that should only turn off APC on the db classes, otherwise I think you are turning it off on everything (the opcache at least) ... I was able to reproduce the error somewhat on my setup after finally getting a config that allowed APC to run :P 

In my log I saw the error you have above and it always came from Session.php, from the sessionWrite function ... seems APC does not like the static $db method used like that, or at least the compiled static method.  Can't find any reason why.


Re: Session problems again...

Reply #10

 :)

add in index.php:

Code: [Select]
register_shutdown_function('session_write_close');
Sorry for my English

Re: Session problems again...

Reply #11

You mean that adding that line solved the issue?
Bugs creator.
Features destroyer.
Template killer.

Re: Session problems again...

Reply #12

Quote from: Spuds – IchBin,

If you get a change, please remove that line and instead add
Code: [Select]
apc.filters = "-database"
... that should only turn off APC on the db classes, otherwise I think you are turning it off on everything (the opcache at least) ... I was able to reproduce the error somewhat on my setup after finally getting a config that allowed APC to run :P 

In my log I saw the error you have above and it always came from Session.php, from the sessionWrite function ... seems APC does not like the static $db method used like that, or at least the compiled static method.  Can't find any reason why.

So this change is only supposed to deal with the $db access error I posted about then? And nothing to do with the session problems? Just want to make sure I understand you.
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Session problems again...

Reply #13

QuoteSo this change is only supposed to deal with the $db access error I posted about then? And nothing to do with the session problems? Just want to make sure I understand you.
It should fix both, or avoid them I guess


We use our own session handler (so does SMF), but we also have a static $db-> floating around (what used to be $smcFunc but its now in a class and available though a static $db = database())


What happens with APC is that (thanks for the links!) it destroys the static class members before sessions are written.  So we arrive in the writeSession area, go to write it to the db but our $db-> has been tossed away by APC so we can't access the $db or write the session.

In some quick testing on my machine, not having APC compile the database functions, prevented it from destroying them and things worked.  I did have to clear cookies and make sure I was logged out etc, no sessions.  So the -database should tell APC to not use its opcode cache on the database directory.


 If you use the other suggestion (the one that worked) you have turned off the opcode for everything since that setting means you have to implicitly tell APC what to cache vs the default where you implicitly tell it what not to cache.