2

We work with the Symfony framework (V4.1.3) and our session values (seemingly) randomly disappear/re-appear. Sometimes within seconds it's gone/back, sometimes it's back/gone after a few minutes.

We just do a dump of the session values, nothing else. Thusfar it appears 100% random.

  • This problem exists in various browsers, on my local machine and on the server.
  • We use Symfony's wrapper. $_SESSION always has a few values, but only when '_sf2_attributes' is set, $session->all() return the values
  • session.save_handler and session.save_path have proper values
  • session_id() always returns a unique id, wether it returns the data or not
  • If we keep refreshing it'll disappear, regardless of interval between refreshes. Could take 1 reload, could take 6.
  • If we keep refreshing it'll re-appear, regardless of interval between refreshes. Could take 1 reload, could take 6.
  • The session contains one (string)key=>(int)value
  • Nowhere in the project the session is used. Currently, the dump($session->all()) is the only session related code.
  • memcache isn't present
  • If I set a $_SESSION value manually, and reload it's gone. Even if the other values come back, the just set element is still gone.
  • there are no load balancers Local and on the testserver
  • When I have two browser open, each with a session, and reload quickly it's gone in one, but the other still exists.

I would like a consistent session. Anyone got a suggestion?

Martijn
  • 15,791
  • 4
  • 36
  • 68
  • Where is it happening, on your local dev machine? Don't you have multiple servers behind a load balancer, do you? :) – David Ferenczy Rogožan Nov 07 '18 at 11:47
  • there are no loadbalancers (added that to the question). I'll go read the duplicate – Martijn Nov 07 '18 at 12:27
  • It is not the same as the suggested duplicate. Having a unique session ID each load is good, that topic suggests it's bad. They never have the data, I sometimes have the data :) – Martijn Nov 07 '18 at 12:29
  • I applied the solution in the https://stackoverflow.com/questions/50925212/ajax-is-losing-sessions topic. Not the best solution, but a working one. – Martijn Nov 13 '18 at 10:41

0 Answers0