Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Fix race in Dispatcher adding and stopping #6145

Merged
merged 3 commits into from
Dec 23, 2019

Conversation

theopolis
Copy link
Member

Fixes #6139.

We do not want to add any services after the dispatcher enters the stopping state. To accomplish this we first acquire a lock in both places then check or set the stopping state.

@theopolis theopolis added the bug label Dec 21, 2019
@theopolis
Copy link
Member Author

My test VM was able to reproduce the race easily before. It's been running with this change for several hours and there are no orphaned worker processes. Pretty confident this is the fix.

@Smjert
Copy link
Member

Smjert commented Dec 21, 2019

The change makes sense, though there are a couple of other places where it should be protected I believe:

self.stopping_ = false;

and
stopping_ = false;

@theopolis
Copy link
Member Author

The last two places are testing related if I recall correctly. I can simplify that code and add the mutex wait.

@theopolis theopolis merged commit 1d58bf8 into osquery:master Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flaky test tools_tests_testosqueryd causes: The operation was canceled
2 participants