daylen / stockfish-mac

Beautiful, powerful chess app for the Mac
http://stockfishchess.org/mac/
GNU General Public License v3.0
511 stars 116 forks source link

Fix freeze at startup #23

Closed knokknok closed 8 years ago

knokknok commented 8 years ago

On my iMac (late 2015), waitUntilExit never returns, causing the application to hang forever. Restricting the output of sysctl to the relevant fields seems to fix the issue.

daylen commented 8 years ago

Have you verified this hang in the App Store version of the app (version 2.0.2)? What version of OS X are you running, and can you specify what CPU you have? Please let me know if you think this requires a hotfix.

knokknok commented 8 years ago
knokknok commented 8 years ago

I think the problem is that, on my machine, the system pipe buffer size is 512 (I don't know why and whether it is the default for this model..), as reported by: yes produce_this_string_as_output | tee >(sleep 1) | wc -c (your value is probably 65536) So there is still some data to read when waitUntilExit is reached (because the output of /usr/sbin/sysctl -n machdep.cpu is larger than 512) and it goes in an infinite wait. This has further ramifications: when interpreting the "option name" info from the engine, the chunks of 512 bytes result in lines cut in the middle and the preferences are not interpreted correctly...

knokknok commented 8 years ago

So I just rebooted and I now have pipes with 64k buffers... and stockfish is behaving properly. I don't know what happened, sorry for the noise :-(

daylen commented 8 years ago

Hmm, alright. Let me know if it starts hanging again.