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

Reflector::reset has an (admittedly unlikely) race condition #136

Closed
nightkr opened this issue Feb 19, 2020 · 1 comment · Fixed by #141
Closed

Reflector::reset has an (admittedly unlikely) race condition #136

nightkr opened this issue Feb 19, 2020 · 1 comment · Fixed by #141
Labels
bug Something isn't working

Comments

@nightkr
Copy link
Member

nightkr commented Feb 19, 2020

version and data use separate mutexes. In most cases, either only one is used, or the data mutex is held for the duration of the version mutex. However, reset releases data before grabbing version, which can lead version to be reverted if single_watch (via poll) applies an update in between the two locks.

The practical effect of this would be that poll() restarts can get duplicate events (though they would just be no-ops).

@clux clux added the bug Something isn't working label Feb 20, 2020
@clux
Copy link
Member

clux commented Feb 20, 2020

Thanks! Yep, this looks wrong. And it also doesn't look like there are any good reasons anymore to need two mutexes, so we should just combine their use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants