Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by maksimKorzh »

Hi guys!

I'm debugging my own engine in the arena GUI. It plays itself until reaches certain position
[d]3r4/8/5kp1/p2p4/2r5/2P2R2/P6P/3R3K b - - 0 38
and then I'm getting this error:

Code: Select all

2020-08-05 21:20:46,444-->1:position startpos moves d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 b1c3 f8d6 f1b5 b8c6 g2g4 f5g6 g1f3 d6f4 e3f4 a7a6 b5c6 b7c6 f3e5 g8e7 e1g1 e8g8 f1e1 d8d6 a1c1 c6c5 d4c5 d6d8 c5c6 d8d6 e5g6 h7g6 d1d2 a8b8 c1b1 e7c6 g4g5 b8b4 c3e2 e6e5 f4e5 b4g4 e2g3 c6e5 d2e2 f7f6 g5f6 g7f6 e2e3 c7c5 b1a1 g4b4 a1b1 f8d8 c2c3 b4h4 f2f3 d6b6 b2b4 h4c4 b1d1 a6a5 b4c5 b6c5 e3c5 c4c5 e1e3 c5c4 g3e4 e5f3 g1h1 g8g7 e4f6 g7f6
2020-08-05 21:20:46,444-->1:go depth 4
2020-08-05 21:20:46,462<--1:calculating...
2020-08-05 21:20:46,463<--1:score: 20info score cp 20 depth 4 nodes 3346123 pv d2d4
2020-08-05 21:20:46,466<--1:bestmove  e3f3
2020-08-05 21:20:46,466*1*Found move:Re3xf3
2020-08-05 21:20:46,752**New move before message, game, Game: 0 Move: 75
2020-08-05 21:20:46,762**New move after message, game 0, should be: 0 engine to move:1
2020-08-05 21:20:46,769*1*Start calc, move no: 75
2020-08-05 21:20:46,770-->1:position startpos moves d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 b1c3 f8d6 f1b5 b8c6 g2g4 f5g6 g1f3 d6f4 e3f4 a7a6 b5c6 b7c6 f3e5 g8e7 e1g1 e8g8 f1e1 d8d6 a1c1 c6c5 d4c5 d6d8 c5c6 d8d6 e5g6 h7g6 d1d2 a8b8 c1b1 e7c6 g4g5 b8b4 c3e2 e6e5 f4e5 b4g4 e2g3 c6e5 d2e2 f7f6 g5f6 g7f6 e2e3 c7c5 b1a1 g4b4 a1b1 f8d8 c2c3 b4h4 f2f3 d6b6 b2b4 h4c4 b1d1 a6a5 b4c5 b6c5 e3c5 c4c5 e1e3 c5c4 g3e4 e5f3 g1h1 g8g7 e4f6 g7f6 e3f3
2020-08-05 21:20:46,770-->1:go depth 4
2020-08-05 21:20:46,997<--1:BytesRead > 0
2020-08-05 21:20:46,999<--1:-- LiesThread.Execute terminated --
If I restart Arena and ask engine to start playing from this position it works fine.

QUESTION1: is it arena bug or my engine bug? Please give me a clue how to track it.
QUESTION2: any arena alternatives for debugging UCI protocol?

Thanks in advance!
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by Ras »

I think your engine has a bug. After the first "position" command, d2d4 in the PV is not even a legal move because there is no piece on d2. The "bytes read" error seems to come from your engine, so you need to check when this can happen.

Maybe your read buffer is too small for the position command?
Rasmus Althoff
https://www.ct800.net
Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by Pio »

maksimKorzh wrote: Wed Aug 05, 2020 8:28 pm Hi guys!

I'm debugging my own engine in the arena GUI. It plays itself until reaches certain position
[d]3r4/8/5kp1/p2p4/2r5/2P2R2/P6P/3R3K b - - 0 38
and then I'm getting this error:

Code: Select all

2020-08-05 21:20:46,444-->1:position startpos moves d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 b1c3 f8d6 f1b5 b8c6 g2g4 f5g6 g1f3 d6f4 e3f4 a7a6 b5c6 b7c6 f3e5 g8e7 e1g1 e8g8 f1e1 d8d6 a1c1 c6c5 d4c5 d6d8 c5c6 d8d6 e5g6 h7g6 d1d2 a8b8 c1b1 e7c6 g4g5 b8b4 c3e2 e6e5 f4e5 b4g4 e2g3 c6e5 d2e2 f7f6 g5f6 g7f6 e2e3 c7c5 b1a1 g4b4 a1b1 f8d8 c2c3 b4h4 f2f3 d6b6 b2b4 h4c4 b1d1 a6a5 b4c5 b6c5 e3c5 c4c5 e1e3 c5c4 g3e4 e5f3 g1h1 g8g7 e4f6 g7f6
2020-08-05 21:20:46,444-->1:go depth 4
2020-08-05 21:20:46,462<--1:calculating...
2020-08-05 21:20:46,463<--1:score: 20info score cp 20 depth 4 nodes 3346123 pv d2d4
2020-08-05 21:20:46,466<--1:bestmove  e3f3
2020-08-05 21:20:46,466*1*Found move:Re3xf3
2020-08-05 21:20:46,752**New move before message, game, Game: 0 Move: 75
2020-08-05 21:20:46,762**New move after message, game 0, should be: 0 engine to move:1
2020-08-05 21:20:46,769*1*Start calc, move no: 75
2020-08-05 21:20:46,770-->1:position startpos moves d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 b1c3 f8d6 f1b5 b8c6 g2g4 f5g6 g1f3 d6f4 e3f4 a7a6 b5c6 b7c6 f3e5 g8e7 e1g1 e8g8 f1e1 d8d6 a1c1 c6c5 d4c5 d6d8 c5c6 d8d6 e5g6 h7g6 d1d2 a8b8 c1b1 e7c6 g4g5 b8b4 c3e2 e6e5 f4e5 b4g4 e2g3 c6e5 d2e2 f7f6 g5f6 g7f6 e2e3 c7c5 b1a1 g4b4 a1b1 f8d8 c2c3 b4h4 f2f3 d6b6 b2b4 h4c4 b1d1 a6a5 b4c5 b6c5 e3c5 c4c5 e1e3 c5c4 g3e4 e5f3 g1h1 g8g7 e4f6 g7f6 e3f3
2020-08-05 21:20:46,770-->1:go depth 4
2020-08-05 21:20:46,997<--1:BytesRead > 0
2020-08-05 21:20:46,999<--1:-- LiesThread.Execute terminated --
If I restart Arena and ask engine to start playing from this position it works fine.

QUESTION1: is it arena bug or my engine bug? Please give me a clue how to track it.
QUESTION2: any arena alternatives for debugging UCI protocol?

Thanks in advance!
I am just guessing but I guess your engine evaluates the position from wrong colour to move. I guess your engine thinks it is the checking side to move and that causes the problem (since it never happens in real games because you have already mated before that).
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by maksimKorzh »

Ras wrote: Wed Aug 05, 2020 10:56 pm I think your engine has a bug. After the first "position" command, d2d4 in the PV is not even a legal move because there is no piece on d2. The "bytes read" error seems to come from your engine, so you need to check when this can happen.

Maybe your read buffer is too small for the position command?
Hi Ras

Thanks for your reply. I tried to double the buffer size but it didn't work.

re: PV
- I've just removed the iterative deepening so the negamax search function is called directly. For some reason if the iterative deepening is enabled it crashes already in the opening after the first check to the black king.

I'll try to run it playing vs itself in the console to see what's happening.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by maksimKorzh »

Pio wrote: Thu Aug 06, 2020 1:10 am
maksimKorzh wrote: Wed Aug 05, 2020 8:28 pm Hi guys!

I'm debugging my own engine in the arena GUI. It plays itself until reaches certain position
[d]3r4/8/5kp1/p2p4/2r5/2P2R2/P6P/3R3K b - - 0 38
and then I'm getting this error:

Code: Select all

2020-08-05 21:20:46,444-->1:position startpos moves d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 b1c3 f8d6 f1b5 b8c6 g2g4 f5g6 g1f3 d6f4 e3f4 a7a6 b5c6 b7c6 f3e5 g8e7 e1g1 e8g8 f1e1 d8d6 a1c1 c6c5 d4c5 d6d8 c5c6 d8d6 e5g6 h7g6 d1d2 a8b8 c1b1 e7c6 g4g5 b8b4 c3e2 e6e5 f4e5 b4g4 e2g3 c6e5 d2e2 f7f6 g5f6 g7f6 e2e3 c7c5 b1a1 g4b4 a1b1 f8d8 c2c3 b4h4 f2f3 d6b6 b2b4 h4c4 b1d1 a6a5 b4c5 b6c5 e3c5 c4c5 e1e3 c5c4 g3e4 e5f3 g1h1 g8g7 e4f6 g7f6
2020-08-05 21:20:46,444-->1:go depth 4
2020-08-05 21:20:46,462<--1:calculating...
2020-08-05 21:20:46,463<--1:score: 20info score cp 20 depth 4 nodes 3346123 pv d2d4
2020-08-05 21:20:46,466<--1:bestmove  e3f3
2020-08-05 21:20:46,466*1*Found move:Re3xf3
2020-08-05 21:20:46,752**New move before message, game, Game: 0 Move: 75
2020-08-05 21:20:46,762**New move after message, game 0, should be: 0 engine to move:1
2020-08-05 21:20:46,769*1*Start calc, move no: 75
2020-08-05 21:20:46,770-->1:position startpos moves d2d4 d7d5 c1f4 c8f5 e2e3 e7e6 b1c3 f8d6 f1b5 b8c6 g2g4 f5g6 g1f3 d6f4 e3f4 a7a6 b5c6 b7c6 f3e5 g8e7 e1g1 e8g8 f1e1 d8d6 a1c1 c6c5 d4c5 d6d8 c5c6 d8d6 e5g6 h7g6 d1d2 a8b8 c1b1 e7c6 g4g5 b8b4 c3e2 e6e5 f4e5 b4g4 e2g3 c6e5 d2e2 f7f6 g5f6 g7f6 e2e3 c7c5 b1a1 g4b4 a1b1 f8d8 c2c3 b4h4 f2f3 d6b6 b2b4 h4c4 b1d1 a6a5 b4c5 b6c5 e3c5 c4c5 e1e3 c5c4 g3e4 e5f3 g1h1 g8g7 e4f6 g7f6 e3f3
2020-08-05 21:20:46,770-->1:go depth 4
2020-08-05 21:20:46,997<--1:BytesRead > 0
2020-08-05 21:20:46,999<--1:-- LiesThread.Execute terminated --
If I restart Arena and ask engine to start playing from this position it works fine.

QUESTION1: is it arena bug or my engine bug? Please give me a clue how to track it.
QUESTION2: any arena alternatives for debugging UCI protocol?

Thanks in advance!
I am just guessing but I guess your engine evaluates the position from wrong colour to move. I guess your engine thinks it is the checking side to move and that causes the problem (since it never happens in real games because you have already mated before that).
Thanks for a hint, Pio, I'll check that out.
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by maksimKorzh »

Guys, I'm sorry for bothering you - the problem was in my engine - it just crashes... (segmentation fault)

Code: Select all

  8  ♜  ♞  .  ♛  ♚  .  ♞  ♜                        
  7  ♟  ♟  ♟  .  .  ♟  ♟  ♟                        
  6  .  .  .  ♝  ♟  .  .  .                        
  5  .  ♗  .  ♟  .  ♝  .  .                        
  4  .  .  .  ♙  .  ♗  .  .                        
  3  .  .  ♘  .  ♙  .  .  .                        
  2  ♙  ♙  ♙  .  .  ♙  ♙  ♙                        
  1  ♖  .  .  ♕  ♔  .  ♘  ♖                        

     a  b  c  d  e  f  g  h

     Side:            black
     EnPassant:          no
     Castling:         KQkq


go depth 4
info score cp -15 depth 1 nodes 291598 pv d2d4 d7d5 c1f4 c8f5
info score cp 5 depth 2 nodes 293389 pv d2d4 d7d5 c1f4 c8f5
Segmentation fault (core dumped)
So I guess the error in the title of this post simply means like: "you engine has crashed"
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by Ras »

maksimKorzh wrote: Thu Aug 06, 2020 10:45 am Guys, I'm sorry for bothering you - the problem was in my engine - it just crashes... (segmentation fault)
Here's how you can easily debug a segfault using GDB: http://www.unknownroad.com/rtfm/gdbtut/gdbsegfault.html
Rasmus Althoff
https://www.ct800.net
User avatar
maksimKorzh
Posts: 771
Joined: Sat Sep 08, 2018 5:37 pm
Location: Ukraine
Full name: Maksim Korzh

Re: Arena chess error: BytesRead > 0 | LiesThread.Execute terminated

Post by maksimKorzh »

Ras wrote: Thu Aug 06, 2020 12:52 pm
maksimKorzh wrote: Thu Aug 06, 2020 10:45 am Guys, I'm sorry for bothering you - the problem was in my engine - it just crashes... (segmentation fault)
Here's how you can easily debug a segfault using GDB: http://www.unknownroad.com/rtfm/gdbtut/gdbsegfault.html
Obviously GDB))) Thanks for help. You know sometimes you just need a support to calm down and go for tracking the bugs))) Thank you guys!