diego1996 / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Deadlock while stopping sound on Linux #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use linux and gamekit svn revision 484
2. Start any game with sound
3. Pres Esc to quit the game

What is the expected output? What do you see instead?
Expected is to exit the game. 

Instead it stall while stoping all sound gkEngine::finalize() at line 236: 
gkSoundManager::getSingleton().stopAllSounds(); never returns

If interrupting the program while stuck show the following backtrace:
Thread 6 (Thread 0x7fffee612710 (LWP 12694)):
#0  __lll_lock_wait () at 
../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
#1  0x00007ffff69290e9 in _L_lock_953 () from /lib/libpthread.so.0
#2  0x00007ffff6928f0b in __pthread_mutex_lock (mutex=0x50058c8) at 
pthread_mutex_lock.c:61
#3  0x0000000000bbf860 in Lock (this=0x7fffee611bf0, obj=...) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Thread/gkCriticalSection.cpp:84
#4  0x0000000000c0414f in gkBuffer::read (this=0x50058c0, len=32768, 
br=@0x7fffee611c3c) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkBuffer.cpp:288
#5  0x0000000000c03b54 in gkBuffer::queue (this=0x50058c0, play=true) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkBuffer.cpp:167
#6  0x0000000000c04289 in gkBuffer::stream (this=0x50058c0) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkBuffer.cpp:320
#7  0x0000000000bc3e8c in gkStreamer::runProtected (this=0x1c072b0) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkStreamer.cpp:204
#8  0x0000000000bc40eb in gkStreamerTick::tickImpl (this=0x7fffee611d80, 
delta=0.0222222228) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkStreamer.cpp:262
#9  0x0000000000ad35cf in gkTickState::tick (this=0x7fffee611d80) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/gkTickState.cpp:105
#10 0x0000000000bc3fac in gkStreamer::run (this=0x1c072b0) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkStreamer.cpp:240
#11 0x0000000000bc006d in gkThread::run (this=0x4fe1120) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Thread/gkThread.cpp:91
#12 0x0000000000bbfe30 in gkThread::task (p=0x4fe1120) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Thread/gkThread.cpp:50
#13 0x00007ffff69268ba in start_thread (arg=<value optimized out>) at 
pthread_create.c:300
#14 0x00007ffff5a7201d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#15 0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7fffef614710 (LWP 12693)):
#0  0x00007ffff5a67103 in *__GI___poll (fds=<value optimized out>, nfds=<value 
optimized out>, timeout=1000) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00007fffedb824da in ?? () from /usr/lib/libasound.so.2
#2  0x00007ffff79b29ea in ?? () from /usr/lib/libopenal.so.1
#3  0x00007ffff79b09aa in ?? () from /usr/lib/libopenal.so.1
#4  0x00007ffff69268ba in start_thread (arg=<value optimized out>) at 
pthread_create.c:300
#5  0x00007ffff5a7201d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()
Current language:  auto
The current source language is "auto; currently asm".

Thread 1 (Thread 0x7ffff7ed07a0 (LWP 12687)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x0000000000bbfd50 in gkSyncObj::wait (this=0x1c07358) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Thread/gkSyncObj.cpp:87
#2  0x0000000000bc3cf0 in gkStreamer::notify (this=0x1c072b0, buf=0x50058c0) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkStreamer.cpp:163
#3  0x0000000000bc3ca6 in gkStreamer::stopBuffer (this=0x1c072b0, 
buf=0x50058c0) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkStreamer.cpp:150
#4  0x0000000000bc398a in gkStreamer::stopAllSounds (this=0x1c072b0) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkStreamer.cpp:86
#5  0x0000000000bc0be9 in gkSoundManager::stopAllSounds (this=0x1bcd970) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/Sound/gkSoundManager.cpp:135
#6  0x0000000000acce15 in gkEngine::finalize (this=0x1b81300) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/gkEngine.cpp:236
#7  0x0000000000acc4e1 in ~gkEngine (this=0x1b81300, __in_chrg=<value optimized 
out>) at /home/xavier/Projects/Gamekit/gamekit/Engine/gkEngine.cpp:135
#8  0x0000000000acbc1b in ~gkCoreApplication (this=0x7fffffffe670, 
__in_chrg=<value optimized out>) at 
/home/xavier/Projects/Gamekit/gamekit/Engine/gkCoreApplication.cpp:38
#9  0x0000000000ac5183 in ~OgreKit (this=0x7fffffffe670, __in_chrg=<value 
optimized out>) at 
/home/xavier/Projects/Gamekit/gamekit/Samples/Runtime/Main.cpp:44
#10 0x0000000000abcc74 in main (argc=1, argv=0x7fffffffe818) at 
/home/xavier/Projects/Gamekit/gamekit/Samples/Runtime/Main.cpp:174

Original issue reported on code.google.com by xavier.thomas.1980@gmail.com on 3 Aug 2010 at 3:24

GoogleCodeExporter commented 9 years ago
Thanks for bringing this up! ( It's never safe to assume that things will work 
exactly the same from platform to platform )
It has been confirmed, tested and fixed in Linux.

Original comment by snailr...@gmail.com on 3 Aug 2010 at 10:47

GoogleCodeExporter commented 9 years ago
There are still a few issues with sound & threads remaining, Hopefully it wont 
take to long to sort them out.

Original comment by snailr...@gmail.com on 4 Aug 2010 at 12:05

GoogleCodeExporter commented 9 years ago
Should be fixed completely now. 

Original comment by snailr...@gmail.com on 7 Aug 2010 at 12:07