bagaturchess / Bagatur

Java Chess Engine (UCI compatible)
http://bagaturchess.github.io/Bagatur/
Eclipse Public License 2.0
72 stars 18 forks source link

v2.2g crashes in CuteChess with FEN (on Linux) #7

Closed tissatussa closed 3 years ago

tissatussa commented 3 years ago

hi, i execute your new v2.2g zip asset(s) but it crashes in CuteChess (v1.2.0) when a start FEN is set .. without FEN it plays OK .. this is with both Black and White .. i use the same CuteChess settings as my v2.2e.

what's wrong ? here's the full debug log until crashing :

<Amoeba v3.3.1(1): id name Amoeba 3.3.1.l64p-l
<Amoeba v3.3.1(1): id author Richard Delorme
<Amoeba v3.3.1(1): option name Ponder type check default false
<Amoeba v3.3.1(1): option name Hash type spin default 64 min 1 max 65536
<Amoeba v3.3.1(1): option name Clear Hash type button
<Amoeba v3.3.1(1): option name Threads type spin default 1 min 1 max 256
<Amoeba v3.3.1(1): option name Affinity type string default 0:0
<Amoeba v3.3.1(1): option name MultiPV type spin default 1 min 1 max 256
<Amoeba v3.3.1(1): option name UCI_AnalyseMode type check default false
<Amoeba v3.3.1(1): uciok
>Amoeba v3.3.1(1): setoption name Affinity value 0:0
>Amoeba v3.3.1(1): setoption name Hash value 64
>Amoeba v3.3.1(1): setoption name MultiPV value 1
>Amoeba v3.3.1(1): setoption name Threads value 1
>Amoeba v3.3.1(1): isready
<Amoeba v3.3.1(1): readyok
<Bagatur v2.2g(0): ***************************************************************************
<Bagatur v2.2g(0): * Copyright (C) 2005-2020 Krasimir I. Topchiyski (k_topchiyski@yahoo.com) *
<Bagatur v2.2g(0): *                                                                         *
<Bagatur v2.2g(0): * Welcome to Bagatur UCI engine, version 2.2g                              *
<Bagatur v2.2g(0): *                                                                         *
<Bagatur v2.2g(0): * For help, have a look at the UCI protocol definition at:                *
<Bagatur v2.2g(0): * http://wbec-ridderkerk.nl/html/UCIProtocol.html                         *
<Bagatur v2.2g(0): ***************************************************************************
<Bagatur v2.2g(0): >LOG StateManager: exec command 0 > 'uci'
<Bagatur v2.2g(0): id name Bagatur 2.2g
<Bagatur v2.2g(0): id author Krasimir Topchiyski, Bulgaria
<Bagatur v2.2g(0): option name Logging Policy type combo default none var single file var multiple files var none
<Bagatur v2.2g(0): option name OwnBook type check default true
<Bagatur v2.2g(0): option name Ponder type check default true
<Bagatur v2.2g(0): option name UCI_AnalyseMode type check default false
<Bagatur v2.2g(0): option name MultiPV type spin default 1 min 1 max 100
<Bagatur v2.2g(0): option name SyzygyPath type string default /home/tissatussa/Apps/ChessEngines/Bagatur/v2.2g/./data/egtb
<Bagatur v2.2g(0): option name Openning Mode type combo default most played first var most played first var random intermediate var random full
<Bagatur v2.2g(0): LOG StateManager: sendUCIOK called
<Bagatur v2.2g(0): uciok
>Bagatur v2.2g(0): setoption name Logging Policy value none
>Bagatur v2.2g(0): setoption name MultiPV value 1
>Bagatur v2.2g(0): setoption name Openning Mode value random intermediate
>Bagatur v2.2g(0): setoption name OwnBook value false
>Bagatur v2.2g(0): setoption name SyzygyPath value /home/tissatussa/Apps/ChessEngines/Bagatur/v2.2g/./data/egtb
>Bagatur v2.2g(0): isready
<Bagatur v2.2g(0): LOG StateManager: exec command 6 > 'setoption name Logging Policy value none'
<Bagatur v2.2g(0): LOG StateManager: Set-option called with line: setoption name Logging Policy value none
<Bagatur v2.2g(0): LOG StateManager: Set-option parsed: [logging policy->none]
<Bagatur v2.2g(0): LOG StateManager: exec command 6 > 'setoption name MultiPV value 1'
<Bagatur v2.2g(0): LOG StateManager: Set-option called with line: setoption name MultiPV value 1
<Bagatur v2.2g(0): LOG StateManager: Set-option parsed: [multipv->1]
<Bagatur v2.2g(0): LOG StateManager: exec command 6 > 'setoption name Openning Mode value random intermediate'
<Bagatur v2.2g(0): LOG StateManager: Set-option called with line: setoption name Openning Mode value random intermediate
<Bagatur v2.2g(0): LOG StateManager: Set-option parsed: [openning mode->random intermediate]
<Bagatur v2.2g(0): LOG StateManager: exec command 6 > 'setoption name OwnBook value false'
<Bagatur v2.2g(0): LOG StateManager: Set-option called with line: setoption name OwnBook value false
<Bagatur v2.2g(0): LOG StateManager: Set-option parsed: [ownbook->false]
<Bagatur v2.2g(0): LOG StateManager: exec command 6 > 'setoption name SyzygyPath value /home/tissatussa/Apps/ChessEngines/Bagatur/v2.2g/./data/egtb'
<Bagatur v2.2g(0): LOG StateManager: Set-option called with line: setoption name SyzygyPath value /home/tissatussa/Apps/ChessEngines/Bagatur/v2.2g/./data/egtb
<Bagatur v2.2g(0): LOG StateManager: Set-option parsed: [syzygypath->/home/tissatussa/apps/chessengines/bagatur/v2.2g/./data/egtb]
<Bagatur v2.2g(0): LOG StateManager: Destroing search adaptor ...
<Bagatur v2.2g(0): LOG StateManager: Search adaptor Destroyed.
<Bagatur v2.2g(0): LOG StateManager: exec command 1 > 'isready'
<Bagatur v2.2g(0): LOG StateManager: Creating search adaptor ...
<Bagatur v2.2g(0): Looking for libJSyzygy.so at location /home/tissatussa/Apps/ChessEngines/Bagatur/v2.2g/bin/libJSyzygy.so
<Bagatur v2.2g(0): libJSyzygy.so is now loaded
<Bagatur v2.2g(0): Loading syzygy tablebases from /home/tissatussa/apps/chessengines/bagatur/v2.2g/./data/egtb
<Bagatur v2.2g(0): Syzygy tablebases loaded
<Bagatur v2.2g(0): LOG StateManager: Search adaptor Created.
<Bagatur v2.2g(0): LOG StateManager: sendReadyOK called
<Bagatur v2.2g(0): readyok
>Bagatur v2.2g(0): ucinewgame
>Bagatur v2.2g(0): setoption name Ponder value true
>Bagatur v2.2g(0): position fen r1bqkbnr/pppp1pp1/2n4p/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 0 4
>Amoeba v3.3.1(1): ucinewgame
>Amoeba v3.3.1(1): setoption name Ponder value true
>Amoeba v3.3.1(1): position fen r1bqkbnr/pppp1pp1/2n4p/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 0 4
>Bagatur v2.2g(0): isready
<Bagatur v2.2g(0): LOG StateManager: exec command 2 > 'ucinewgame'
<Bagatur v2.2g(0): LOG StateManager: createNewGame called
<Bagatur v2.2g(0): LOG StateManager: exec command 6 > 'setoption name Ponder value true'
<Bagatur v2.2g(0): LOG StateManager: Set-option called with line: setoption name Ponder value true
<Bagatur v2.2g(0): LOG StateManager: Set-option parsed: [ponder->true]
<Bagatur v2.2g(0): LOG StateManager: exec command 3 > 'position fen r1bqkbnr/pppp1pp1/2n4p/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 0 4'
<Bagatur v2.2g(0): LOG StateManager: setupBoard called with position fen r1bqkbnr/pppp1pp1/2n4p/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 0 4
<Bagatur v2.2g(0): LOG 'r1bqkbnr/pppp1pp1/2n4p/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 0 4' -> moves=[]
<Bagatur v2.2g(0): LOG StateManager: Destroing search adaptor ...
<Bagatur v2.2g(0): LOG StateManager: Stoping old search adaptor ...
<Bagatur v2.2g(0): LOG UCISearchAdaptorImpl_Base: shutdown IRootSearch searchers ...
<Bagatur v2.2g(0): LOG UCISearchAdaptorImpl_Base: shutdown OK
<Bagatur v2.2g(0): LOG StateManager: Old search adaptor stopped.
<Bagatur v2.2g(0): LOG StateManager: Run gc ...
<Bagatur v2.2g(0): LOG StateManager: GC ok.
<Bagatur v2.2g(0): LOG StateManager: Search adaptor Destroyed.
<Bagatur v2.2g(0): LOG StateManager: exec command 1 > 'isready'
<Bagatur v2.2g(0): LOG StateManager: Creating search adaptor ...
<Bagatur v2.2g(0): Loading syzygy tablebases from /home/tissatussa/apps/chessengines/bagatur/v2.2g/./data/egtb
<Bagatur v2.2g(0): Syzygy tablebases loaded
<Bagatur v2.2g(0): LOG StateManager: Error: java.lang.reflect.InvocationTargetException
>Amoeba v3.3.1(1): isready
<Amoeba v3.3.1(1): readyok
bagaturchess commented 3 years ago

