Opened 9 years ago
Closed 7 years ago
#7011 closed defect (fixed)
RINGWORLD2: Deadlock in the sound code
Reported by: | bgK | Owned by: | csnover |
---|---|---|---|
Priority: | blocker | Component: | Engine: TsAGE |
Version: | Keywords: | has-backtrace, has-pull-request | |
Cc: | Game: | Return to Ringworld |
Description
ScummVM 1.8.0git6411-gf94153f (Feb 1 2016 21:33:04) Platform : Linux x64 Game : R2R demo Steps to reproduce : In the first room, play a bit with the computer's menus. The game freezes after a few clicks with a sound related deadlock.
Backtrace for the first thread:
#0 0x00007ffff4755cfc in __lll_lock_wait () from /usr/lib/libpthread.so.0 No symbol table info available. #1 0x00007ffff474fbb2 in pthread_mutex_lock () from /usr/lib/libpthread.so.0 No symbol table info available. #2 0x00007ffff7b92a5e in ?? () from /usr/lib/libSDL2-2.0.so.0 No symbol table info available. #3 0x0000000001b60b24 in SdlMutexManager::lockMutex (this=0x2951ce0, mutex=0x2ae9c00) at backends/mutex/sdl/sdl-mutex.cpp:36 No locals. #4 0x0000000001b4d5f8 in ModularBackend::lockMutex (this=0x28fcdf0, mutex=0x2ae9c00) at backends/modular-backend.cpp:222 __PRETTY_FUNCTION__ = "virtual void ModularBackend::lockMutex(OSystem::MutexRef)" #5 0x0000000001cba40b in Common::StackLock::lock (this=0x7ffffffb73b0) at common/mutex.cpp:68 No locals. #6 0x0000000001cba38a in Common::StackLock::StackLock (this=0x7ffffffb73b0, mutex=..., mutexName=0x0) at common/mutex.cpp:57 No locals. #7 0x0000000001c48146 in Audio::MixerImpl::isSoundHandleActive (this=0x2ae9ec0, handle=...) at audio/mixer.cpp:452 lock = {_mutex = 0x2ae9c00, _mutexName = 0x0} index = 32767 #8 0x00000000018e7ae8 in TsAGE::SoundBlasterDriver::updateVoice (this=0x2d71140, channel=0) at engines/tsage/sound.cpp:3098 No locals. #9 0x00000000018e1490 in TsAGE::SoundManager::sfRethinkVoiceTypes () at engines/tsage/sound.cpp:1272 vse = @0x2d712a0: {_field4 = -1, _field5 = 0, _field6 = 0, _sound = 0x3058808, _channelNum = 0, _priority = 0, _sound2 = 0x3058808, _channelNum2 = 0, _priority2 = 0, _sound3 = 0x0, _channelNum3 = 0, _priority3 = 0} sound = 0x3058808 vse2 = @0x2d712a0: {_field4 = -1, _field5 = 0, _field6 = 0, _sound = 0x3058808, _channelNum = 0, _priority = 0, _sound2 = 0x3058808, _channelNum2 = 0, _priority2 = 0, _sound3 = 0x0, _channelNum3 = 0, _priority3 = 0} driver = 0x2d71140 idx = 0 idx2 = 0 vs = 0x2d71220 voiceIndex = 3 priorityOffset = 32 __PRETTY_FUNCTION__ = "static void TsAGE::SoundManager::sfRethinkVoiceTypes()" #10 0x00000000018def7d in TsAGE::SoundManager::sfAddToPlayList (sound=0x3058808) at engines/tsage/sound.cpp:624 slock = {_mutex = 0x2caf3d0, _mutexName = 0x0} #11 0x00000000018de3ac in TsAGE::SoundManager::addToPlayList (this=0x2d72788, sound=0x3058808) at engines/tsage/sound.cpp:357 No locals. #12 0x00000000018e2740 in TsAGE::Sound::play (this=0x3058808, soundNum=14) at engines/tsage/sound.cpp:1561 No locals. #13 0x00000000018e5773 in TsAGE::ASound::play (this=0x30587f8, soundNum=14, endAction=0x0, volume=127) at engines/tsage/sound.cpp:2467 No locals. #14 0x000000000183367b in TsAGE::Ringworld2::Scene125::Icon::process (this=0x3059848, event=...) at engines/tsage/ringworld2/ringworld2_scenes0.cpp:465 regionIndex = 2 scene = 0x30578c0 #15 0x00000000018353d7 in TsAGE::Ringworld2::Scene125::process (this=0x30578c0, event=...) at engines/tsage/ringworld2/ringworld2_scenes0.cpp:837 No locals. #16 0x00000000017646a4 in TsAGE::SceneHandler::process (this=0x2cafdf0, event=...) at engines/tsage/core.cpp:4336 No locals. #17 0x000000000180cd48 in TsAGE::Ringworld2::SceneHandlerExt::process (this=0x2cafdf0, event=...) at engines/tsage/ringworld2/ringworld2_logic.cpp:633 scene = 0x30578c0 #18 0x0000000001764e9c in TsAGE::SceneHandler::dispatch (this=0x2cafdf0) at engines/tsage/core.cpp:4472 event = {eventType = TsAGE::EVENT_BUTTON_DOWN, mousePos = {x = 78, y = 30}, btnState = 0, kbd = {keycode = Common::KEYCODE_INVALID, ascii = 0, flags = 0 '\000'}, ctr = 0, gfxMan = 0x7c00000077, handled = false} #19 0x000000000180cd7f in TsAGE::Ringworld2::SceneHandlerExt::dispatch (this=0x2cafdf0) at engines/tsage/ringworld2/ringworld2_logic.cpp:638 No locals. #20 0x00000000017642f9 in TsAGE::GameHandler::execute (this=0x2cafdf0) at engines/tsage/core.cpp:4266 No locals. #21 0x00000000018dcefb in TsAGE::Game::execute (this=0x2cafdd0) at engines/tsage/scenes.cpp:617
Backtrace for the second thread:
#0 0x00007ffff4755cfc in __lll_lock_wait () from /usr/lib/libpthread.so.0 No symbol table info available. #1 0x00007ffff474fbb2 in pthread_mutex_lock () from /usr/lib/libpthread.so.0 No symbol table info available. #2 0x00007ffff7b92a5e in ?? () from /usr/lib/libSDL2-2.0.so.0 No symbol table info available. #3 0x0000000001b60b24 in SdlMutexManager::lockMutex (this=0x2951ce0, mutex=0x2caf3d0) at backends/mutex/sdl/sdl-mutex.cpp:36 No locals. #4 0x0000000001b4d5f8 in ModularBackend::lockMutex (this=0x28fcdf0, mutex=0x2caf3d0) at backends/modular-backend.cpp:222 __PRETTY_FUNCTION__ = "virtual void ModularBackend::lockMutex(OSystem::MutexRef)" #5 0x0000000001cba40b in Common::StackLock::lock (this=0x7fffdffeab90) at common/mutex.cpp:68 No locals. #6 0x0000000001cba38a in Common::StackLock::StackLock (this=0x7fffdffeab90, mutex=..., mutexName=0x0) at common/mutex.cpp:57 No locals. #7 0x00000000018e76ba in TsAGE::AdlibSoundDriver::onTimer (this=0x2d654d0) at engines/tsage/sound.cpp:3017 slock1 = {_mutex = 0x2caf3a0, _mutexName = 0x0} slock2 = {_mutex = 0x2caf3d0, _mutexName = 0x0} #8 0x00000000018e9b92 in Common::Functor0Mem<void, TsAGE::AdlibSoundDriver>::operator() (this=0x2d806d0) at ./common/func.h:388 No locals. #9 0x0000000001c38584 in OPL::EmulatedOPL::readBuffer (this=0x2cb0160, buffer=0x7fffc8001070, numSamples=2048) at audio/fmopl.cpp:295 stereoFactor = 1 len = 1504 step = 800 #10 0x0000000001c8d4b9 in Audio::CopyRateConverter<false, false>::flow (this=0x2d80760, input=..., obuf=0x2adea90, osamp=2048, vol_l=256, vol_r=256) at audio/rate.cpp:315 __PRETTY_FUNCTION__ = "int Audio::CopyRateConverter<stereo, reverseStereo>::flow(Audio::AudioStream&, Audio::st_sample_t*, Audio::st_size_t, Audio::st_volume_t, Audio::st_volume_t) [with bool stereo = false; bool reverseSte"... ptr = 0x2d80748 len = 32767 ostart = 0x2adea90 #11 0x0000000001c48b16 in Audio::Channel::mix (this=0x2d80700, data=0x2adea90, len=2048) at audio/mixer.cpp:621 __PRETTY_FUNCTION__ = "int Audio::Channel::mix(int16*, uint)" res = 0 #12 0x0000000001c475e6 in Audio::MixerImpl::mixCallback (this=0x2ae9ec0, samples=0x2adea90 "", len=2048) at audio/mixer.cpp:293 i = 0 __PRETTY_FUNCTION__ = "int Audio::MixerImpl::mixCallback(byte*, uint)" lock = {_mutex = 0x2ae9c00, _mutexName = 0x0} buf = 0x2adea90 res = 0 tmp = 0 #13 0x0000000001b60a1b in SdlMixerManager::callbackHandler (this=0x2a80c70, samples=0x2adea90 "", len=8192) at backends/mixer/sdl/sdl-mixer.cpp:164 __PRETTY_FUNCTION__ = "virtual void SdlMixerManager::callbackHandler(byte*, int)" #14 0x0000000001b60a77 in SdlMixerManager::sdlCallback (this_=0x2a80c70, samples=0x2adea90 "", len=8192) at backends/mixer/sdl/sdl-mixer.cpp:171 manager = 0x2a80c70 __PRETTY_FUNCTION__ = "static void SdlMixerManager::sdlCallback(void*, byte*, int)"
The backtrace is with SDL2, but it happens just the same with SDL1.
Ticket imported from: bugs/7011.
Change History (8)
comment:1 by , 9 years ago
Priority: | normal → high |
---|
comment:2 by , 9 years ago
comment:3 by , 7 years ago
Priority: | high → blocker |
---|
Raising all identified crasher, hang, and memory violation bugs which I could not fully triage myself to blocker priority for the next release.
comment:4 by , 7 years ago
Keywords: | has-backtrace added |
---|
comment:5 by , 7 years ago
This is basically the same as the other audio deadlocks in the game:
- The main thread calls to sfAddToPlayList which locks the game’s sound manager mutex;
- The audio thread is triggered, which locks the system mixer mutex, then the OPL callback tries to lock the game’s sound manager mutex and blocks;
- The main thread calls to a mixer method which tries to lock the system mixer mutex, which blocks;
- Deadlock.
comment:6 by , 7 years ago
Owner: | set to |
---|
comment:7 by , 7 years ago
Keywords: | has-pull-request added |
---|
comment:8 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for your report! A patch for this issue has been added in commit fe45300891fea90f7ad72d66af7f060c3ec6b753 and will be available in daily builds 1.10.0git-5490 and later.
It would be nice to fix it before the release of 1.8.0. Raising priority.