Opened 10 years ago

Closed 10 years ago

#473 closed defect (fixed)

Code counting number of connections broken

Reported by: anonymous Owned by: quinox
Priority: major Milestone:
Component: nicotine Version: SVN
Keywords: Cc:


The code counting number of connections is broken, it displays diametrically different numbers of connections than there really are. Right now there are only 11 connections on my system, only 2 of that are from python (this number is from both my net monitoring app and from my router), but nicotine displays 115 connections in its status bar. Sometimes I reach the connection limit even though there are only a few real connections.

System: XP SP3 and Windows 7 RTM Python 2.5.4 and 2.6.2

Change History (6)

comment:1 Changed 10 years ago by quinox

I think your router should report a single connection, not two, but that doesn't matter in the grand scheme of things.

First, let's determine where those connections come from: Have you done anything to get up to 115? For every person that has/wants a search result you need to open a separate connection - uploads/downloads take a single connection (as expected I guess)

My second question would be, does the number go down eventually? If it does, do you suppose it takes too long for n+ to realize there is no more connection? Or is an acceptable delay

comment:2 Changed 10 years ago by anonymous

To get that many connections, I just need to run a search on some rather common artist/album, the problem is, that this number doesn't go down, it drops a few connections over time (but not more than 10 - 15), but then it creates new ones and it's constantly rising. If the search returns really many results or if I do a number of consecutive searches, I eventually reach the 460 connections limit. Even if only one search is performed, the number doesn't drop much over time, it stays more or less the same even after 1 hour.

comment:3 Changed 10 years ago by quinox

That sounds like a real problem.

On my Linux machine it works like this:

  1. I search for something not very popular. The connection count goes up and down real fast, reaching the baseline within a minute or so
  2. I search for something popular. The connection goes goes up up up, stays there for about three minutes and then within seconds it falls all the way to the baseline.

My guess would be we use a timer to trigger a cleanup action, and apparently this doesn't run often enough on Windows (and maybe we can make it more aggressive on Linux as well). I'll look into it

comment:4 Changed 10 years ago by quinox

After examining the problem it would seem the connections that linger around are connections that are in progress of being established. I'm guessing Linux kills them after a few minutes, Windows kills them at some point too but n+ was never notified of this.

Waiting 3 minutes (in case of Linux) or indefinitely long (in case of Windows) for these connections to do something seems a bit silly, so I've added an extra check, these semi connections will be cleaned up after 30 seconds. This will probably solve your problem, it definitely makes it more aggressive on Linux and it might introduce a whole new set of problems :-)

So check out r1220 and let me know if the connection counter works better now.

comment:5 Changed 10 years ago by anonymous

Seems to be fixed. Did a search that previously caused problems, the number of connections jumped to 160, then fluctuated around that number, after 30 seconds it dropped to 47 connections and after a few more seconds it went down to 2 connections.

comment:6 Changed 10 years ago by quinox

Resolution: fixed
Status: newclosed


Note: See TracTickets for help on using tickets.