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

Correctly clean up keeping_mutexes before resuming any other threads. #7460

Merged
merged 1 commit into from Mar 7, 2023

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Mar 7, 2023

It's possible (but very rare) to have a race condition between setting mutex->fiber = NULL and thread_mutex_remove(th, mutex) which results in the following bug:

[BUG] invalid keeping_mutexes: Attempt to unlock a mutex which is not locked

Fixes https://bugs.ruby-lang.org/issues/19480.

It's possible (but very rare) to have a race condition between setting
`mutex->fiber = NULL` and `thread_mutex_remove(th, mutex)` which results
in the following bug:

```
[BUG] invalid keeping_mutexes: Attempt to unlock a mutex which is not locked
```

Fixes <https://bugs.ruby-lang.org/issues/19480>.
@ioquatix ioquatix merged commit 2c4b205 into ruby:master Mar 7, 2023
@ioquatix ioquatix deleted the thread-mutex-unlock-fixes branch March 7, 2023 07:23
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
ioquatix added a commit to socketry/async that referenced this pull request Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant