Skip to content

Commit 0ea24a9

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 92e70d0 commit 0ea24a9

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
@@ -181,6 +181,7 @@ class NDB_Client
181181

182182
User::singleton($_SESSION['State']->getUsername());
183183

184+
session_write_close();
184185
// finished initializing
185186
return true;
186187
}

0 commit comments

Comments
 (0)