I’m seeing a hang in FMOD::System::close() at times on ubuntu 9.04 w/pulseaudio using the alsa output in FMOD. The following reproduces the hang 100% of the time for me:
[list:ws9je78a][:ws9je78a]Start the playsound example[/:m:ws9je78a]
[:ws9je78a]Play a sound (plays as expected)[/:m:ws9je78a]
[:ws9je78a]Open up pavucontrol[/:m:ws9je78a]
[:ws9je78a]In the playback tab, terminate the playsound stream[/:m:ws9je78a]
[:ws9je78a]Go back to the playsound window[/:m:ws9je78a]
[:ws9je78a]Play a sound (will show no progress and stay at 00:00:00, shouldn’t there be an error instead?)[/:m:ws9je78a]
[:ws9je78a]Press esc to quit (hang in FMOD::System::close())[/:m:ws9je78a][/list:u:ws9je78a]
At this point, the main thread is stuck in a sem_wait() and there are 2 others that appear to be stuck in a blocking poll() (or one with a large timeout as I haven’t seen them go past there).
- WhiteDwarf asked 8 years ago
Firstly it’s worth mentioning that this particular use case seems rather strange to me, you are basically pulling the rug out from under FMOD. What are you trying to achieve by doing this?
It sounds to me like killing the PA stream is cause the blocking write operation we do (in our mixer thread) to service ALSA is not returning because the stream is gone.
Since System::close will try and close the mixer thread before shutting down it is probably stalling because the mixer is stalled. I might be able to force it out, I will need to check the ALSA API to be sure.
I have checked out the ALSA API and there is no way to interrupt our blocking calls to write PCM data. The only alternative would be to reengineer the output mode to work in a non-blocking fashion.
However we don’t intend on doing this as the problem you describe is a rare edge case. No one has ever run into this before, so unless there is a more mainstream way of causing this problem we don’t believe it is worth pursuing.
I haven’t seen it personally, but others have mentioned to me that pulseaudio will sometimes terminate a stream on its own (still trying to determine exactly what causes that). The method I posted is merely a method to produce the same effect as what happens in that case. I’ll let you know what I find out. It is entirely possible the issue lies elsewhere.
- WhiteDwarf answered 8 years ago
Please login first to submit.