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

Fix race condition checking if event mutex exists #54430

Draft
wants to merge 1 commit into
base: 11.x
Choose a base branch
from

Conversation

vkulov
Copy link

@vkulov vkulov commented Jan 31, 2025

Fix issue #50330 a race condition checking if lock already exists.

It's possible for a race condition to occur if we acquire the lock just to check if it's free.

The exists check interferes with the actual lock acquisition at event startup. As a result it's possible to miss an event run.

Imagine following scenario:

  1. thread A goes inside the exists method and lock the mutex.

  2. All other threads conclude that the event will be run by thread A and skip the event run to avoid overlapping

  3. thread A releases the lock by returning from the exists methog

  4. thread A proceeds to acquire the lock "for real" but the lock has already been locked by another thread running the exists method.

  5. Thread A bails out thinking the event is being run by another thread but in fact it's not.

@crynobone
Copy link
Member

Mark as draft since tests are failing

@crynobone crynobone marked this pull request as draft January 31, 2025 09:08
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

Successfully merging this pull request may close these issues.

2 participants