Uh oh!
There was an error while loading. Please reload this page.
dgram: don't swallow bind errors when callback is provided - #62602
Conversation
nodejs-github-bot
commented
Apr 5, 2026
Review requested:
|
60c4c3a to
6624c6fCompareSigned-off-by: armanmikoyan <arman.mikoyan1@gmail.com>
6624c6f to
4b5f804Compare
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
This seems appropriate to me. Even if a fix, this is a notable change in behavior. I believe notable-change is warranted at least. I'm not sure about semver. I don't want to tag all of the TSC, but I'll see if http/net folks have any input as the dgram subsystem is relatively close to those.
Ethan-Arrowood
commented
Jul 14, 2026
cc @nodejs/net @nodejs/http |
mcollina
commented
Jul 15, 2026
No, I think this is just a bug fix |
nodejs-github-bot
commented
Jul 15, 2026
armanmikoyan
commented
Jul 15, 2026
@mcollina I can't access the CI logs. Could someone let me know if the failures are related to my changes or just flaky? Happy to fix them if needed, or a re-run would be appreciated if they're unrelated. |
Ethan-Arrowood
commented
Jul 23, 2026
CI failure looks unrelated to me; its a sqlite-backup flake and some rebase infra issue. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Aug 22, 2026
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Aug 23, 2026
Landed in 97c7e32 |
Signed-off-by: armanmikoyan <arman.mikoyan1@gmail.com> PR-URL: #62602 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Signed-off-by: armanmikoyan <arman.mikoyan1@gmail.com> PR-URL: #62602 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Signed-off-by: armanmikoyan <arman.mikoyan1@gmail.com> PR-URL: #62602 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
dgram: don't swallow bind errors when callback is provided
When
Socket.prototype.bind()is called with a callback, the internalcleanup listener is registered on
'error', which counts as an errorhandler and silently swallows bind errors (e.g.
EADDRINUSE) when nouser error handler is attached.
This switches to
EventEmitter.errorMonitorfor the cleanup listener,matching the pattern already used in the
enqueue()function(
lib/dgram.js:571). This ensures bind errors properly propagate asunhandled errors while still performing listener cleanup.
Setup — a socket already bound to port 5000
No callback, no
listeningevent — error surfaces (correct)Using
listeningevent — error surfaces (correct)Using callback — error silently swallowed (bug)
All three examples do the same thing — bind to a port already in use.
The first two properly throw, but the third silently swallows the error
just because a callback was passed to
bind().After this fix, all three cases properly surface the error.