Skip to content

Bug: Server.listen() hangs with no error when listening on in-use port #35937

@lobsterkatie

Description

@lobsterkatie
  • Version: v10.18.1
  • Platform: Darwin Katies-MacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
  • Subsystem: net.js

What steps will reproduce the bug?

  1. Run a server (any server) on some port (in my case, 3000).
  2. Call http.createServer to get a Server object, and then call .listen(<your-already-occupied-port>) on it

How often does it reproduce? Is there a required condition?

You must have another server already running on the port in question.

What is the expected behavior?

I'd expect that if I try to listen on a port which is already in use, I'd get an error.

What do you see instead?

My script just hangs.

Additional information

The script I'm trying to run is this one: https://github.com/getsentry/sentry-javascript/blob/c864ff63d3515be4efa3b1399ef9cafe89497661/packages/node/test/manual/express-scope-separation/start.js

Perhaps I'm missing something - I'm relatively new to the node ecosystem - but I've used a debugger to step into first the express and then the node listen methods, and nowhere do I see a check for an in-use port, nor any kind of error or warning.

Feel free to point me in the right direction if this is not, in fact, a bug.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions