Skip to content

Fix UDS graceful restart for unix-dgram numeric errcodes - #323

Merged
bdeitte merged 1 commit into
bdeitte:mainfrom
KeenanLawrenceStitch:fix/uds-unix-dgram-numeric-errno
Jul 18, 2026
Merged

Fix UDS graceful restart for unix-dgram numeric errcodes#323
bdeitte merged 1 commit into
bdeitte:mainfrom
KeenanLawrenceStitch:fix/uds-unix-dgram-numeric-errno

Conversation

@KeenanLawrenceStitch

@KeenanLawrenceStitch KeenanLawrenceStitch commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

udsGracefulErrorHandling never recreates the socket on hot-shots ≥14 when using unix-dgram, because protocolErrorHandler compares err.code against string codes only ('ENOTCONN', …), while unix-dgram sets err.code to a negative numeric errno (e.g. -107 / -111 on Linux, -39 / -54 on Darwin).

This is the UDS follow-on to #301 / #302: the TCP string-code fix was correct for Node TCP sockets, but the same change broke UDS matching.

Fix

Minimal change in udsErrors(): keep the existing string codes and also include the negative numeric errnos that unix-dgram emits.

// linux
return ['ENOTCONN', 'ECONNREFUSED', -107, -111];
// darwin
return ['EDESTADDRREQ', 'ECONNRESET', -39, -54];

Test plan

  • npm install
  • npm test — 1957 passing
  • Updated test/constants.js assertions for numeric codes
  • CI on this PR

Related

Follow-up to #301 / #302 (UDS path).

Made with Cursor

unix-dgram sets err.code to a negative errno (e.g. -107), so the
string-only UDS_ERROR_CODES check from bdeitte#302 never matched and sockets
were never replaced after Agent UDS inode churn.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bdeitte

bdeitte commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Thanks- I see as well now this is broken and this looks like a good fix for me. I'm going to make a few additions here on top of this you'll see here shortly, but this is good to merge. Thanks again!

@bdeitte
bdeitte merged commit 07eada3 into bdeitte:main Jul 18, 2026
8 checks passed
@KeenanLawrenceStitch

Copy link
Copy Markdown
Contributor Author

Awesome, thanks @bdeitte!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants