Bug in xboard 4.4.4; banned for ICC rated play!

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: The modify-after-free bug

Post by sje »

hgm wrote:Note that originally, when this -xrm option was still understood, you also were using a \n in the string. Apparently the X-server does perform escape expanding on its options that the shell doesn't do.
Perhaps the xrm processing should be revived.

Or, introduce a new option:

Code: Select all

-zippyGameEndScript <file-of-command-strings>
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: The modify-after-free bug

Post by sje »

sje wrote:I removed the autocomm option from the xboard invocation and restarted the program both on FICS and ICC. The idea is to see if this will make the modify-after-free bug hide in shame.
My hopes have been dashed, for a segmentation fault has appeared in absence of the autocomm option.

xboard 4.5.2a / ICC / OS/X 10.7:

Code: Select all

Goldbar(C) kibitzes: !!! +99.85/14 (6.41 sec, 77320390 nodes, 12061 knps) PV=c6 f3 exf3 Kd4 c7 Ke3 Ra3+ Kf2 c8=Q Kg2 f4 Kf1 Ra2 Kg1
aics% Symbolic(C) kibitzes: [-LoseIn7/14/0.081/93,632/1] 65... f3 66 exf3+ Kf4 67 c8=Q Kg3 68 Qc5 Kf4 69 Qxh5 Ke3 70 Ra2 Kd4 71 Qd5+ Ke3 72 Qe4#
(kibitzed to 2 people)
aics% 
Goldbar(C) kibitzes: !!! +99.87/15 (5.51 sec, 45437351 nodes, 8245 knps) PV=c7 f3 c8=Q fxe2 Qf5+ Ke3 Ra3+ Kd2 Ra2+ Ke3 Nd5+ Kd4 Rd2#
aics% 
Goldbar(C) kibitzes: !!! +99.89/16 (6.30 sec, 7813449 nodes, 1240 knps) PV=c8=Q fxe2 Qf5+ Ke3 Ra3+ Kd2 Ra2+ Ke3 Nd5+ Kd4 Rd2#
aics% Symbolic(C) kibitzes: [-LoseIn5/10/0.208/180,772/27] 66... fxe2 67 Qf5+ Ke3 68 Ra3+ Kd2 69 Ra2+ Ke3 70 Nd5+ Kd4 71 Rd2#
(kibitzed to 2 people)
aics% ./AutoICC: line 19: 13028 Segmentation fault: 11  /usr/local/bin/xboard -autoflag -fcp "./Symbolic -c xboard" -fd $HOME/Arena/Symbolic -hideThinkingFromHuman false -ics -icshost chessclub.com -icslogon $HOME/Arena/Symbolic/icclogon -sgf $HOME/Arena/Symbolic/icc.pgn -size Medium -thinking -xalarm -xanimate -xbuttons -xzab -xzadj -zippyGameEnd "multi seek 5 ; seek 15" -zippyMaxGames 2 -zp
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: The modify-after-free bug

Post by hgm »

Well, that is actually good, because I scrutized the code called on -autoComment, and I have not been able to find anything suspicious there.

Note that in WinBoard free'ing a non-malloc'ed or damaged piece of memory causes no error, as apparently the malloc/free system on Windows uses a checksum to judge the validity of the free request, and just ignores requests with corrupted data. So the whole system is in practice only weakly tested.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: The modify-after-free bug

Post by sje »

So with autocomm, I see the modify-after-free bug, and without it I see a segmentation fault. Too bad there are only a limited number of data points here.

This leads me to wonder: How many people are using xboard vs winboard? Also, how many are using xboard under Mac OS/X vs xboard under Linux? I must be in a small minority here as surely others would have reported these problems earlier.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: The modify-after-free bug

Post by hgm »

I have no real information on that, but I expect there to be about 10 times as many WinBoard users than XBoard users. Also about 10 times as many PC as Mac users. But it also matters a lot what they are using XBoard for. Not many people run ICS bots, and it could very well be that the problem only occurs when you run with a certain option that almost no one uses.

But however bleak the testing situation might be, the key to getting it repared is to have the xboard.debug file, to see what event triggers it. Without that we will remain completely in the dark.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: The modify-after-free bug

Post by sje »

Perhaps these bugs would be easier to re-create under Windows if it were possible to substitute a super-paranoid memory allocation library for the standard malloc/free code.
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: The modify-after-free bug

Post by hgm »

Indeed, I should replace the malloc/free funtions with my own wrappers. Iconsidered that anyway, because it seemed on my XP laptop that the free header lines in the game list was not working, causing a huge memory leak when loading big (40k games) PGN files. The code seemed OK, though.Just malloc and an accompanying free. But when I quoted those out and used a static array, the leak disappeared...
jwes
Posts: 778
Joined: Sat Jul 01, 2006 7:11 am

Re: The modify-after-free bug

Post by jwes »

sje wrote:Perhaps these bugs would be easier to re-create under Windows if it were possible to substitute a super-paranoid memory allocation library for the standard malloc/free code.
MSVC has tools that work pretty well for finding memory leaks. See http://msdn.microsoft.com/en-us/library ... 00%29.aspx
User avatar
hgm
Posts: 28454
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: The modify-after-free bug

Post by hgm »

Yes, but note that this memory leak is no fault of the program. The free call is there. It just doesn't seem to work (based on how I see the memory footprint expand in the task manager).
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: The modify-after-free bug

Post by sje »

hgm wrote:Yes, but note that this memory leak is no fault of the program. The free call is there. It just doesn't seem to work (based on how I see the memory footprint expand in the task manager).
It could be that the Windows runtime is trying to "help" you by doing lazy deallocation. Maybe there is a Windows addition to the C library: instead of using free(), you need to use free_it_right_now_or_else().

Seriously, have you considered getting a used, older Macintosh with Mac OS/X installed? I've got a iMac PowerPC G3 that's eleven years old and runs OS/X 10.4.11 with the whole development toolchain and X Windows. Machines like this can be had for under US$25 here in the States. Using a machine with a different CPU family and a different Unix to assist with testing can save enough time to easily repay the purchase price.