openal-soft
openal-soft copied to clipboard
1.23.0 and DSOAL crashing on exit
OpenAL Soft 1.23.0 and DSOAL used with some games (for instance, Planescape: Torment) are generating the Application Error (Event 1000) + DMP file in \AppData\Local\CrashDumps\ on exit. Version 1.22.0 is fine.
Windows 10 22H2 x64
Is it only with DSOAL? Does it always happen, even by just starting/quitting the game, or does it require some play time before it crashes when quitting?
Trace logs for OpenAL Soft and DSOAL would be helpful. For OpenAL Soft, set the ALSOFT_LOGLEVEL
environment variable to 3
and ALSOFT_LOGFILE
to a full path+filename for it to write the log to. And for DSOAL, set DSOAL_LOGLEVEL
and DSOAL_LOGFILE
similarly (though use a different filename).
I can verify the same on my system. I've been running through the a bunch of old artifacts in actions and so far it seems to be https://github.com/kcat/openal-soft/commit/68e04624b1f94d9bf8f9ebce5d90e64ab143efea that crashes on exit. I have logs for both. DSOAL-68e0462.log OpenAL Soft-68e0462.log DSOAL-1.23.0.log OpenAL Soft-1.23.0.log
Edit: It seems to happen regardless of the amount of time running.
Tested 1.23.0 in GZDoom (so without DSOAL) and it seems fine. Starting/quitting is enough.
Might be due to how that commit makes the background COM thread dynamically managed, meaning it holds a thread handle for the background thread while a device is open. And DSOAL leaves contexts current on the threads it makes OpenAL calls on, which causes the device to stay open until those context references can be released.
So even though all DSound/OpenAL devices were closed by the app, the OpenAL device is technically still open when the app quits since some thread-local context references weren't released properly, leaving the background COM thread handle in a joinable state when global objects are destructed. std::thread
calls std::terminate()
if it's still joinable when the destructor runs, which happens at process exit and causes the crash.
DSOAL really shouldn't leave thread-local contexts set indefinitely, but OpenAL Soft should be more resilient to that happening (it shouldn't be allowed to crash). Though I'm not sure how to deal with thread-local contexts still being set on other threads when the device is closed by one particular thread.
Instant crash if -wasapi
is set in alsoft.ini. 1.22.0 lets the game run (without sound).