courgette/big-brother-bot — Issue #47: KeyError in FrostbiteServer class
Author: courgette
Created: 2011-11-23 21:28:02+00:00
State: open
Labels: BF3, major

It was [reported](http://forum.bigbrotherbot.net/battle-field-3/adv-plugin-failing/msg30066/#msg30066) a uncatched `KeyError` in the `FrostbiteServer` class. This exception seems to block the adv plugin somehow.

```
STDERR Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/b3/courgette-big-brother-bot-d9721c6/b3/parsers/frostbite2/abstractParser.py", line 272, in sayqueuelistener
self.write(self.getCommand('say', message=line))
File "/home/b3/courgette-big-brother-bot-d9721c6/b3/parsers/frostbite2/abstractParser.py", line 309, in write
res = self.output.write(msg, maxRetries=maxRetries, needConfirmation=needConfirmation)
File "/home/b3/courgette-big-brother-bot-d9721c6/b3/parsers/frostbite2/rcon.py", line 52, in write
response = self.frostbite_server.command(cmd)
File "/home/b3/courgette-big-brother-bot-d9721c6/b3/parsers/frostbite2/protocol.py", line 324, in command
response = self._wait_for_response(command_id)
File "/home/b3/courgette-big-brother-bot-d9721c6/b3/parsers/frostbite2/protocol.py", line 405, in _wait_for_response
response = self.pending_commands[command_id]
KeyError: 2787
```
while it is unclear to me why `self.pending_commands[command_id]` raises a `KeyError` out of the while loop, syserr0r 's analysis most likely is right.