Problem with xboard

Discussion of chess software programming and technical issues.

Moderator: Ras

mathmoi
Posts: 290
Joined: Mon Mar 13, 2006 5:23 pm
Location: Québec
Full name: Mathieu Pagé

Problem with xboard

Post by mathmoi »

Hi, I'm trying to interface my new engine with winboard and I get a weird problem that I can't find how to fix.

The hand shaking seems to go well (except the myname feature is not accpted by xboard). My engine receive a first move, then start thinking and send "move e5" to xboard. At this point xboard start complaining and kill my engine :

Code: Select all

28193 <first : move e5
Undoing extra move from first, gameMode 2
Interrupting first
28193 >first : undo
xboard: Error: first chess program (/home/mathmoi/Desktop/MatMoiVII/optimized/src/matmoivii --xboard=1) exited unexpectedly
I can't find what's wrong. I manually entered the commands in my engine and it does not exit unexpectedly after making it's move. Also the line "Interrupting first" from the debug output seems to indicate that xboard kills my engine on purpose.

Here is the complete output :

Code: Select all

recognized 'normal' (-1) as variant normal
resolved -*-helvetica-bold-r-normal--*-*-*-*-*-*-*-* at pixel size 34
  to -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-1
resolved -*-helvetica-bold-r-normal--*-*-*-*-*-*-*-* at pixel size 14
  to -adobe-helvetica-bold-r-normal--14-100-100-100-p-82-iso8859-1
resolved -*-helvetica-medium-r-normal--*-*-*-*-*-*-*-* at pixel size 14
  to -adobe-helvetica-medium-r-normal--14-100-100-100-p-76-iso8859-1
xboard 4.2.7 + matmoivii
Reset(1, 0) from gameMode 0
recognized 'normal' (-1) as variant normal
GameEnds(0, (null), 2)
StartChildProcess (dir="") /home/mathmoi/Desktop/MatMoiVII/optimized/src/matmoivii --xboard=1
705 >first : xboard
protover 2
743 <first feature myname="MatMoi VII"
743 <first : feature ping=1 san=1 usermove=1 time=1 name=1
743 >first : accepted ping
743 >first : accepted san
743 >first : accepted usermove
743 >first : accepted time
743 >first : accepted name
743 <first : feature done=1
743 >first : accepted done
744 >first : new
random
744 >first : level 40 5 0
744 >first : hard
744 >first : ping 1
745 <first :Error (Unknown command): accepted
745 <first :Error (Unknown command): accepted
745 <first :Error (Unknown command): accepted
745 <first :Error (Unknown command): accepted
745 <first :Error (Unknown command): accepted
745 <first :Error (Unknown command): accepted
745 <first Error (Unknown command): random
745 <first Error (Unknown command): hard
745 <first :pong 1
27266 >first : name mathmoi
27268 >first : time 30000
otim 30000
27268 >first : usermove 27268 >first : e3
27278 <first :Error (Unknown command): name
27278 <first Error (Unknown command): otim
27278 <first :1 -18 0.0426 1 a5 
27278 <first : 1 -14 0.0528 1 b5 
27278 <first : 1 4 0.0606 1 d5 
27278 <first : 1 4 0.0781 1 d5 
27278 <first : 2 -22 0.0952 1 d5 d4 
27278 <first : 2 -22 0.1322 1 d5 d4 
27278 <first : 3 4 0.1764 1 d5 d4 e5 
27278 <first : 3 5 0.2822 1 e5 Nc3 d5 
27278 <first : 3 5 0.6458 1 e5 Nc3 d5 
27295 <first : 4 -92 1.5547 1 e5 Bc4 Nc6 Bxf7+ 
27384 <first :4 -92 11.5738 1 e5 Bc4 Nc6 Bxf7+ 
27601 <first : 5 85 33.301 1 e5 Qg4 Qf6 Nc3 
28193 <first : 5 85 92.4934 1 e5 Qg4 Qf6 Nc3 
28193 <first : move e5
Undoing extra move from first, gameMode 2
Interrupting first
28193 >first : undo
xboard: Error: first chess program (/home/mathmoi/Desktop/MatMoiVII/optimized/src/matmoivii --xboard=1) exited unexpectedly
GameEnds(0, (null), 2)
28197 >first : force
xboard: Error writing to first chess program: Broken pipe
28200 >first : ping 2
xboard: Error writing to first chess program: Broken pipe
GameEnds(0, (null), 2)
58115 >first : quit
mathmoi
Posts: 290
Joined: Mon Mar 13, 2006 5:23 pm
Location: Québec
Full name: Mathieu Pagé

