Linux: X-Plane frozen during FMOD shutdown / after FMOD error "not unit length, or perpendicular"
TwinFan opened this issue · comments
Describe the bug
User report: X-Plane froze, last line in log is
LT/XPMP2 ERROR Sound.cpp:835/SoundUpdatesDone: FMOD Error 36 - 'The vectors passed in are not unit length, or perpendicular.' in FMOD_System_Set3DListenerAttributes
To Reproduce / Source Code Example
Unclear.
But can probably be forced in debugger by sending wrong coordinates into FMOD_System_Set3DListenerAttributes
.
Expected behavior
- Error shall not freeze X-Plane, check error handling.
- Error shall not happen.
Version
- OS: Reported on Linux
- X-Plane: 12.00rc1
- using LiveTraffic 3.2.0
Log.txt
Log-Snd_Freeze.txt
Additional context
Original user report is a comment to LiveTraffic.
More discussion then tracked in a support thread.
I could not recreate any problem. The error does not appear to me "just so".
I can certainly enforce it via debugger or by adding code that consciously passes non-unit length vectors to FMOD_System_Set3DListenerAttributes
, but all that happens then is as per design:
- the above error message is logged
- with logging settings set to
DEBUG
, another message is logged stating that the sound system has now been disabled
and otherwise everything just goes on as normal, no interruption to LiveTraffic's planes or X-Plane. Tested on Mac and Linux.
Can only ask affected user to try a debug version that provokes the error to see if once it happens his system is freezing again.
Started a support thread for discussion with affected users. A xPilot user joined in with similar issue with xPilot, which also uses XPMP2, also tracked as xpilot-project/xpilot#137.
Turns out: It is not actually the error 36 itself that causes issues, but calling FMOD_System_Release
while handling the original error: Currently XPMP2 treats any error returned by the call to FMOD_System_Set3DListenerAttributes
as fatal and shuts down the sound system to avoid further errors. Only the shutdown actually causes the freeze.
The very same freeze happens during a normal exit of the plugin at the same place, ie. during the call to FMOD_System_Release
.
Users see a connection to the use of the PipeWire module (in absence of PulseAudio) in certain Linux distros. I still can't reproduce in a standard Ubuntu 22.04 installation and hence not confirm the suspicion.
Fix/Workaround: It's easy not to treat error 36 as a fatal error, so that no sound shutdown happens thereafter. We've tested that in an analysis version of LiveTraffic.
But I'm not convinced to remove the final call to FMOD_System_Release
during plugin shutdown, as that would mean not to properly clean up FMOD resources. So for the moment the few affected users might need to live with a freeze during shutdown if using XPMP2 sound.