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

Race condition in Observer.start() and observer.schedule() #1044

Open
matthew11 opened this issue Jul 10, 2024 · 1 comment
Open

Race condition in Observer.start() and observer.schedule() #1044

matthew11 opened this issue Jul 10, 2024 · 1 comment

Comments

@matthew11
Copy link

There is a race condition between the two method. If the start() of the observer is called (but not finished, for example started by another thread) and in the mean time a schedule is called it can happen that the watcher never catches any event, basically silently failing the initialization.
The obvious solution could be to put the body of the start() behind the self._lock. After this I was not able to reproduce the race condition again.

Since the initialization done before the thread's actual start() called, as a workaround I can re-arrange my code in order to do similar initialization avoiding the race condition, but this bug should be an easy fix.

@BoboTiG
Copy link
Collaborator

BoboTiG commented Jul 10, 2024

Would you be able and motivated to provide a PR with the fix + a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants