Lockup w/ Linux-SDL

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
novas0x2a
New Member
Posts: 3
Joined: Sun Aug 28, 2005 10:22 pm

Lockup w/ Linux-SDL

Post by novas0x2a »

Background:
August 22 WIP (symptoms also appear in 1.42)
P4 3.4 Ghz
Linux-SDL zsnes
Built from source w/ --enable-debug, with cflags undef
Running in a window in an R mode (but I've had it happen in fullscreen too, it's just more annoying when it's fullscreen)

The problem is: zsnes locks up hard and requires a kill -9.

Reproduced by:
1) Load any rom (I'm pretty sure it's rom-independent)
2) hit esc to bring up the menu
3) click into another window, causing zsnes to lose focus.
4) click back into the zsnes window
5) hit esc to resume the rom

It rarely happens on the very first try (though I have had it happen), but repeat for a while and it will always happen in the first thirty tries or so.

With the debug build, I tracked down more information. The problem is sem_GetTicks() is returning NaN.

I added code to the function, making it:
»···ticks=((float)(now.tv_sec-sem_start.tv_sec))*1000.f+((float)(now.tv_usec-sem_start.tv_usec))*.001f;
»···fprintf(stderr, "Now: %li.%li. Start: %li.%li. Ticks: %f\n",·
now.tv_sec, now.tv_usec, sem_start.tv_sec, sem_start.tv_usec, ticks);
assert(ticks == ticks);
»···return(ticks);

and here is what I see:
[snip]
Now: 1125265114.90439. Start: 1125265094.514740. Ticks: 19575.699219
Now: 1125265114.91710. Start: 1125265094.514740. Ticks: nan
zsnesd: linux/sdllink.c:1188: sem_GetTicks: Assertion `ticks == ticks' failed.

W/o the assertion, it continue running (and the debug output above will be showing normal values again) but zsnes itself will cease to display anything but a black screen, and requires a kill -9 to make it go away.

One suspicious thing I noticed: I removed -fomit-frame-pointer (should --enable-debug leave that in? It seems like it shouldn't..) and got a backtrace- sem_GetTicks is called in quite a few places, but the backtrace is always the same when it crashes:

[snip]
#5 0x402afe9d in __assert_fail () from /lib/libc.so.6
#6 0x080f1d3b in sem_GetTicks () at sdllink.c:1188
#7 0x080f16f1 in CheckTimers () at sdllink.c:914
#8 0x080f1a22 in UpdateVFrame () at sdllink.c:1043
#9 0x080f292a in gl_drawwin () at gl_draw.c:269
#10 0x080f1b4b in drawscreenwin () at sdllink.c:1100
#11 0x080efc84 in DrawScreen.skipconv ()
[snip]

I can't figure out why the ticks math is resulting in a NaN- it doesn't look like an over/underflow or anything. If anyone has any suggestions for what else I can do to debug this, let me know and I'll give it a try.
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Re: Lockup w/ Linux-SDL

Post by Noxious Ninja »

novas0x2a wrote:I removed -fomit-frame-pointer (should --enable-debug leave that in? It seems like it shouldn't..)
Yes, it should. The frame pointer is useful for debugging, although I think that's changed in GCC 4.

EDIT: D'oh, I read your post wrong. We do want the frame pointer, so --enable-debug should remove -fomit-frame-pointer, you are right.

What version of GCC and glibc are you using?
Last edited by Noxious Ninja on Sun Aug 28, 2005 11:23 pm, edited 1 time in total.
[u][url=http://bash.org/?577451]#577451[/url][/u]
novas0x2a
New Member
Posts: 3
Joined: Sun Aug 28, 2005 10:22 pm

Post by novas0x2a »

gcc (GCC) 3.3.5-20050130 (Gentoo Linux 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)

glibc-2.3.5-r1 (as provided by gentoo)

I've been talking to Nach online, and I guess I'm volunteering to get the timing code to work in SDL the same way it works in windows. Heh.

*edit*

Oh, and to clarify, I meant that --enable-debug shouldn't leave in -fomit-frame-pointer, meaning the debug build should have frame pointers. Foolish english language.
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

novas0x2a wrote:Oh, and to clarify, I meant that --enable-debug shouldn't leave in -fomit-frame-pointer, meaning the debug build should have frame pointers. Foolish english language.
I just noticed that myself. :P Disabling the disabling of something... bah.
[u][url=http://bash.org/?577451]#577451[/url][/u]
Post Reply