Skip to content

[vitest-pool-workers] Ignore workerd's ungraceful TLS disconnect exception logs - #14821

Merged
dario-piotrowicz merged 1 commit into
cloudflare:mainfrom
mishushakov:vitest-pool-ignore-tls-disconnect
Jul 24, 2026
Merged

[vitest-pool-workers] Ignore workerd's ungraceful TLS disconnect exception logs#14821
dario-piotrowicz merged 1 commit into
cloudflare:mainfrom
mishushakov:vitest-pool-ignore-tls-disconnect

Conversation

@mishushakov

@mishushakov mishushakov commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #14820.

When tests make real fetch() calls to external HTTPS endpoints, servers and load balancers routinely close idle keepalive connections without sending a TLS close_notify. No request fails — the connection is idle, and undici/Bun/Deno silently discard the same event — but workerd logs a kj/compat/tls.c++:429: disconnected: peer disconnected without gracefully ending TLS session exception with a full unsymbolized stack trace each time, flooding otherwise green runs (real-world example: 10+ occurrences in a passing 393-test suite).

Since the pool installs its own handleStructuredLogs and users can't override Miniflare's log handling from the vitest config, the only place to filter this is the pool's ignoreMessages list — which already suppresses the equivalent non-TLS shapes (disconnected: operation canceled, disconnected: WebSocket peer disconnected, …) as "normal operation". This PR adds the TLS variant to the same list, plus a changeset.

Note on the accompanying stack: line: workerd's JsonLogger::logMessage emits one JSON log entry per kj log call, and kj's exception stringifier includes \nstack: … in the same string, so the exception text and its stack trace arrive as a single structured message — the substring match filters both together, same as the existing disconnected: … entries.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows: verified the exact message captured from the CI log above matches the new ignoreMessages entry via the existing .includes() filter (and that unrelated warnings/exception shapes don't); ran the E2B SDK's full 393-test workerd suite against a locally patched pool dist — all green with no change in other output. The TLS disconnect event itself is environment-dependent (triggered reliably on GitHub Actions runners, not on a local network), so an end-to-end assertion isn't practical.
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: no user-facing behavior change beyond removing non-actionable log noise.

🤖 Generated with Claude Code

…ption logs

Servers and load balancers routinely close idle keepalive connections
without sending a TLS close_notify. Nothing fails — the connection is
idle — but workerd logs a kj/compat/tls.c++ exception with a full stack
trace each time, flooding green runs of any suite that fetches real
HTTPS endpoints. Filter it like the other non-actionable
"disconnected: ..." messages already in ignoreMessages.

Fixes cloudflare#14820

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: adc9090

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team July 23, 2026 15:07
@workers-devprod

workers-devprod commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14821

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14821

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14821

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14821

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14821

miniflare

npm i https://pkg.pr.new/miniflare@14821

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14821

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14821

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14821

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14821

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14821

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14821

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14821

wrangler

npm i https://pkg.pr.new/wrangler@14821

commit: adc9090

@dario-piotrowicz dario-piotrowicz 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.

Looks good to me! Thanks for the fix @mishushakov! 🫶

(Also I hope this extra log hasn't been too annoying for you, sorry about that 🥹)

I'm merging your PR right away, the fix should be out with the next vitest-pool-workers package release on Tuesday 🙂

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jul 24, 2026
@dario-piotrowicz
dario-piotrowicz merged commit edc203e into cloudflare:main Jul 24, 2026
78 of 82 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

3 participants