Skip to content

Commit d3faed7

Browse files
committed
[Core] Allow parallel handling of requests from same session
This adds a session_write_close() call to the end of NDB_Client, after the last reference to $_SESSION has been made. This causes PHP to release the lock it holds on the session file which prevents further incoming requests from being handled. After this point in NDB_Client all of our session related state should be read from the PSR request, not the superglobal. PHP by default holds a lock on the session until it is closed in case there is a write to the superglobal. However, this prevents other requests from the same session from reading the variable (which is where our login state is stored) until the end of the request, when the lock is released. Closing it explicitly releases the lock and allows us to handle multiple requests from the same user in parallel instead of in series.
1 parent 60d3607 commit d3faed7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

php/libraries/NDB_Client.class.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class NDB_Client
197197

198198
User::singleton($_SESSION['State']->getUsername());
199199

200+
session_write_close();
200201
// finished initializing
201202
return true;
202203
}

0 commit comments

Comments
 (0)