ChildPidWatcher: fix a race condition when unregistering a pid#2814
Merged
sporksmith merged 1 commit intoshadow:mainfrom Mar 29, 2023
Merged
ChildPidWatcher: fix a race condition when unregistering a pid#2814sporksmith merged 1 commit intoshadow:mainfrom
sporksmith merged 1 commit intoshadow:mainfrom
Conversation
We were getting rare failures in CI unit tests, and consistent failures
in large benchmarks. I was able to reproduce with:
```
for i in `seq 1000`; do
echo trial $i
if ! RUST_BACKTRACE=full cargo test --manifest-path=src/Cargo.toml -p shadow-rs childpid_watcher ; then
break
fi
done
```
I think what was happening is that we could get an epoll event for a
dieing process in the worker thread just as we were in the middle of
unregistering it from another thread.
The simplest fix is to just let the worker thread handle unregistration
so that it's serialized with other operations in that thread.
Contributor
Author
|
Actually I'm going to take a look at a more thorough revision moving all the "work" into the worker thread ... |
Contributor
Author
|
Though maybe it makes sense to get this in now since it's causing the regular CI to be flaky in addition to breaking the runner |
stevenengler
approved these changes
Mar 29, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We were getting rare failures in CI unit tests, and consistent failures in large benchmarks. I was able to reproduce with:
I think what was happening is that we could get an epoll event for a dying process in the worker thread just as we were in the middle of unregistering it from another thread.
The simplest fix is to just let the worker thread handle unregistration so that it's serialized with other operations in that thread.