sanderland / katrain

Improve your Baduk skills by training with KataGo!
Other
1.65k stars 229 forks source link

Clear cache option causing duplication of threads and crashing of the engine #252

Closed philbat closed 3 years ago

philbat commented 4 years ago

Hello, With debian and Python 3.7.7, after the game has started, I get quite often this error:

Traceback (most recent call last): File "/home/phil/.local/lib/python3.7/site-packages/katrain/core/engine.py", line 187, in _analysis_read_thread analysis = json.loads(line) File "/usr/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib/python3.7/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 20 (char 19)

and katago engine stops.

Best regards and thank you for this software.

sanderland commented 4 years ago

Are you using the built-in katago or your own? Any other output? It's wrapped in a try/except block, so I would expect the line, as in https://github.com/sanderland/katrain/blob/e4e140fed41a5bb626c695b2d557efb1806cc99e/katrain/core/engine.py#L222 as well as the engine to keep working

philbat commented 4 years ago

I have installed it with: pip3 install -U katrain and there in no other output.

sanderland commented 4 years ago

That is very very strange. Are you capable of running from a cloned repo?

philbat commented 4 years ago

well, git clone https://github.com/sanderland/katrain.git cd katrain pip3 install . and i run katrain, no error for now !

philbat commented 4 years ago

just finished a first game without error... but this error occurred at random..

sanderland commented 4 years ago

this is all very strange, let's keep an eye on it.

philbat commented 3 years ago

I attach an image: inside a clone repo and with python 3.8, I get the same error. capture. Regards

sanderland commented 3 years ago

That is bizarre. Could you set debug level=2 in general settings, and restart with python -m katrain > log.txt get this error and upload the log.txt?

philbat commented 3 years ago

Here is the log file. I started katrain with python3 -m katrain in my cloned repo. log.txt.gz

sanderland commented 3 years ago

Thanks @philbat this gets us somewhere. You are getting a partial line back, which is very strange. But the threads show there are two sets of engine threads competing for input, which should not be possible and is likely the problem.

philbat commented 3 years ago

I am running on the master branch and I think I get this error when I play a new game.

sanderland commented 3 years ago

Found the bug. It was related to the 'clear cache' box and not correctly saving the thread reference. Without this box checked, the error will not happen, and it's fixed in 1.7. Thanks for the logs and working with me on this!