3
votes

Summary: Application developed on PHP Symfony 1.4.8 loses symfony session values randomly but exclusively on specific production environment: array symfony/user/sfUser/attributes gets empty within seconds or minutes after user authentication. Issue doesn't occur on development machine or at any other production environment.

It seems to be clear the issue is specific to the failing server, However, I wonder if could there be any PHP / Apache / Symfony configuration I might be missing that could solve the issue at the failing server?

Failing Server PHP Info:

  • PHP Version 5.3.10
  • System SunOS 5.10
  • Apache/1.3.41 (Unix) PHP/5.3.10 mod_ssl/2.8.31 OpenSSL/0.9.8p
  • Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100
  • Timeouts Connection: 300 - Keep-Alive: 15
  • Session Support: enabled
  • Registered save handlers: files user sqlite
  • Registered serializer handlers: php php_binary
  • session.cache_expire: 180
  • session.cache_limiter: nocache
  • session.cookie_lifetime: 0
  • session.gc_divisor: 100
  • session.gc_maxlifetime: 1440
  • session.gc_probability: 1
  • session.use_cookies: On
  • session.use_only_cookies: On

Working Server PHP Info:

  • PHP Version 5.2.17
  • System Linux 2.6.32.59-sg2 #3 SMP
  • Apache/1.3.42 (Unix) mod_gzip/1.3.26.1a mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.8e-fips-rhel5
  • Session Support: enabled
  • Registered save handlers: files user sqlite memcache
  • Registered serializer handlers: php php_binary wddx
  • session.cache_expire: 180
  • session.cache_limiter: nocache
  • session.cookie_lifetime: 0
  • session.gc_divisor: 1000
  • session.gc_maxlifetime: 1440
  • session.gc_probability: 1
  • session.use_cookies: On
  • session.use_only_cookies: Off

Symfony Session Settings for both servers at All environments:

  storage:
    class: sfSessionStorage
    param:
      session_name: webapp

  user:
    class: myUser
    param:
      timeout: 7200

I have already checked over this similar issue Symfony 1.4 sessions randomly lost, however I am not using the sfMemcacheCache class.

Let me know if you might need any extra info to answer this question.

2
Have you tried to use a different storage class? Like sfPDOSessionStorage for examplej0k
We have the same issue - but we haven't defined sfSessionStorage.Del Pedro
@j0k No, I haven't... Will try to that and keep you posted...JLCG
And there's only one production server, not several?adhominem
There is some type of balance load involved so I am assuming it could be more than one...JLCG

2 Answers

0
votes

This is probably an obvious thing to check, but maybe the server's out of disk space?

The default session store is file-based, so if you're losing data at random it sound like you're having some hard drive/file system issues.

If you're still curious, you can try changing the location where sessions are stored to another location, hopefully on a different disk.

0
votes

You probably need to set following settings in your factories.yml file as :

  storage:
    class: sfSessionStorage
    param:
      session_name: webapp
      session_cookie_lifetime: 2678400 # number of seconds for 1 month

& then remove your cache & reload the website and your SESSION COOKIE will stay active for 1 month.