-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EADDRINUSE error leads to improper port usage by server middleware #3011
EADDRINUSE error leads to improper port usage by server middleware #3011
Comments
This seems to be (as you can see in the linked source snippet) intentional behavior. I would agree with you that it's not very intuitive - when you tell an application to use a port, it should use it or fail. Changing this would be, I assume, a reversal of a design decision, so it'll probably require some discussion. |
As far as I can see 58caccd was intended to prevent karma fail if a current port is already in use, there was assumption that the next available port will be used by karma as well as karma middleware and other karma modules. Here's an open bug that looks related to this one #1476. Does @dignifiedquire proposal still look reasonable here? |
@lusarz it's not fixed for me karma v2.0.4 |
@ViieeS is it Karma v2.0.4 ? |
@lusarz yes. I have 3 pipelines running in the same time in gitlab. v2.0.2 works fine. |
@ViieeS I check for available port a lot before real karma server starts to run ( Line 119 in c88ebc6
Line 174 in c88ebc6
Line 159 in c88ebc6
I'll try to think about solution in nearest future. As a workaround please revert to v2.0.2, or try to configure port separately for every pipeline in gitlab. |
@lusarz got it, thanks! Somehow needs to bind the port right away after checking. Hope you can fix it. |
Expected behaviour
If a port is changed in the passed configuration before server start (e.g. if
EADDRINUSE
is thrown for a specified port, the next available is used), it should be respected by server middleware.Actual behaviour
Middleware use a port that was initially passed in the configuration.
Environment Details
karma --version
): reproduced in 1.7.1, but should be also actual for 2.0.2karma.config.js
file: proxy middleware can be used as an exampleSteps to reproduce the behaviour
karma start
) with already used port – in other words you have to raiseEADDRINUSE
error inkarma/lib/server.js
Line 186 in 667b47e
9876
)WARN [karma]: Port 9876 in use
and a new port that Karma uses:
INFO [karma]: Karma <v> server started at http://0.0.0.0:9877/
9876
instead of changed9877
.The text was updated successfully, but these errors were encountered: