Winboard bug

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Winboard bug

Postby milix » 08 Feb 2005, 19:49

Hi all and sorry for the subject line but i am sure it is a bug!
Recently, we had a convertation in WBEC forum about problems that some engines experience under Winboard, namely time looses at move 1 because the engine did not start corectly. I did some tests because my engine suffers from this problem also and after all my attemps led to nothing usefull I put some Log lines in WB source code (4.2.6) and found that there is a thread sychronization problem in Winboard and when this occures the engine's process cannot output to its stdout because winboard had called the NonOvlInputThread() _before_ the AddInputSource() creates the is->hThread thread. Here are my logs:

The error occured (leads to time loss at move 1)
Code: Select all
recognized 'normal' (-1) as variant normal
WinBoard 4.2.6 + aice
Reset(1, 0) from gameMode 0
recognized 'normal' (-1) as variant normal
GameEnds(0, (null), 2)
StartChildProcess (dir="C:\devel\apps\aice") aice
MILIX: starting chess program: before addinputsource
MILIX: starting NonOvlReadFile
MILIX: in add input source: hThread is 00000074
547 >first : xboard
protover 2
10547 >first : new
random
Fatal Error: Error writing to first chess program:
The pipe is being closed.


Normal start
Code: Select all
recognized 'normal' (-1) as variant normal
WinBoard 4.2.6 + aice
Reset(1, 0) from gameMode 0
recognized 'normal' (-1) as variant normal
GameEnds(0, (null), 2)
StartChildProcess (dir="C:\devel\apps\aice") aice
MILIX: starting chess program: before addinputsource
MILIX: in add input source: hThread is 0000008C
547 >first : xboard
protover 2
MILIX: starting NonOvlReadFile
MILIX: starting NonOvlReadFile, thread is not null
MILIX: NonOvlReadFile::ReadFile called ok
562
562 >first : accepted done
Anastasios Milikas
milix
 
Posts: 54
Joined: 04 Nov 2004, 19:36
Location: Greece

Bug fix!

Postby milix » 10 Feb 2005, 17:54

The fix I made is not optimal but at least it is a fix!
So, in file winboard.c in function NonOvlInputThread(LPVOID arg)
just after the

Code: Select all
is = (InputSource *) arg;


line add the following:
Code: Select all
i=0;
while (is->hThread == NULL) {
  Sleep(50);
  i++;
  if (i > 10) break;
}


this will give the is->hThread process enough time to be initialized.
I test it, it works when the original version fails.
Anastasios Milikas
milix
 
Posts: 54
Joined: 04 Nov 2004, 19:36
Location: Greece


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 19 guests