Page 1 of 1

Random lock-up (10b linux)

Posted: Sun Sep 12, 2010 3:15 pm
by greycat
Running along on Maze(6), and the game just completely locked up -- no response to mouse/keyboard, no CPU use, no redrawing of a covered-then-exposed corner.

Code: Select all

...
0xb77bb422 in __kernel_vsyscall ()
(gdb) bt
#0  0xb77bb422 in __kernel_vsyscall ()
#1  0xb74da036 in nanosleep () from /lib/i686/cmov/libc.so.6
#2  0xb7756748 in SDL_Delay () from /usr/lib/libSDL-1.2.so.0
#3  0xb7702e6b in SDL_WaitEvent () from /usr/lib/libSDL-1.2.so.0
#4  0x0804e377 in main (argc=1, argv=0xbfa268d4) at src/main.c:665
Hmm, I wonder how many nanoseconds it was told to sleep...? No idea how to find out.

Code: Select all

(gdb) up 1
#1  0xb74da036 in nanosleep () from /lib/i686/cmov/libc.so.6
(gdb) args
Undefined command: "args".  Try "help".
(gdb) help
...
(gdb) help stack
Examining the stack.
...
(gdb) up
#2  0xb7756748 in SDL_Delay () from /usr/lib/libSDL-1.2.so.0
(gdb) bt
#0  0xb77bb422 in __kernel_vsyscall ()
#1  0xb74da036 in nanosleep () from /lib/i686/cmov/libc.so.6
#2  0xb7756748 in SDL_Delay () from /usr/lib/libSDL-1.2.so.0
#3  0xb7702e6b in SDL_WaitEvent () from /usr/lib/libSDL-1.2.so.0
#4  0x0804e377 in main (argc=1, argv=0xbfa268d4) at src/main.c:665
(gdb) down
#1  0xb74da036 in nanosleep () from /lib/i686/cmov/libc.so.6
(gdb) return
Make selected stack frame return now? (y or n) y
#0  0xb7756748 in SDL_Delay ()
   from /usr/lib/libSDL-1.2.so.0
That didn't work. The game was still locked up.

Code: Select all

(gdb) where
#0  0xb7756748 in SDL_Delay () from /usr/lib/libSDL-1.2.so.0
#1  0xb7702e6b in SDL_WaitEvent () from /usr/lib/libSDL-1.2.so.0
#2  0x0804e377 in main (argc=1, argv=0xbfa268d4) at src/main.c:665
(gdb) return
Make selected stack frame return now? (y or n) y
#0  0xb7702e6b in SDL_WaitEvent
    () from /usr/lib/libSDL-1.2.so.0
Still no result.

Code: Select all

(gdb) bt
#0  0xb7702e6b in SDL_WaitEvent () from /usr/lib/libSDL-1.2.so.0
#1  0x0804e377 in main (argc=1, argv=0xbfa268d4) at src/main.c:665
(gdb) return
Make selected stack frame return now? (y or n) y
#0  0x0804e377 in main (argc=1, 
    argv=0xbfa268d4) at src/main.c:665
665			if (!isActive || tickPaused) SDL_WaitEvent(NULL);
Still nothing.

Code: Select all

(gdb) n
Single stepping until exit from function __kernel_vsyscall, 
which has no line number information.
[Switching to Thread 0xb6e156c0 (LWP 23764)]
668			while (SDL_PollEvent(&event))
(gdb) cont
Continuing.
STILL nothing! *sigh* OK, I guess it's time to kill the process and then hope to $DEITY the last savefile isn't corrupt.

Re: Random lock-up (10b linux)

Posted: Sun Sep 12, 2010 3:24 pm
by greycat
And here's the last part of the stdout/stderr log file:

Code: Select all

[LOG]	You have found a trap (trap)!
checkHit	10.5	7
=> chance to hit	63.033376849501
checkHit	10.5	7
=> chance to hit	63.033376849501
77 ticks  in 451.536 seconds = 0.170529 TPS
checkHit	10.5	7
=> chance to hit	63.033376849501
checkHit	10.5	7
=> chance to hit	63.033376849501
bind	MOVE_DOWN	function: 0xc213a50
bind	MOVE_UP	function: 0xbc77b10
bind	EXIT	function: 0x95987e8
bind	ACCE
Is it possible to tell t-engine to change its buffering? Can you stick a

Code: Select all

setvbuf(stdout, (char *) NULL, _IOLBF, 0);
at the beginning of the code so that stdout doesn't get truncated like that?

Re: Random lock-up (10b linux)

Posted: Sun Sep 12, 2010 4:10 pm
by greycat
Actually tried that, and it's definitely working, in terms of making the log file get updated in "real time". I haven't encountered another random crash or lock-up since then, of course (they're VERY rare), but it's nice to be able to leave "tail -f logs/charname" running.

Code: Select all

--- t-e-10b/src/main.c	2010-09-05 08:48:23.000000000 -0400
+++ t-engine4-src-1.0.0beta10b/src/main.c	2010-09-12 11:27:26.000000000 -0400
@@ -602,6 +602,9 @@
 	// RNG init
 	init_gen_rand(time(NULL));
 
+	// Change to line buffering
+	setvbuf(stdout, (char *) NULL, _IOLBF, 0);
+
 	boot_lua(1, FALSE, argc, argv);
 
 	// initialize engine and set up resolution and depth

Re: Random lock-up (10b linux)

Posted: Sun Sep 12, 2010 4:16 pm
by darkgod
Good idea I'll add that thanks :)

As for the lockup ... uhhh ... :/