Re: [Bug-XBoard] xboard: Error: second chess program exited unexpectedly

2009-11-02 Thread Tim Mann
HG, thanks for letting us know what you found out there.

One small comment: I'm not sure why you say "A move coming in from an
opponent of an already dead engine should not be added to the PGN."  Is
it because you've already added something like "0-1 {Engine crashed}"
to the PGN?  If so, it seems similar to the case of an engine resigning
when not on move, or for that matter the human resigning when not on
move -- one more move might come in from the opposing engine.  Do we
handle that now?

-- 
Tim Mann  t...@tim-mann.org  http://tim-mann.org/


___
Bug-XBoard mailing list
Bug-XBoard@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-xboard


Re: [Bug-XBoard] xboard: Error: second chess program exited unexpectedly

2009-11-02 Thread h.g. muller

At 11:45 31-10-2009 -0700, Tim Mann wrote:

The double free worries me more than the XtRemoveGrab error.  Of course
they could be related, and it would be best to fix both even if they aren't.


OK, for the record: I had some more e-mail exchanges with the reporter of 
this bug,
and it turned out we were dealing with a combination of problems here. For 
one, he
was using 4.4.0~beta1, and what he showed was not the debug file but the 
console
output. The 'StartChildProcess' messages thus go to the wrong output 
channel, I think.
This made me misunderstand when the crash actually happened; in fact it did 
not occur
at startup of the engines at all, but after a game, when the user was 
trying to open the

Engine #N Settings dialog. The unlisted-widget problem was an already-fixed bug
(sept 30 commit) that tried to set focus to a text-edit in the dialog while 
there were none.
(And there were none for Toga2, because the user was using an obsolete 
Polyglot that

did not transmit any engine options.)

Now the third problem was that the bitbase implemetation of Toga2 is buggy, 
and that
the user was using it with bitbases, so we were also dealing with genuine 
Toga2 crashes
during the game. This of course cannot be blamed on XBoard, but the error 
exit seemed
to be unclean, and kept printing the free() complaint and stack trace in 
the console. I could
trace that to the second engine dying while the first is thinking. The 
dying engine causes an
immediate read error, which triggers a fatal-error popup. But as long as 
the user does not
close the popup, the second engine keeps thinking, and sooner or later 
spits out a move.
This now hit a bug from my hand: The dying engine had set 
gameInfo.resultDetails to point
to a local buffer, and a move coming in tries to free() the resultDetails 
and set result to "*",
because the game is obviously still continuing. This crashed XBoard; 
resultDetails
must only be assigned through strdup, or the free() chokes, and I did not 
know it...


If I assign "engine exited unexpectedly" to resultDetails using strdup, 
XBoard no longer
crashes. But then the behavior is not really the desired behavior anymore. 
(In fact a
crash was close to the desired behavior; we were working on an error exit, 
after all...)


In stead of automatically terminating, XBoard now pops up a _second_ fatal 
error:
After receiving the move from the opponent it tries to send it to the dead 
engine,

which leads to a broken-pipe error. XBoard hangs until the user closes both
error popups. The double error is undesirable, and in fact now messes up proper
error reporting in the PGN. This will have to be re-thought a little bit. A 
move coming

in from an opponent of an already dead engine should not be added to the PGN,
so some form of flagging the alive status of engines must be implemented.


___
Bug-XBoard mailing list
Bug-XBoard@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-xboard


Re: [Bug-XBoard] xboard: Error: second chess program exited unexpectedly

2009-10-31 Thread Tim Mann
The double free worries me more than the XtRemoveGrab error.  Of course
they could be related, and it would be best to fix both even if they aren't.

> >Warning: XtRemoveGrab asked to remove a widget not on the list
> >xboard: Error: second chess program (polyglot 
> >/home/matrix/.polyglot/toga2.ini) exited unexpectedly
> >*** glibc detected *** xboard: double free or corruption (out): 
> >0x7fff12a1af40 ***

-- 
Tim Mann  t...@tim-mann.org  http://tim-mann.org/


___
Bug-XBoard mailing list
Bug-XBoard@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-xboard


Re: [Bug-XBoard] xboard: Error: second chess program exited unexpectedly

2009-10-31 Thread h.g. muller

At 18:21 31-10-2009 +0200, matrix one wrote:

Hi,

Is happend only with toga2



Linux s3 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009 
x86_64 GNU/Linux


xboard -debug -size huge -coords -scp 'polyglot 
/home/matrix/.polyglot/toga2.ini' -fcp 'polyglot 
/home/matrix/.polyglot/stockfish.ini'

