courgette/big-brother-bot — Issue #50: B3 stops after receiving a CommandTimeoutError
Author: courgette
Created: 2011-12-17 02:18:54+00:00
State: open
Labels: BF3, major

The log below shows the bot starting the shutdown sequence with exit code 220 after losing the connection to the BF3 server.

This happened because the status plugin tried to get the player scores while the connection to BF3 was lost. B3 tried to issue a command which raised a `CommandTimeoutError`. This kind of exception bubbles up to the thread running the B3 `run()` method where it is catch by the `Exception` type trap which decides to exit with exitcode 220.

This issue is somewhat related to previous commit fef4e4df. Before that commit the bot would have shutdown earlier because it would have received a `IOError` for the network connection failure.

### log
```
111216 01:59:56	VERBOS2	'waiting for game server event'
111216 02:00:00	VERBOSE	u"RCON :\t ('admin.listPlayers', 'all')"
111216 02:00:00	VERBOSE	u"RCON response:\t ['7', 'name', 'guid', 'teamId', 'squadId', 'kills', 'deaths', 'score', '0']"
111216 02:00:00	VERBOSE	'StatusPlugin: Building XML status'
111216 02:00:00	DEBUG	'StatusPlugin: Writing XML status to C:\\www\\apache\\htdocs\\xlrstats\\[removedbyhost4b3.com]\\status.xml'
111216 02:00:00	VERBOSE	u"RCON :\t ('admin.listPlayers', 'all')"
111216 02:00:00	VERBOSE	u"RCON response:\t ['7', 'name', 'guid', 'teamId', 'squadId', 'kills', 'deaths', 'score', '0']"
111216 02:00:00	DEBUG	'XlrstatsPlugin: Calculating kill_bonus'
111216 02:00:06	VERBOS2	'waiting for game server event'
111216 02:00:16	VERBOS2	'waiting for game server event'
111216 02:00:26	VERBOS2	'waiting for game server event'
111216 02:00:32	CONSOLE	"['serverInfo']"
111216 02:00:32	WARNING	"TODO : handle '['serverInfo']' frostbite2 events"
111216 02:00:32	VERBOS2	'waiting for game server event'
111216 02:00:35	CONSOLE	"['serverInfo']"
111216 02:00:35	WARNING	"TODO : handle '['serverInfo']' frostbite2 events"
111216 02:00:35	VERBOS2	'waiting for game server event'
111216 02:00:45	VERBOS2	'waiting for game server event'
111216 02:00:55	VERBOSE	'Connecting to frostbite2 server ...'
111216 02:01:00	VERBOSE	u"RCON :\t ('admin.listPlayers', 'all')"
111216 02:01:00	DEBUG	'Unable to retrieve scores from playerlist'
111216 02:01:00	VERBOSE	'StatusPlugin: Building XML status'
111216 02:01:00	DEBUG	'StatusPlugin: Writing XML status to C:\\www\\apache\\htdocs\\xlrstats\\[removedbyhost4b3.com]\\status.xml'
111216 02:01:02	ERROR	'Did not receive any response for sequence #6869.'
111216 02:01:02	INFO	"STDOUT 'Exiting: 220'"
111216 02:01:02	INFO	"STDOUT '\\n'"
111216 02:01:02	BOT	'Shutting down...'
111216 02:01:02	VERBOSE	'AdvPlugin: Warning: No handle func for AdvPlugin'
111216 02:01:02	INFO	'StatusPlugin: B3 stop/exit.. updating status'
111216 02:01:02	DEBUG	'StatusPlugin: Writing XML status to C:\\www\\apache\\htdocs\\xlrstats\\[removedbyhost4b3.com]\\status.xml'
111216 02:01:02	DEBUG	'XlrstatsPlugin: xlrstats.dumpEvent -- Type 2, Client None, Target None, Data '
111216 02:01:02	INFO	'PublistPlugin: Sending shutdown info to B3 master'
111216 02:01:03	VERBOSE	'HostPlugin: Warning: No handle func for HostPlugin'
111216 02:01:03	BOT	'Shutting down database connections...'
```