[Fixed!] (Golang) Mysterious timeout errors (ah how i've missed you)


this is driving me insane (but after all, isn’t that the point of halite!) and i’m hoping cooler/wiser heads can help.

My bots are suffering mysterious timeout errors.

  • For example, game 2988227[ ed: corrected game number although issue is fixed so no further sleuthing needed] (new user so I can’t upload yet), the error log says
    Turn 464
    error: timed out after 2000 ms (when reading string)
    Last input received was:

  • Analysing my timeouts via mlombs excellent analytics site https://halite2018.mlomb.me/ (thank you @Hilko !) shows that i timeout only on 64x64 maps, mid-game

  • I’m sure it isn’t slow code in the game loop. Locally, everything runs very fast. I’m using simple potential-fields, the same as my post in halite2 last year. So nothing too heavy.

  • Locally replaying the exact game using @fohristiwhirl 's excellent replay.py script
    has turn 464 taking just 18 ms locally. My bot is deterministic, so no differences , building and transmitting the command queue works fine locally for turn 464

  • I’m using the golang starter kit, with logging turned off. The error seems to imply (?) the engine is not receiving input from my bot?

Has anyone experienced /solved this? Mods, is there a way to get a more detailed log from the server?

many thanks!

edit: formatting, i acccidentally a *


This is solved!

fix: change the EndTurn to use a buffer rather than a string.

func (g *Game) EndTurn(commands []Command) {
	var buffer bytes.Buffer

	for _, command := range commands {
		buffer.WriteString(" ")


Are you sure about this number?

You also seem to timeout on a 32x32 at the beginning …


Indeed - corrected the number , it was 2988227

Thanks for spotting that other timeout - the 32x32 was an actual error this time :slight_smile:

Edited the subject to reflect fixed


Would you like to contribute the improvement back to the starter kit? :slight_smile: