Kumosan
13th August 2007, 21:08
Hi, I have a strange problem with the Trolltech examples/network/torrent code. I took the code to build my own bittorrent client with it. But something is not right either with the code, with QTcpServer or with my computer. I doubt the last.
When the program runs for a while, sockets in close_wait states pile up. Sooner or later I get a 'too many files open' error message and the program stops.
Now I logged all addresses/ports of all incoming and outgoing peers. These are either the connections I initiate with the peer list I get from the tracker, or incoming connections, which are initiated by other peers.
The problem is I never see the close_wait sockets in my logs. In my program they simply don't exist (the address/port pair).
How likely is it that this is some sort of race bug in QTcpServer? It accepts a connection, but somehow 'swallows' the notification sometimes. My program never sees those swallowed connections, sends no data and the peer closes the connection on his side. The socket remains in close_wait forever and I cannot close it manually since it is unreachable for me.
Found the bug. QTcpServer is ok. :)
When the program runs for a while, sockets in close_wait states pile up. Sooner or later I get a 'too many files open' error message and the program stops.
Now I logged all addresses/ports of all incoming and outgoing peers. These are either the connections I initiate with the peer list I get from the tracker, or incoming connections, which are initiated by other peers.
The problem is I never see the close_wait sockets in my logs. In my program they simply don't exist (the address/port pair).
How likely is it that this is some sort of race bug in QTcpServer? It accepts a connection, but somehow 'swallows' the notification sometimes. My program never sees those swallowed connections, sends no data and the peer closes the connection on his side. The socket remains in close_wait forever and I cannot close it manually since it is unreachable for me.
Found the bug. QTcpServer is ok. :)