Jump to content
Eternal Lands Official Forums
Sign in to follow this  
belton

Locking error

Recommended Posts

Got a crash running under gdb:

 
(gdb) run
Starting program: /home/nadav/elc64/el.x86.linux.bin
[Thread debugging using libthread_db enabled]
[New Thread 47278726604224 (LWP 12136)]
[New Thread 1082624336 (LWP 12137)]
[New Thread 1091017040 (LWP 12138)]
ALSA lib pcm_dmix.c:864:(snd_pcm_dmix_open) unable to open slave
open /dev/[sound/]dsp: Device or resource busy
[New Thread 1099409744 (LWP 12139)]
[Thread 1091017040 (LWP 12138) exited]
[New Thread 1107802448 (LWP 12140)]
[New Thread 1116195152 (LWP 12141)]
[Thread 1107802448 (LWP 12140) exited]
[Thread 1116195152 (LWP 12141) exited]
[New Thread 1124587856 (LWP 12142)]
[Thread 1124587856 (LWP 12142) exited]
ALSA lib pcm_dmix.c:864:(snd_pcm_dmix_open) unable to open slave
open /dev/[sound/]dsp: Device or resource busy
ALSA lib pcm_dmix.c:864:(snd_pcm_dmix_open) unable to open slave
open /dev/[sound/]dsp: Device or resource busy
[New Thread 1132980560 (LWP 12147)]
[New Thread 1141373264 (LWP 12148)]
Caster: ID: 231 Name: SEXydevil �rawr X: 83 Y: 13.5
Target: ID: 2006 Name: Grizzly Bear X: 79.5 Y: 13.5
Caster: ID: 306 Name: KadluB �xXx X: 64 Y: 8.5
Target: ID: 2006 Name: Grizzly Bear X: 63 Y: 9.5
Caster: ID: 418 Name: Scorpius �L.A. X: 28.5 Y: 57
Target: ID: 3164 Name: �Yeti X: 28 Y: 56
Caster: ID: 249 Name: Scorpius �L.A. X: 32.5 Y: 77.5
Target: ID: 2944 Name: �Yeti X: 32.5 Y: 78.5

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1082624336 (LWP 12137)]
0x00000000004be726 in update_sound (ms=30) at sound.c:3992
3992					if (actors_list[i]->actor_id == yourself)
(gdb) print i
$1 = 21
(gdb) print actors_list[21]
$2 = (actor *) 0x0
(gdb) print yourself
$3 = 206
(gdb) list 3992
3987					{
3988							UNLOCK_SOUND_LIST();
3989							handle_walking_sound(actors_list[i], actors_list[i]->cur_anim.sound);
3990							LOCK_SOUND_LIST();
3991					}
3992					if (actors_list[i]->actor_id == yourself)
(gdb) bt
#0  0x00000000004be726 in update_sound (ms=30) at sound.c:3992
#1  0x00000000004d697e in my_timer (interval=30, data=0x0) at timers.c:45
#2  0x00002affe8e6fa87 in ?? () from /usr/lib/libSDL-1.2.so.0
#3  0x00002affe8eb65d3 in ?? () from /usr/lib/libSDL-1.2.so.0
#4  0x00002affe8e6f457 in ?? () from /usr/lib/libSDL-1.2.so.0
#5  0x00002affe8eb40d9 in ?? () from /usr/lib/libSDL-1.2.so.0
#6  0x00002affeda19317 in start_thread () from /lib/libpthread.so.0
#7  0x00002affeb059d5d in clone () from /lib/libc.so.6
#8  0x0000000000000000 in ?? ()

 

Looking at the code, it seems the actors mutex must be held, as actors_list may change (in this example the code crashed on dereferencing actors_list[21], which was dereferenced before)

 

Putting LOCK/UNLOCK_ACTORS_LISTS around the function seems to work

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×