dgram: don't swallow bind errors when callback is provided - #62602
Merged
nodejs-github-bot merged 1 commit intoAug 23, 2026
Conversation
Collaborator
|
Review requested:
|
armanmikoyan
force-pushed
the
fix/dgram-bind-silent-error
branch
2 times, most recently
from
April 5, 2026 17:12
60c4c3a to
6624c6f
Compare
Signed-off-by: armanmikoyan <arman.mikoyan1@gmail.com>
armanmikoyan
force-pushed
the
fix/dgram-bind-silent-error
branch
from
April 5, 2026 17:15
6624c6f to
4b5f804
Compare
Ethan-Arrowood
approved these changes
Jul 14, 2026
Ethan-Arrowood
left a comment
Contributor
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.
Contributor
|
cc @nodejs/net @nodejs/http |
Member
|
No, I think this is just a bug fix |
Collaborator
gurgunday
approved these changes
Jul 15, 2026
Contributor
Author
|
@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. |
Contributor
|
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.
bjohansebas
approved these changes
Jul 24, 2026
This comment was marked as outdated.
This comment was marked as outdated.
14 tasks
Collaborator
Collaborator
|
Landed in 97c7e32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.