-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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 random multithreaded crash that happens when setting the audio stream on a AudioStreamRandomPitch stream. #55043
Conversation
…ream on a AudioStreamRandomPitch stream.
Discussed in the issue. I don't want to merge this until we're sure we've solved the issue, and I don't like the idea of using the global audio server lock if we can avoid it. |
I've run this for several hours with no crash, so I'm pretty sure the crash is fixed. The lock I added only happens when setting the stream, so it's not like it's going to happen every frame. Should be pretty rare. This lock was also used when setting streams in other places. I could create a new mutex, but I have a few concerns:
Since the crash does not happen in master, whatever fix we do should probably be only put into 3.x. |
I'll need to think about it. Just to respond to your points here:
|
I think the goal of getting rid of the audio lock is fine in 4.x. This should probably be 3.x-specific, since I can't reproduce the bug in master. As for how it works, the lock is applied in the audio driver thread_func(). Ex: Also, every other place that sets the stream (in 3.x, anyway) calls the driver lock, so I'm not sure why this case should be different. |
This would need to be redone for the Based on the above discussion and that in #54866, it seems like despite some concerns this might be a good solution for 3.x. Could you make a new PR for |
Opened a new PR for 3.x as requested here: #96261 |
Added locks in AudioStreamRandomPitch::set_audio_stream. This is to fix #54866