Giter Club home page Giter Club logo

Comments (9)

antonkharenko avatar antonkharenko commented on May 26, 2024

It is doing check that port is available and if yes bind to this port, but since there 50 nodes doing it in parallel there is a race condition between the check and binding.

For test purpose I recommend to either start each node on specific port or at least configure starting port different for each node in order to avoid contention for the ports at all.

Here is a transport config example how to start each node on different fixed port:

TransportConfig conf = TransportConfig.builder()
  .port(TransportConfig.DEFAULT_PORT + nodeIndex)
  .portAutoIncrement(false)
  .build()

from scalecube-services.

ronenhamias avatar ronenhamias commented on May 26, 2024

i understand there are ways to workaround this issue but i think that its better to locate port until success
users might fall on taken ports even if they are not taken by cluster code it self and still would like to start a node successfully - not only because of this specific case but also by the desire to run several nodes under same container or just by mistake try to connect on already used port.

from scalecube-services.

antonkharenko avatar antonkharenko commented on May 26, 2024

Just for clarity, if you try to connect on already used port it will not fail with port already used exception since it will select next available one, the issue is specific for the case when you start many cluster nodes on same machine at same moment of time and all of them trying to bind to the same port range. So outside of the code snippet above it would pretty difficult to reproduce it otherwise.

from scalecube-services.

ronenhamias avatar ronenhamias commented on May 26, 2024

ok so can it be same situation that someone take my port at this exact moment of time?
my process starts and someone take the port... is it really matters who?

from scalecube-services.

antonkharenko avatar antonkharenko commented on May 26, 2024

It's possible only in case if they start practically in the same moment of time like in the range of some nano seconds or so.

from scalecube-services.

ronenhamias avatar ronenhamias commented on May 26, 2024

yep - exactly.
so need to fail-over and not fail

from scalecube-services.

antonkharenko avatar antonkharenko commented on May 26, 2024

Yes, but it's practically impossible outside of the code snippet above where you start several nodes in the for-loop concurrently.

from scalecube-services.

ronenhamias avatar ronenhamias commented on May 26, 2024

i didnt understand why its not possible
i start just one node and someone in some rare moment of time just take this port...

from scalecube-services.

antonkharenko avatar antonkharenko commented on May 26, 2024

Fixed in PR: #117

from scalecube-services.

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.