-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
net: multiple listen() events fail silently #6190
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I'd like to work this one. Reading through the CONTRIBUTING doc now. |
@geppy Awesome. If you get a PR up, even if it's WIP, cc me and I'll be happy to help you out. |
I think it makes more sense to throw an exception. Calling listen() repeatedly likely means there's a logic error in the application. |
@bnoordhuis there's a potential timing issue. currently if you call i think that'd be as simple as storing a |
Hi @trevnorris - I did a minimal implementation. I have a few questions though:
|
Hey @geppy - I just re-read this after the weekend & wanted to say I didn't mean to step on your toes! This would be my first contribution into the core nodejs project. (I've only helped on the website side of things ... so far.) I started on this after seeing @trevnorris 's tweet - but stalled after you 'called it'. That said, please don't let me stop you from doing a PR - the more the merrier. 💯 Hope everyone had a good weekend!!! |
@justsml Okay, thanks! I'll go ahead and file my PR when I get home. |
I guess the case in which someone calls |
I'm undecided. I've been programming UNIX services for twenty years now and I've never had to adjust the backlog dynamically; it seems like a very obscure feature. Perhaps we can support it if it's almost free to do so implementation/maintenance-wise, but otherwise I wouldn't bother. I am admittedly responsible for making it adjustable in libuv but my rationale at the time can be summarized as "why not?". |
@bnoordhuis I defer to your good judgement and experience here, I just thought I'd bring it up just in case :-) |
@bnoordhuis My main concern here is that calling const server = require('net').createServer(function(c) {
console.error(this.address());
}).listen(8080, 'localhost');
server.listen(8081); Then run Basically, I'd like to see consistency more than anything and figured the easiest way to do this was remove the ability to call |
Hi there. |
Removing |
Problem: It's possible to run listen() on a net.Server that's already listening to a port. The result is silent failure, with the side effect of changing the connectionKey and or pipeName. Solution: throw an error if listen method called more than once. close() method should be called between listen() method calls. Refs: nodejs#8294 Fixes: nodejs#6190 Fixes: nodejs#11685
Problem: It's possible to run listen() on a net.Server that's already listening to a port. The result is silent failure, with the side effect of changing the connectionKey and or pipeName. Solution: throw an error if listen method called more than once. close() method should be called between listen() method calls. Refs: nodejs/node#8294 Fixes: nodejs/node#6190 Fixes: nodejs/node#11685 PR-URL: nodejs/node#13149 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
It's possible to run
listen()
on anet.Server
that's already listening to a port. The result is silent failure, with the side effect of changing the_connectionKey
and or_pipeName
.More expected behavior would be to emit an error on the server's
'error'
event handler.Example test:
The text was updated successfully, but these errors were encountered: