Coder Social home page Coder Social logo

Use REUSEADDR when starting tcp server about puma HOT 2 CLOSED

puma avatar puma commented on April 29, 2024
Use REUSEADDR when starting tcp server

from puma.

Comments (2)

evanphx avatar evanphx commented on April 29, 2024

Is there a reason it should? Are you seeing a problem that would be solved by doing so?

from puma.

paneq avatar paneq commented on April 29, 2024

Technically it should allow to bind to port even when it is in TIME_WAIT state what might happen because of crash or killed process. EventMachine mentions in its code comments that it helps with unexpected restarts. Otherwise there are problems with binding again for some time.

I also use Puma for testing communication with external application and Puma is started and shutdown in every acceptance test. The problem is that such quick on/off workout leaves the socket in TIME_WAIT state and puma server (playing the role of external webservice) cannot start on the same port in subsequent tests. REUSEADDR should fix that but as you can see from my gist it does not work well for me.

I had the same issue when using Webrick but it works fine on Thin (which uses EM which sets this option in C code directly instead of via Ruby code). I guess this option might not work at all in Ruby but it is also possible that I am doing something wrong. I was hoping that someone smarter could try to use it and tell me if it behaves correctly or not.

from puma.

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.