Symfony: Custom Session Save Handler Maximum Execution Time Symfony: Custom Session Save Handler Maximum Execution Time symfony symfony

Symfony: Custom Session Save Handler Maximum Execution Time


You mentioned that:

I initialize symfony session in my server script as well

Does this also call new NativeSessionStorage?

What I think is happening is that you are creating essentially two session handlers but PHP only knows about one and thus only closes the database connection / lifts the database lock for one of them. Let me see if I can explain clearly. Every time you instantiate NativeSessionStorage the class registers the sessionHandler (the pdo session handler in your case) with php via session_set_save_handler which you can see in the NativeSessionStorage code here.

When PHP stops execution it calls the PdoSessionHandler->close() method. However since you have two instances and php only has one registered as the session handler, its closing one but not the other. Which keeps the database locked. Based on your description I think this may be your problem. You should be able to easily test this by explicitly calling Session->save() try doing this explicitly in your app and server code to see if you don't get the locked error anymore.

Hope this helps!


Is the session closing when the websocket disconnects? If not, it is keeping the lock on the session record and not allowing the incoming request to continue past starting the session. The initial page load works because the websocket picks up the session when the page load is complete.