StartChildProcess (dir=".") polyglot /home/matrix/.polyglot/stockfish.ini
StartChildProcess (dir=".") polyglot /home/matrix/.polyglot/toga2.ini
Warning: XtRemoveGrab asked to remove a widget not on the list
xboard: Error: second chess program (polyglot 
/home/matrix/.polyglot/toga2.ini) exited unexpectedly
*** glibc detected *** xboard: double free or corruption (out): 
0x7fff12a1af40 ***


Hmm, the RemoveGrab warning makes it a bit suspect. I could find only one 
call to XtRemoveGrab()
in the entire source, and this is in ThawUI(). Apparently XBoard uses the 
kludge to let a deaf-and-dumb
widget (the messageWidget) grab focus while waiting for the engine to 
complete initialization.


I am not sure if we are dealing here with a bug in the error exit procedure 
triggered by toga2 crashing,
or that something is badly wrong in XBoard that makes it unjustly believe 
toga2 exits. I suspect
the former, as that would explain why this only happens with toga2, and not 
with other engines.
Is this a reproducible error? If so, it would help to see the Polyglot log 
file (which can be obtained
by setting PolyglotLog=true in the toga2.ini file), which mght indicate if 
the trouble starts there.


H.G.


___
Bug-XBoard mailing list
Bug-XBoard@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-xboard


[Bug-XBoard] xboard: Error: second chess program exited unexpectedly

2009-10-31 Thread matrix one
Hi,

Is happend only with toga2



Linux s3 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 2009
x86_64 GNU/Linux

