Skip to content

test(h2): swallow late session errors in the issue-5087 timeout tests - #5694

Open
luantaraschi wants to merge 1 commit into
nodejs:mainfrom
luantaraschi:fix/issue-5087-late-session-errors
Open

test(h2): swallow late session errors in the issue-5087 timeout tests#5694
luantaraschi wants to merge 1 commit into
nodejs:mainfrom
luantaraschi:fix/issue-5087-late-session-errors

Conversation

@luantaraschi

Copy link
Copy Markdown

test/issue-5087.js is the last of the h2 timeout tests without the late-error guard that #5674 and #5686 added to its neighbours, and it has been failing CI on that.

From the Node 26 macOS job of run 31785340849:

✔ https://github.com/nodejs/undici/issues/5087 headersTimeout over h2 rejects with HeadersTimeoutError (56.61675ms)
ℹ Error: Test "... headersTimeout over h2 rejects with HeadersTimeoutError" at test/issue-5087.js:50:1
  generated asynchronous activity after the test ended. This activity created the error
  "Error: read ECONNRESET" and would have caused the test to fail, but instead triggered
  an uncaughtException event.
✖ /Users/runner/work/undici/undici/test/issue-5087.js

The assertion passed. All three tests here abort a request client-side once the timeout fires, so the server session and its socket can surface a late ECONNRESET after the body resolved, and the runner turns that into a file-level failure with no failing assertion to point at.

Same swallow pattern as test/http2-abort.js, applied to all three servers in the file rather than only the one that has been caught, since they have the same shape. The TLS-only secureConnection hook is replaced by connection, because these servers are h2c (createServer, useH2c: true), so secureConnection never fires here.

What I ran

npm run lint clean. test/issue-5087.js on its own, five consecutive runs, 3 passing and 0 failing each time. npm run test:unit gives 1509 tests with 0 failures.

I could not reproduce the failure locally, so I cannot claim the guard was observed catching it: I am on Windows and Node 22, and the log above is macOS and Node 26. What the local runs establish is that the guard does not change any outcome that was already green.

For context on why this one matters beyond the file: the same late-error class in test/http2-request-never-settles.js is currently the only red check on #5663 and #5665, and on #5670.

All three tests abort a request client-side once the timeout fires, so
the server session and its socket can surface a late ECONNRESET after the
test body resolved. The runner reports that as a file-level failure with
no failing assertion, which is what has been happening on CI.

Same swallow pattern nodejs#5674 and nodejs#5686 applied to the neighbouring h2
tests, with connection standing in for the TLS-only secureConnection
hook, because these servers are h2c.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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