Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, August 2007
Possible problem with QTcpServer + many connections?


Message 1 in thread

Hi,
I am working with the torrent example in examples/network/torrent. And I must say,
this program drives me crazy. When I have torrents with many seeds it stops 
working after a time with a 'too many files open' error. The reason are hundreds 
of sockets in CLOSE_WAIT state, which remain indefinitely in this state and slowly 
eating my file resources away. 

The last two days I was looking for a possible bug in the program, but was unable 
to find one. I just discovered something strange, which might either be a problem 
with my Linux (don't think so), a possible lack of knowledge regarding tcp 
connections on my side (possible), or a bug in QTcpServer or QTcpSocket 
(unlikely?).

I logged all incoming and outgoing connections. These are the connections, which I 
initiate from the list I get from a tracker and the connections, which are 
initiated from outside peers, who got my address from a tracker. When I now 
compare the sockets in CLOSE_WAIT state with this list, I find only address/port 
pairs to which I never had a connections. Does anyone has an explanation for this?

Actually the CLOSE_WAIT problem happens only when I allow outside initiated 
connections. When I force the torrentserver class to listen to an internal 
address, which effectively switches it off, I don't have this problem. 

Could it be that the QTcpServer is 'deaf' for a certain percentage of incoming 
connections? A socket is opened, the program/the QTcpServer gets not information 
about this socket, the peer closes his side, since he gets no data and on my side a 
CLOSE_WAIT socket remains?

Of course it is possible that I missed somewhere a third location in the code,
which opens sockets (apart from the http connection to the tracker). If this is 
the case, I'd appreciate a hint. :-)


Guido






--
 [ signature omitted ] 

Message 2 in thread

Looks like I found the problem in the torrent code (90% sure). Does Trolltech 
accept patches? :-)

Guido


On Mon, Aug 13, 2007 at 03:13:04PM +0200, Guido Seifert wrote:
> Hi,
> I am working with the torrent example in examples/network/torrent. And I must say,
> this program drives me crazy. When I have torrents with many seeds it stops 
> working after a time with a 'too many files open' error. The reason are hundreds 
> of sockets in CLOSE_WAIT state, which remain indefinitely in this state and slowly 
> eating my file resources away. 
> 

--
 [ signature omitted ] 

Message 3 in thread

On mandag den 13. August 2007, Guido Seifert wrote:
> Looks like I found the problem in the torrent code (90% sure). Does
> Trolltech accept patches? :-)

Of course. Send a mail to bugs@xxxxxxxxxxxxx and include your patch.

Bo.

> On Mon, Aug 13, 2007 at 03:13:04PM +0200, Guido Seifert wrote:
> > Hi,
> > I am working with the torrent example in examples/network/torrent. And I
> > must say, this program drives me crazy. When I have torrents with many
> > seeds it stops working after a time with a 'too many files open' error.
> > The reason are hundreds of sockets in CLOSE_WAIT state, which remain
> > indefinitely in this state and slowly eating my file resources away.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/



-- 
 [ signature omitted ] 

Message 4 in thread

I don't think they would just take your patch and apply it, but if you
add a patch to a bug report, it certainly will help them fixing the bug
;)

Cheers,
Peter

> -----Original Message-----
> From: Guido Seifert [mailto:wargand@xxxxxx] 
> Sent: Monday, August 13, 2007 9:50 PM
> To: TrolltechInterest
> Subject: Re: Possible problem with QTcpServer + many connections?
> 
> 
> Looks like I found the problem in the torrent code (90% 
> sure). Does Trolltech 
> accept patches? :-)
> 
> Guido

--
 [ signature omitted ] 

Message 5 in thread

On 8/14/07, Peter Prade <prade@xxxxxxxxxxx> wrote:
> I don't think they would just take your patch and apply it, but if you
> add a patch to a bug report, it certainly will help them fixing the bug
> ;)

They did for me :). But yes, adding a patch will certainly help in
resolving the bug quicker.

-- 
 [ signature omitted ]