xboard -debug -size huge -coords -scp 'polyglot
/home/matrix/.polyglot/toga2.ini' -fcp 'polyglot
/home/matrix/.polyglot/stockfish.ini'
StartChildProcess (dir=".") polyglot /home/matrix/.polyglot/stockfish.ini
StartChildProcess (dir=".") polyglot /home/matrix/.polyglot/toga2.ini
Warning: XtRemoveGrab asked to remove a widget not on the list
xboard: Error: second chess program (polyglot
/home/matrix/.polyglot/toga2.ini) exited unexpectedly
*** glibc detected *** xboard: double free or corruption (out):
0x7fff12a1af40 ***
=== Backtrace: =
/lib/libc.so.6[0x7ff4684c1dd6]
/lib/libc.so.6(cfree+0x6c)[0x7ff4684c670c]
xboard[0x4157ea]
xboard[0x418762]
xboard[0x41bf5b]
xboard[0x43ad1f]
/usr/lib/libXt.so.6[0x7ff4682164bd]
/usr/lib/libXt.so.6(XtAppNextEvent+0xa9)[0x7ff4682166e9]
/usr/lib/libXt.so.6(XtAppMainLoop+0x43)[0x7ff468208bd3]
xboard[0x446b90]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7ff46846aabd]
xboard[0x404d89]
=== Memory map: 
0040-00513000 r-xp  08:01 57408
/usr/games/xboard
00712000-00713000 r--p 00112000 08:01 57408
/usr/games/xboard
00713000-0078 rw-p 00113000 08:01 57408
/usr/games/xboard
0078-008dc000 rw-p  00:00 0
009b3000-00ac2000 rw-p  00:00 0
[heap]
7ff46000-7ff460021000 rw-p  00:00 0
7ff460021000-7ff46400 ---p  00:00 0
7ff4661f2000-7ff466208000 r-xp  08:01 17561
/lib/libgcc_s.so.1
7ff466208000-7ff466407000 ---p 00016000 08:01 17561
/lib/libgcc_s.so.1
7ff466407000-7ff466408000 r--p 00015000 08:01 17561
/lib/libgcc_s.so.1
7ff466408000-7ff466409000 rw-p 00016000 08:01 17561
/lib/libgcc_s.so.1
7ff466409000-7ff46640e000 r-xp  08:01 51838
/usr/lib/libXfixes.so.3.1.0
7ff46640e000-7ff46660d000 ---p 5000 08:01 51838
/usr/lib/libXfixes.so.3.1.0
7ff46660d000-7ff46660e000 r--p 4000 08:01 51838
/usr/lib/libXfixes.so.3.1.0
7ff46660e000-7ff46660f000 rw-p 5000 08:01 51838
/usr/lib/libXfixes.so.3.1.0
7ff46660f000-7ff466618000 r-xp  08:01 23600
/usr/lib/libXrender.so.1.3.0
7ff466618000-7ff466817000 ---p 9000 08:01 23600
/usr/lib/libXrender.so.1.3.0
7ff466817000-7ff466818000 r--p 8000 08:01 23600
/usr/lib/libXrender.so.1.3.0
7ff466818000-7ff466819000 rw-p 9000 08:01 23600
/usr/lib/libXrender.so.1.3.0
7ff466819000-7ff466822000 r-xp  08:01 30110
/usr/lib/libXcursor.so.1.0.2
7ff466822000-7ff466a21000 ---p 9000 08:01 30110
/usr/lib/libXcursor.so.1.0.2
7ff466a21000-7ff466a22000 r--p 8000 08:01 30110
/usr/lib/libXcursor.so.1.0.2
7ff466a22000-7ff466a23000 rw-p 9000 08:01 30110
/usr/lib/libXcursor.so.1.0.2
7ff466a23000-7ff466a28000 r-xp  08:01 9083
/usr/lib/libXdmcp.so.6.0.0
7ff466a28000-7ff466c27000 ---p 5000 08:01 9083
/usr/lib/libXdmcp.so.6.0.0
7ff466c27000-7ff466c28000 rw-p 4000 08:01 9083
/usr/lib/libXdmcp.so.6.0.0
7ff466c28000-7ff466c2a000 r-xp  08:01 82015
/usr/lib/libXau.so.6.0.0
7ff466c2a000-7ff466e29000 ---p 2000 08:01 82015
/usr/lib/libXau.so.6.0.0
7ff466e29000-7ff466e2a000 r--p 1000 08:01 82015
/usr/lib/libXau.so.6.0.0
7ff466e2a000-7ff466e2b000 rw-p 2000 08:01 82015
/usr/lib/libXau.so.6.0.0
7ff466e2b000-7ff466e2e000 r-xp  08:01 82059
/lib/libuuid.so.1.3.0
7ff466e2e000-7ff46702e000 ---p 3000 08:01 82059
/lib/libuuid.so.1.3.0
7ff46702e000-7ff46702f000 r--p 3000 08:01 82059
/lib/libuuid.so.1.3.0
7ff46702f000-7ff46703 rw-p 4000 08:01 82059
/lib/libuuid.so.1.3.0
7ff46703-7ff467032000 r-xp  08:01 8764
/lib/libdl-2.10.1.so
7ff467032000-7ff467232000 ---p 2000 08:01 8764
/lib/libdl-2.10.1.so
7ff467232000-7ff467233000 r--p 2000 08:01 8764
/lib/libdl-2.10.1.so
7ff467233000-7ff467234000 rw-p 3000 08:01 8764
/lib/libdl-2.10.1.so
7ff467234000-7ff46724f000 r-xp  08:01 86399
/usr/lib/libxcb.so.1.1.0
7ff46724f000-7ff46744e000 ---p 0001b000 08:01 86399
/usr/lib/libxcb.so.1.1.0
7ff46744e000-7ff46744f000 r--p 0001a000 08:01 86399
/usr/lib/libxcb.so.1.1.0
7ff46744f000-7ff46745 rw-p 0001b000 08:01 86399
/usr/lib/libxcb.so.1.1.0
7ff46745-7ff467461000 r-xp  08:01 76673
/usr/lib/libXext.so.6.4.0
7ff467461000-7ff46766 ---p 00011000 08:01 76673
/usr/lib/libXext.so.6.4.0
7ff46766-7ff467661000 r--p 0001 08:01 76673
/usr/lib/libXext.so.6.4.0
7ff467661000-7ff467662000 rw-p 00011000 08:01 76673
/usr/lib/libXext.so.6.4.0
7ff467662000-7ff467679000 r-xp  08:01 108551
/usr/lib/libICE.so.6.3.0
7ff467679000-7ff467878000 ---p 00017000 08:01 108551
/usr/lib/libICE.so.6.3.0
7ff467878000-7ff467879000 r--p 00016000 08:01 108551
/usr/lib/libICE.so.6.3.0
7ff467879000-7ff46787a000 rw-p 00017000 08:01 108551
/usr/lib/libICE.so.6.3.0
7ff46787a000-7ff46787d000 rw-p  00:00 0
7ff46787d000-7ff467885000 r-xp  08:01 23011
/usr/lib/libSM.so.6.0.0
7ff467885000-7ff467a84000 ---p 8000 08:01 23011
/usr/lib/libSM.so.6.0.0
7ff467a84000-7ff467a85000 r--