-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race condition on concurrent IPC connects
We write the key to the child [1] before registering it to be received, which is inside `accept` [2]. If the child connects fast enough, this will result in a race condition. The race condition will only happen if there are multiple concurrent accepts, because we start to accept only after registering the key [3]. With concurrent pending connects, we might already be in the accept loop. Fixes #199. [1] https://github.com/amphp/parallel/blob/ffda869c33c30627b6eb5c25f096882d885681dc/src/Context/ProcessContext.php#L159 [2] https://github.com/amphp/parallel/blob/ffda869c33c30627b6eb5c25f096882d885681dc/src/Ipc/SocketIpcHub.php#L172 [3] https://github.com/amphp/parallel/blob/ffda869c33c30627b6eb5c25f096882d885681dc/src/Ipc/SocketIpcHub.php#L168
- Loading branch information
Showing
1 changed file
with
40 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters