In an earlier post, I mentioned Blunder was crashing due to an unknown bug.

Well I’ve found out what the bug was, thanks to putting logging in Blunder and letting Ed run that version of Blunder. Ed shared the following log output with me:

2021/12/16 11:08:54 command ["setoption name Hash value 64\n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name UseBook value false\n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name BookPath value \n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name BookMoveDelay value 2\n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name MiddleGameContempt value 25\n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name EndGameContempt value 0\n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name Log value true\n"] was sent to the engine

2021/12/16 11:08:55 command ["isready\n"] was sent to the engine

2021/12/16 11:08:55 command ["isready\n"] was sent to the engine

2021/12/16 11:08:55 command ["setoption name MultiPV value 1\n"] was sent to the engine

2021/12/16 11:08:55 command ["position fen r4rk1/pppnbppp/8/3P4/2PP2b1/P3KN2/1P2B1PP/RN5R w - - 1 1 moves\n"] was sent to the engine

2021/12/16 11:08:55 The engine encountered the following fatal error during execution: runtime error: index out of range [252] with length 64
 goroutine 1 [running]:
runtime/debug.Stack()
	C:/Program Files/Go/src/runtime/debug/stack.go:24 +0x65
blunder/logging.(*_Logger).LogFatal(0xe700, {0x81afc0, 0xc0000140a8}, {0x84, 0x0}, {0xc000174180, 0x178})
	C:/Users/deanm/Desktop/blunder/logging/logging.go:36 +0x3f
blunder/engine.(*UCIInterface).positionCommandResponse.func1()
	C:/Users/deanm/Desktop/blunder/engine/uci.go:71 +0x165
panic({0x81afc0, 0xc0000140a8})
	C:/Program Files/Go/src/runtime/panic.go:1038 +0x215
blunder/engine.MoveFromCoord(0xc000136406, {0xc000136406, 0x7})
	C:/Users/deanm/Desktop/blunder/engine/move.go:100 +0x1db
blunder/engine.(*UCIInterface).positionCommandResponse(0xc000234000, {0xc0001363c0, 0x4c})
	C:/Users/deanm/Desktop/blunder/engine/uci.go:97 +0x411
blunder/engine.(*UCIInterface).UCILoop(0xc000234000)
	C:/Users/deanm/Desktop/blunder/engine/uci.go:335 +0x610
blunder/engine.RunCommLoop()
	C:/Users/deanm/Desktop/blunder/engine/comm.go:124 +0x6d4
main.main()
	C:/Users/deanm/Desktop/blunder/blunder/main.go:6 +0x17

2021/12/16 11:08:55 The fatal error occured in the following position: 
8 | r . . . . r k . 
7 | i i i n b i i i 
6 | . . . . . . . . 
5 | . . . I . . . . 
4 | . . I I . . b . 
3 | I . . . K N . . 
2 | . I . . B . I I 
1 | R N . . . . . R 
   ----------------
    a b c d e f g h 

turn: white
castling rights: 
en passant: none
fen: r4rk1/pppnbppp/8/3P4/2PP2b1/P3KN2/1P2B1PP/RN5R w - - 1 1
zobrist hash: 0xabcf9ff4b9c74143
rule 50: 1
game ply: 2

2021/12/16 11:08:55 The engine encountered the following fatal error during execution: runtime error: index out of range [252] with length 64
 goroutine 1 [running]:
runtime/debug.Stack()
	C:/Program Files/Go/src/runtime/debug/stack.go:24 +0x65
blunder/logging.(*_Logger).LogFatal(0xe700, {0x81afc0, 0xc0000140a8}, {0x84, 0x0}, {0xc000174480, 0x178})
	C:/Users/deanm/Desktop/blunder/logging/logging.go:36 +0x3f
blunder/engine.(*UCIInterface).UCILoop.func1()
	C:/Users/deanm/Desktop/blunder/engine/uci.go:299 +0x165
panic({0x81afc0, 0xc0000140a8})
	C:/Program Files/Go/src/runtime/panic.go:1038 +0x215
blunder/engine.(*UCIInterface).positionCommandResponse.func1()
	C:/Users/deanm/Desktop/blunder/engine/uci.go:73 +0x72
panic({0x81afc0, 0xc0000140a8})
	C:/Program Files/Go/src/runtime/panic.go:1038 +0x215
blunder/engine.MoveFromCoord(0xc000136406, {0xc000136406, 0x7})
	C:/Users/deanm/Desktop/blunder/engine/move.go:100 +0x1db
blunder/engine.(*UCIInterface).positionCommandResponse(0xc000234000, {0xc0001363c0, 0x4c})
	C:/Users/deanm/Desktop/blunder/engine/uci.go:97 +0x411
blunder/engine.(*UCIInterface).UCILoop(0xc000234000)
	C:/Users/deanm/Desktop/blunder/engine/uci.go:335 +0x610
blunder/engine.RunCommLoop()
	C:/Users/deanm/Desktop/blunder/engine/comm.go:124 +0x6d4
main.main()
	C:/Users/deanm/Desktop/blunder/blunder/main.go:6 +0x17

2021/12/16 11:08:55 The fatal error occured in the following position: 
8 | r . . . . r k . 
7 | i i i n b i i i 
6 | . . . . . . . . 
5 | . . . I . . . . 
4 | . . I I . . b . 
3 | I . . . K N . . 
2 | . I . . B . I I 
1 | R N . . . . . R 
   ----------------
    a b c d e f g h 

turn: white
castling rights: 
en passant: none
fen: r4rk1/pppnbppp/8/3P4/2PP2b1/P3KN2/1P2B1PP/RN5R w - - 1 1
zobrist hash: 0xabcf9ff4b9c74143
rule 50: 1
game ply: 2

The whole error looks pretty complicated at first glance, but I quickly realized from the above about, Blunder crashed because the client sent the command position fen r4rk1/pppnbppp/8/3P4/2PP2b1/P3KN2/1P2B1PP/RN5R w - - 1 1 moves. At first glance this command looks like a pretty normal UCI command, but the issue is that after the moves keyword was sent, Blunder expected a list of moves to follow, but none were given.

This seems like a pretty reasonable assumpation, but apparently some clients don’t follow this “rule”, and the fix was very easy, so I went ahead and made sure Blunder wouldn’t crash because of this issue. And so far no further bugs have been reported. So strength development can continue! This whole experience has reminded me how important logging is in diagonsis and issue and keep tabs on a complicated system.


<
Previous Post
Blunder 7.5.0 Released
>
Next Post
Progress Report