Skip to content

Prevent synchronization mutex leak - #316

Merged
composerinteralia merged 1 commit into
mainfrom
prevent-synchronization-mutex-leak
Aug 18, 2026
Merged

Prevent synchronization mutex leak#316
composerinteralia merged 1 commit into
mainfrom
prevent-synchronization-mutex-leak

Conversation

@composerinteralia

Copy link
Copy Markdown
Collaborator

Prior to this change it was possible for the lock to be taken and never released if Thread.raise or similar happens between the successful try_lock and begin.

It's not so easy to reproduce, but in production we've been occasionally seeing individual workers getting repeated
Trilogy::SynchronizationError and never recovering. I debugged a bit and the lock was held by the main thread, and the error also happened on the main thread. We've got some poorly placed Timeout.timeout calls that I suspect are triggering this.

Prior to this change it was possible for the lock to be taken and never
released if `Thread.raise` or similar happens between the successful
`try_lock` and `begin`.

It's not so easy to reproduce, but in production we've been occasionally
seeing individual workers getting repeated
`Trilogy::SynchronizationError` and never recovering. I debugged a bit
and the lock was held by the main thread, and the error also happened on
the main thread. We've got some poorly placed `Timeout.timeout` calls
that I suspect are triggering this.
@composerinteralia
composerinteralia force-pushed the prevent-synchronization-mutex-leak branch from b50eb7c to f859b80 Compare August 18, 2026 11:01
@composerinteralia
composerinteralia merged commit dfcde7a into main Aug 18, 2026
43 checks passed
@composerinteralia
composerinteralia deleted the prevent-synchronization-mutex-leak branch August 18, 2026 11:59
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