Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: For engine authors, end-of-file on input

Author: Sune Fischer

Date: 04:09:04 04/14/04

Go up one level in this thread


On April 14, 2004 at 06:46:56, Sune Fischer wrote:

>On April 14, 2004 at 05:43:24, Fabien Letouzey wrote:
>
>>On April 14, 2004 at 05:31:33, Sune Fischer wrote:
>>
>>>On April 13, 2004 at 07:08:19, Fabien Letouzey wrote:
>>>
>>>>
>>>>Hello,
>>>>
>>>>I have a request for all engine authors.  Please let the engine quit
>>>>when end-of-file is read on input.  This applies to xboard, UCI and
>>>>even console engines.
>>>>
>>>>I know the engine is supposed to receive "quit" first in both xboard
>>>>and UCI, but the interface (whether graphical or not) might crash or
>>>>get killed or whatever.  If end-of-file is received, how are you going
>>>>to get new commands???
>>>>
>>>>I guess most engines use fgets() to read input, just test the return
>>>>value for NULL.  Technically is could be an error or end-of-file then,
>>>>you can use ferror() and feof() if you wish to distinguish.  If you
>>>>use read() or the like then 0 means EOF was reached.
>>
>>>Testing for NULL doesn't seem to work, it still hangs when the GUI crashes.
>>
>>Do you feel like investigating?
>>That suggests that the pipe is not closed even after the creator died?!
>>
>>I think we could learn something from understanding this.
>>E.g. launching PolyGlot in a console, then killing it using the task manager.
>>
>>It should work IMO, but my Windows knowledge is rather limited.
>
>I'm testing it with Arena which crashes on me in multipv mode.
>
>My guess that there is a problem with printing to stdout after the pipe has been
>closed.
>
>I record all communication to a log file and what I see is that the search stops
>between iterations, frenzee hangs at 0 cpu load, Arena pops up an access
>violation box and stops responding so I have to kill it with the task manager.
>
>Occasionally I get a few hundred runtime error boxes which nearly crashes the
>entire system, luckily these close themselves after a few seconds.
>
>I suspect frenzee is trying to print information to Arena which no longer
>recieves input. Who is crashing who here I don't know, but it would be nice if
>frenzee exitted after I kill Arena with the task manager.
>
>I will try some more experiments to see if I can figure out what is going on.
>
>-S.

My suspecion seems to be correct, I have located the hanging line, it is a
printf() call which never returns.

Any ideas how I solve that?

-S.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.