-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: prohibit parallel access to arena objects
Fixes race conditions in the evloop when another thread closes the fd, and thus frees the poll descriptor (waitlists): - After waiting for events and processing the events: processing events and timers would fail to get the index and raise an exception. - After trying to read or write but before we could actually get the poll descriptor: we'd fail to get the index and raise an exception. - After trying to read/write and after we allocated the poll descriptor, but before we could wait: we'd be adding to a freed poll descriptor. - Resetting the arena index on IO (__evloop_data) allowed a parallel wait to re-allocate the poll descriptor (despite the IO being closed). - ... Preventing parallel accesses to an arena object may be a bit drastic, but at least we know for sure that we don't have any parallelism issue. It also allows to drop the lock on poll descriptor as well as on each waiting list: we don't need them anymore. A disadvantage is that parallel read/write/close and evloop process event/timeout may conflict... though they already competed for the 3 aforementioned locks.
- Loading branch information
1 parent
375253c
commit 6985080
Showing
8 changed files
with
281 additions
and
214 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
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
Oops, something went wrong.