Hi and thanks for reporting the issue! I will investigate it on my setup and comment here ... Best regards, Krasimir

bagaturchess commented 3 years ago

Hi, I was not successful in preproducing the issue on my setup.

Could you please give me more details:

  1. Single core or SMP version of Bagatur?
  2. How you start the program?
  3. What are the memory settings if you use java -Xmx option?

It is under Linux, ok. ;-)

Best regards, Krasimir

bagaturchess commented 3 years ago

Hi,

meanwhile, you could try with the new version: https://github.com/bagaturchess/Bagatur/releases/tag/v2.2h This will help only if this error "java.lang.reflect.InvocationTargetException" corresponds to Out Of Memory error.

You could set "setoption name Logging Policy value multiple files" in order to get full logs of Bagatur. They will be generated in log sub-directory. You are currently using 'setoption name Logging Policy value none'

Best regards, Krasimir

tissatussa commented 3 years ago

i downloaded your v2.2h asset ZIP and tried it but still some error occurs in CuteChess .. it's even worse : v2.2h does not play without FEN either !? It crashes and CuteChess shows this little window :

Screenshot_2021-11-11_12-42-35

these are my settings in CuteChess .. they are the same as for v2.2g :

Screenshot_2021-11-11_12-48-48

Screenshot_2021-11-11_12-49-11

