Open sderr opened 3 years ago
Thank you for the detailled bug report. I'm a bit reluctant to using poll/select in the worker threads though, as this would create further complexity. But I don't have an alternative solution at this point. Will think about it. Now really a high priority bug to fix, because DIE() is fatal anwyay, and the OS cleans up our mess anyway ;-)
Yes, I understand, indeed if it was a simple fix I would have sent a pull request rather than an issue.
Regarding the priority of this bug however, I think it would be nice to be able to treat that engine failure as a single defeat rather than aborting the whole tournament.
I looked into poll, but it's impractical because:
Perhaps this is really the way to do it. But for a simple project like c-chess-cli, it seems overkill.
Hi, I got a an abort in free():
With in the main thread:
Looks like there's a race when worker_destroy() is called while the worker thread is still running. w->log was set to NULL while it was still being used. This happens on DIE() as we don't pthread_join() the workers.
I think the proper way to fix this would be to implement (using poll/select or whatever) a version of engine_readln() that checks the deadline of the current thread, instead of checking the deadlines in the main thread.