courgette/big-brother-bot — Issue #57: IOError [Errno 24] Too many open files
Author: courgette
Created: 2012-01-11 12:59:22+00:00
State: open
Labels: BF3

It seems that if B3 cannot connect to the Frostbite server close to 1024 times, then the error `IOError [Errno 24] Too many open files` appears.

This might be a bug in the error handling code that does not close the socket properly.

## log

```
120109 17:02:57	BOT	'www.bigbrotherbot.net (b3) v1.8.0dev16 [posix] [Myrthe]'
120109 17:02:57	BOT	'Python: 2.7.2+ (default, Aug 16 2011, 07:03:08) \n[GCC 4.6.1]'
120109 17:02:57	BOT	'Default encoding: ascii'
120109 17:02:57	BOT	'Starting Bf3Parser v0.1 for server 85.236.100.68:20377'
120109 17:02:57	BOT	'--------------------------------------------'
...
120109 17:03:03	INFO	'Connecting to frostbite2 server ...'
120109 17:03:05	VERBOSE	u"RCON :\t 'version'"
120109 17:03:05	VERBOSE	u"RCON response:\t ['BF3', '895921']"
120109 17:03:05	INFO	"server version : ['BF3', '895921']"
120109 17:03:05	VERBOSE	'Queueing event console say ^8www.bigbrotherbot.net ^0(^8b3^0) ^9v1.8.0dev16 [posix] ^9[^3Myrthe^9]^3 ^2[ONLINE]'
120109 17:03:05	VERBOSE	u"RCON :\t ('serverInfo',)"
...
120110 02:04:32	VERBOS2	'no game server event to treat in the last 5s'
120110 02:04:37	VERBOS2	'no game server event to treat in the last 5s'
120110 02:04:42	VERBOS2	'no game server event to treat in the last 5s'
120110 02:04:42	VERBOS2	'sayqueuelistener: had nothing to do in the last 40 sec'
120110 02:04:47	VERBOS2	'no game server event to treat in the last 5s'
120110 02:04:52	VERBOS2	'no game server event to treat in the last 5s'
120110 02:04:57	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:00	VERBOSE	u"RCON :\t ('admin.listPlayers', 'all')"
120110 02:05:00	VERBOSE	u"RCON response:\t ['7', 'name', 'guid', 'teamId', 'squadId', 'kills', 'deaths', 'score', '0']"
120110 02:05:00	VERBOSE	'StatusPlugin: Building XML status'
120110 02:05:00	DEBUG	'StatusPlugin: Uploading XML status to FTP server'
120110 02:05:01	VERBOSE	u"RCON :\t ('admin.listPlayers', 'all')"
120110 02:05:01	VERBOSE	u"RCON response:\t ['7', 'name', 'guid', 'teamId', 'squadId', 'kills', 'deaths', 'score', '0']"
120110 02:05:02	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:07	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:07	INFO	'Connecting to frostbite2 server ...'
120110 02:05:07	INFO	'STDOUT "error: uncaptured python exception, closing channel (:[Errno 111] Connection refused [/usr/lib/python2.7/asyncore.py|read|83] [/usr/lib/python2.7/asyncore.py|handle_read_event|441] [/usr/lib/python2.7/asyncore.py|handle_connect_event|449])"'
120110 02:05:07	INFO	"STDOUT '\\n'"
120110 02:05:07	ERROR	'IOError [Errno 111] Connection refused'
120110 02:05:12	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:12	INFO	'Connecting to frostbite2 server ...'
120110 02:05:12	ERROR	'IOError [Errno 111] Connection refused'
120110 02:05:17	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:17	INFO	'Connecting to frostbite2 server ...'
120110 02:05:17	ERROR	'IOError [Errno 111] Connection refused'
120110 02:05:22	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:22	INFO	'Connecting to frostbite2 server ...'
120110 02:05:22	ERROR	'IOError [Errno 111] Connection refused'
120110 02:05:22	VERBOS2	'sayqueuelistener: had nothing to do in the last 40 sec'
120110 02:05:27	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:27	INFO	'Connecting to frostbite2 server ...'
120110 02:05:27	ERROR	'IOError [Errno 111] Connection refused'
120110 02:05:32	VERBOS2	'no game server event to treat in the last 5s'
120110 02:05:32	INFO	'Connecting to frostbite2 server ...'
...
120110 03:31:12	ERROR	'IOError [Errno 111] Connection refused'
120110 03:31:17	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:17	INFO	'Connecting to frostbite2 server ...'
120110 03:31:17	ERROR	'IOError [Errno 111] Connection refused'
120110 03:31:21	VERBOS2	'sayqueuelistener: had nothing to do in the last 40 sec'
120110 03:31:22	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:22	INFO	'Connecting to frostbite2 server ...'
120110 03:31:22	ERROR	'IOError [Errno 111] Connection refused'
120110 03:31:27	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:27	INFO	'Connecting to frostbite2 server ...'
120110 03:31:27	ERROR	'IOError [Errno 111] Connection refused'
120110 03:31:32	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:32	INFO	'Connecting to frostbite2 server ...'
120110 03:31:32	ERROR	'IOError [Errno 24] Too many open files'
120110 03:31:37	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:37	INFO	'Connecting to frostbite2 server ...'
120110 03:31:37	ERROR	'IOError [Errno 24] Too many open files'
120110 03:31:42	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:42	INFO	'Connecting to frostbite2 server ...'
120110 03:31:42	ERROR	'IOError [Errno 24] Too many open files'
120110 03:31:47	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:47	INFO	'Connecting to frostbite2 server ...'
120110 03:31:47	ERROR	'IOError [Errno 24] Too many open files'
120110 03:31:52	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:52	INFO	'Connecting to frostbite2 server ...'
120110 03:31:52	ERROR	'IOError [Errno 24] Too many open files'
120110 03:31:57	VERBOS2	'no game server event to treat in the last 5s'
120110 03:31:57	INFO	'Connecting to frostbite2 server ...'
120110 03:31:57	ERROR	'IOError [Errno 24] Too many open files'
```