Page 1 of 2

Deluge looses or ignores port assignment

Posted: Sun Jan 22, 2012 1:24 am
by Lazybones
I have been noticing some odd behavior..

If I restart (using the init script restart) the daemon often looses its active port, or if I make changes on the Preference->network tab I sometimes notice the active port changes to a random one.

Both my Incoming and Outgoing ports are set to specific values and use random is unchecked.. I also have UPnP and NAT-PMP unchecked...

Does this happen to anyone else?

Client Version: 1.3.3 (Windows)
Server Version: 1.3.3 (Debian Wheezy installed from source)
Libtorrent Version: 0.15.9.0

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 23, 2012 4:35 pm
by Lazybones
Was doing some digging on libtorrent docs and apparently the expected behavior is that if the preferred port is not available it will use a random one, however this raises questions:

Why is the port not available? When you change something on the network screen is the port not released? Does it get reset forcing a check on availability?
Could deluge not toss up an error or do a fault check if you have fixed ports but the active port does not match? Maybe auto retry releasing the ports and assigning them again?

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 23, 2012 6:17 pm
by Cas
Have you tried leaving the outgoing ports on random.

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 23, 2012 6:24 pm
by Lazybones
Cas wrote:Have you tried leaving the outgoing ports on random.
I can try that again, however I have them set for network QoS reasons so I can shape my Bittorent traffic..

However I am fairly sure that I switched it back to random and still sometimes found the inbound port was lost.

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 30, 2012 5:31 am
by Lazybones
Notice it had lost its ports again after a recent set of reboots, I set the outbound ports to random with no luck.. I had to toggle the inbound port to random, wait then toggle it back to my selected port before it would go back.

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 30, 2012 12:38 pm
by Cas
What is the range of ports you are using?

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 30, 2012 3:01 pm
by Lazybones
Inbound 3390
Out is now random

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 30, 2012 4:09 pm
by Cas
I think using a single port is the issue, you are best to use a range of ports, say 10 or so. Plus, as mentioned in faq, you are best to use the ports numbers in the range of 49152 to 65535.

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 30, 2012 4:28 pm
by Lazybones
Cas wrote:I think using a single port is the issue, you are best to use a range of ports, say 10 or so. Plus, as mentioned in faq, you are best to use the ports numbers in the range of 49152 to 65535.
More than a single inbound port seems odd for a torrent client, also if I read the libtorrent API correctly it only binds to one inbound port out of the range anyway. I might open it up to two ports to reduce the chance of binding failure.

Random outgoing ports is standard, I can live with that, however it makes QoS a little less clean..

Re: Deluge looses or ignores port assignment

Posted: Mon Jan 30, 2012 5:17 pm
by Cas
Lazybones wrote: More than a single inbound port seems odd for a torrent client, also if I read the libtorrent API correctly it only binds to one inbound port out of the range anyway. I might open it up to two ports to reduce the chance of binding failure.
It only uses one port at a time but if you restart Deluge and your pc/router is still holding that port connection open it cannot use it until its freed. The libtorrent api does mention this point:
listen-port wrote:If all ports in the specified range fails to be opened for listening, libtorrent will try to use port 0 (which tells the operating system to pick a port that's free).