Re: Problem with xboard

Post by mathmoi »

Hi

I solved my problem.

xboard was sending SIGINT to my engine that was not liking it so it was crashing. I disabled it with the feature command.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Problem with xboard

Post by bob »

You are sending crap that xboard does not understand, you need to eliminate any xboard complaints before you continue. You don't send "accepted anything" to xboard. It sends it to you. You can't send lots of junk without occasionally sending something that turns out to be reasonable, even if not correct. So get rid of _all_ xboard complaints and your problem will likely go away.
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: Problem with xboard

Post by Zach Wegner »

The error message that Xboard is generating shows that it isn't expecting your engine to move. But, it's supposed to. I think this is because of the error messages your program is generating: "Error (unknown command):". Because two of these are sent after the usermove, it's possible that xboard doesn't think your engine accepted the move. So, firstly, set feature name=0, and it won't send the name command, and then make your engine either handle or ignore the random, hard, accepted, and otim commands.
mathmoi
Posts: 290
Joined: Mon Mar 13, 2006 5:23 pm
Location: Québec
Full name: Mathieu Pagé

Re: Problem with xboard

Post by mathmoi »

I'm sorry, but I think you misread the log. I'm _not_ sending accepted (or anything else Winboard is not expecting). Actually it's my engine that is not understanding the "accepted" commands sent to him by Winboard. So until I code that part of the protocol it's sending "Error (Unknown command): accepted".

But thanks for the reply anyway.
mathmoi
Posts: 290
Joined: Mon Mar 13, 2006 5:23 pm
Location: Québec
Full name: Mathieu Pagé

Re: Problem with xboard

Post by mathmoi »

Hi Zach,

As I said in an erlier post I solved my problem, but I'll follow your advice anyway and try to handle or ignoring anything that is sent at me.

Thanks for the post.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problem with xboard

Post by Sven »

Hi Mathieu,

I know that your original problem is solved (SIGINT) but looking at the log I expect more problems. Is it possible that you still have input buffering switched on? This would be a possible explaination for this part of the log:

Code: Select all

27266 >first : name mathmoi
27268 >first : time 30000
otim 30000
27268 >first : usermove 27268 >first : e3
27278 <first :Error (Unknown command): name
27278 <first Error (Unknown command): otim
You react on the "name" and "otim" (and inbetween also "time") commands with a delay, while in the meantime also "usermove" has been sent. Switching off input buffering might solve this (e.g. "setbuf(stdin, NULL);" when using C stdio, or something similar for plain C++).

Sven
mathmoi
Posts: 290
Joined: Mon Mar 13, 2006 5:23 pm
Location: Québec
Full name: Mathieu Pagé

Re: Problem with xboard

Post by mathmoi »

hi Sven,

I'm not sure I understand why I need to do this, but I now added the following line that is making cin unbuffered.

Code: Select all

cin.rdbuf()->pubsetbuf(0, 0);
Thanks for your help.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problem with xboard

Post by Sven »

Hi Mathieu,

sorry for having confused you a little bit ... I was not completely right in stating that input buffering may be responsible for that particular part of the log. Of course, according to http://www.tim-mann.org/xboard/engine-intf.html#6, _output_ buffering should be disabled but _input_ buffering causes trouble mostly when an engine is polling for input during search, e.g. when pondering. So at least in the init phase, like in your case, it should not yet be a problem, despite my previous post.

You sent "feature name=1" but later on "Error (Unknown command): name", was this intended?

Sven
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Problem with xboard

Post by Sven »

Sven Schüle wrote:You react on the "name" and "otim" (and inbetween also "time") commands with a delay, while in the meantime also "usermove" has been sent. Switching off input buffering might solve this
Sorry for this wrong statement which is really nonsense :oops:
Sven