Giter VIP home page Giter VIP logo

Comments (14)

bsergean avatar bsergean commented on May 14, 2024 1

Just deployed the change on a limited dev environment, I'll see how this goes.

from rain.

cenkalti avatar cenkalti commented on May 14, 2024

Rain picks up a random port for each torrent from the range between PortBegin and PortEnd defined in config. It is only used for accepting incoming peer connections, so it does not block torrent from downloading. The client can still establish outbound connections. That's why it is a warning rather than error.

The error is being returned from network package because there must be another process listing on the same port. Can you check the status of listening ports when you see this warning again?

Command should be:

  • sudo lsof -Pn -iTCP -sTCP:LISTEN for MacOS
  • netstat -antp for Linux

from rain.

cenkalti avatar cenkalti commented on May 14, 2024

A question: Is it always the same port number or is it changing between runs?

from rain.

bsergean avatar bsergean commented on May 14, 2024
    PortBegin:                              50000,
    PortEnd:                                60000,

So it's 10,000 ports to choose from. I wonder if I can exhaust all of them sometimes.

For your question about whether it's the same port, it looks like it isn't the case:

2022-02-02 19:29:56 WARNING  [torrent gNxxiIReEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 53331: listen tcp4 :53331: bind: address already in use
2022-02-02 19:46:14 WARNING  [torrent x7io34RgEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 51974: listen tcp4 :51974: bind: address already in use
2022-02-02 20:03:16 WARNING  [torrent KNsc64RjEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 52902: listen tcp4 :52902: bind: address already in use
2022-02-02 20:21:01 WARNING  [torrent o3nxV4RlEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 55112: listen tcp4 :55112: bind: address already in use
2022-02-02 20:40:14 WARNING  [torrent UyFAKoRoEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 51350: listen tcp4 :51350: bind: address already in use
2022-02-02 21:00:55 WARNING  [torrent NrCjz4RrEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 58734: listen tcp4 :58734: bind: address already in use
2022-02-02 21:28:04 WARNING  [torrent AYxEToRvEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 51514: listen tcp4 :51514: bind: address already in use
2022-02-02 22:07:51 WARNING  [torrent kGjtiYR0Eey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 56552: listen tcp4 :56552: bind: address already in use
2022-02-02 23:39:42 WARNING  [torrent ZUbVIISBEey38EIBCoCA6Q] torrent_start.go:116 cannot listen port 51408: listen tcp4 :51408: bind: address already in use
2022-02-03 00:01:04 WARNING  [torrent YUrVQ4SEEeydOkIBCoCA6Q] torrent_start.go:116 cannot listen port 58814: listen tcp4 :58814: bind: address already in use
2022-02-03 00:07:05 WARNING  [torrent OFQ44ISFEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 54154: listen tcp4 :54154: bind: address already in use
2022-02-03 00:18:39 WARNING  [torrent 1eQ7VoSGEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 55210: listen tcp4 :55210: bind: address already in use
2022-02-03 00:34:22 WARNING  [torrent CDhH_4SJEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 53216: listen tcp4 :53216: bind: address already in use
2022-02-03 01:22:04 WARNING  [torrent sgOXBoSPEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 54186: listen tcp4 :54186: bind: address already in use
2022-02-03 01:37:23 WARNING  [torrent 1gmy94SREeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 50214: listen tcp4 :50214: bind: address already in use
2022-02-03 01:52:28 WARNING  [torrent 8Xdw_ISTEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 53122: listen tcp4 :53122: bind: address already in use
2022-02-03 02:08:54 WARNING  [torrent PPDYQYSWEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 53192: listen tcp4 :53192: bind: address already in use
2022-02-03 02:26:50 WARNING  [torrent vj0IxYSYEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 54000: listen tcp4 :54000: bind: address already in use
2022-02-03 02:43:07 WARNING  [torrent BO3K2ISbEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 58022: listen tcp4 :58022: bind: address already in use
2022-02-03 03:31:45 WARNING  [torrent z-6qeoShEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 53548: listen tcp4 :53548: bind: address already in use
2022-02-03 03:49:50 WARNING  [torrent Vr-Xz4SkEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 50192: listen tcp4 :50192: bind: address already in use
2022-02-03 04:07:57 WARNING  [torrent 3m7aeYSmEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 53940: listen tcp4 :53940: bind: address already in use
2022-02-03 05:04:21 WARNING  [torrent v6V5eoSuEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 55690: listen tcp4 :55690: bind: address already in use
2022-02-03 05:22:35 WARNING  [torrent S8M1TYSxEeyax0IBCoCA6Q] torrent_start.go:116 cannot listen port 57850: listen tcp4 :57850: bind: address already in use

from rain.

bsergean avatar bsergean commented on May 14, 2024

I look at the error logs, and printed all port, and I wonder if I'm slowly exhausting all the available ports ... notice how the free ports between those range starts to be small.

grep 'cannot listen port ' app.log | awk '{ print $10 }' | tr -d : | sort -nu

59918
59922
59924
59930
59932
59936
59938
59944
59948
59950
59952
59954
59956
59958
59960
59962
59964
59968
59974
59980
59984
59986
59990
59994
59998

from rain.

cenkalti avatar cenkalti commented on May 14, 2024

I guess some of these ports may be in use at the time that torrent is started because another process (or Rain itself) can use the port in dynamic port range for outgoing connections.

I suggest changing the port range to 20000-30000 and test if it works.

If that solves the problem, we can update the default range in config.

https://en.wikipedia.org/wiki/Ephemeral_port

from rain.

bsergean avatar bsergean commented on May 14, 2024

from rain.

cenkalti avatar cenkalti commented on May 14, 2024

No, just change the incoming range, we don't have control over outgoing port range.

I am suggesting setting PortBegin to 20000 and PortEnd to 30000.

rain/torrent/config.go

Lines 195 to 196 in 2ae49b7

PortBegin: 50000,
PortEnd: 60000,

from rain.

bsergean avatar bsergean commented on May 14, 2024

from rain.

github-actions avatar github-actions commented on May 14, 2024

This issue is stale because it has been open for 30 days with no activity.

from rain.

cenkalti avatar cenkalti commented on May 14, 2024

@bsergean Does the change prevented the errors from happening?

from rain.

bsergean avatar bsergean commented on May 14, 2024
2022-03-10 03:51:05 INFO     [torrent UBc_BqAlEeyvSEIBCoCA6Q] session_add.go:284 added torrent
2022-03-10 03:51:05 INFO     [torrent UBc_BqAlEeyvSEIBCoCA6Q] torrent_start.go:31 starting torrent
2022-03-10 03:51:05 WARNING  [torrent UBc_BqAlEeyvSEIBCoCA6Q] torrent_start.go:116 cannot listen port 20812: listen tcp4 :20812: bind: address already in use

I just grep'ed our error logs and found this: port was 20812, so in the new address range, the problem didn't go away.

from rain.

github-actions avatar github-actions commented on May 14, 2024

This issue is stale because it has been open for 30 days with no activity.

from rain.

github-actions avatar github-actions commented on May 14, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

from rain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.