and here's the log : Bagatur_1636630901212.zip

Btw. you ask What are the memory settings if you use java -Xmx option? i don't understand -- i do not use java to run it (i mean i only use the .sh file).

MetatransApps commented 3 years ago

Thanks a lot for your prompt test and reply! This is what we see in the log:

  1. The java process is set in sh file to use 1024MB memory.
  2. It uses 75% of it, which is 768MB.
  3. Than it successfully creates the transposition table inside 512MB.
  4. Try to create evaluation cache in the rest of 256MB and fails with our of memmory ...

I have to think why this happens under linux and works well on windows. The Java Virtual Machine should work in the same way on both operating systems.

I will provide another version / fix for sure.

Could you please try something? I believe it is easy but will be very helpful as I don't have linux. Change this line in Bagatur_1core.sh file "export PROCESS_MEMORY=1024M" to "export PROCESS_MEMORY=2048M" and try again. This will increase the memory for the Java process from 1024MB to 2048MB. Best regards, Krasimir

tissatussa commented 3 years ago

changing to 2048M in the .sh file solved it ! now Bagatur v2.2h plays OK in CuteChess with and without start FEN ! [ i did not try this change in v2.2g yet, but i guess the result is the same ]

tissatussa commented 3 years ago

it's a pitty : Bagatur v2.2h lost its first game .. reason : "connection stalls" !? Here's the log : Bagatur_1636645857638.zip

bagatur_connection_stalls

bagaturchess commented 3 years ago

Yes, it should work in the same way with 2.2.g. Now the bug is fixed: the size of evaluation caches was 2 times bigger than it has to be, multiplied two times by 2 instead of only once. :-) https://github.com/bagaturchess/Bagatur/releases/tag/v2.2i This release must work without any changes. Looking forward to your feedback ... Best regards, Krasimir

tissatussa commented 3 years ago

OK, i will try v2.2i .. does it solve the "connection stalls" error also ?

bagaturchess commented 3 years ago

Ok, Bagatur was +254 CP and crashes, nice. :-) I hope so it is also fixed: it is again OutOfMemory issue, which appears after some time. Please let me know what is the result ... I want to be sure that it works correctly now or if necessary to release new version. Best regards, Krasimir

tissatussa commented 3 years ago

OK .. it's late here (i'm in Holland) .. tomorrow i will test v2.2i and let Bagatur play games in CuteChess .. 'till later !

bagaturchess commented 3 years ago

Hi, and good morning! ;-) I have removed all temporal versions (released today 11.11.2021) and finally released Bagatur 2.3 https://github.com/bagaturchess/Bagatur/releases/tag/v2.3 With version 2.3, the memory settings should working quite well. Best regards, Krasimir

tissatussa commented 3 years ago

hi, today i downloaded your new v2.3 (i must use the asset because i can not compile with Eclipse) and let it play some games in CuteChess : all went OK ! After 3 games, with / without start FEN, playing White / Black, the v2.3 did not crash or freeze or disconnect ! [ i have some questions though -- i will open a new Issue for that ]

bagaturchess commented 3 years ago

Ok, thanks for the feedback! Best regards, Krasimir

bagaturchess commented 3 years ago

Hi, does this issue need to be still open? :-) Best regards, Krasimir

tissatussa commented 3 years ago

you can close this issue because v2.3 plays well, with or without starting FEN, with White and Black.