linux-alsa: stop reopen thread before destroying abort_event#13480
Open
quine00 wants to merge 1 commit into
Open
linux-alsa: stop reopen thread before destroying abort_event#13480quine00 wants to merge 1 commit into
quine00 wants to merge 1 commit into
Conversation
Author
kkartaltepe
approved these changes
May 26, 2026
This was found by inspecting a crash backtrace that aborted in glibc's __pthread_mutex_cond_lock from os_event_timedwait in the ALSA plugin's reopen thread. alsa_destroy was destroying abort_event without first stopping and joining the thread, which also waits on that event. If destruction wins the race, the waiter can wake and try to relock a mutex belonging to an event that has already been destroyed. Stop the reopen thread first so abort_event stays valid for the lifetime of the wait.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Was hitting an abort in glibc's
__pthread_mutex_cond_lockfromos_event_timedwaitin the ALSA plugin's reopen thread.Motivation and Context
While running obs on on Ubuntu 26.04 (32.1.0-0ubuntu3), occassionally I would see crashes. I investigated one such crash using apport-retrace and came to the attached fix.
How Has This Been Tested?
I rebuilt my changes against the affected Ubuntu version, and did my usual OBS workflow for a few days. No crashes found so far, whereas before it was common.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: