fix(vitest-pool-workers): dispose remote proxy sessions on pool close#12682
fix(vitest-pool-workers): dispose remote proxy sessions on pool close#12682dario-piotrowicz merged 5 commits intocloudflare:mainfrom
Conversation
🦋 Changeset detectedLatest commit: a03a842 The changes in this PR will be included in the next version bump. 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 |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
71853d7 to
3413424
Compare
dario-piotrowicz
left a comment
There was a problem hiding this comment.
This is great! Thanks a lot @hiendv! 🫶
I've left two non-blocking minor comments please have a look 🙂🙏
In any case everything else is great for me and I also manually checked this PR prerelease and I can confirm that it fixes the issue perfectly 🙏
petebacondarwin
left a comment
There was a problem hiding this comment.
Before we merge this can someone check it actually works with the real CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API token, since this test will not be run on this forked PR.
petebacondarwin
left a comment
There was a problem hiding this comment.
In any case everything else is great for me and I also manually checked this PR prerelease and I can confirm that it fixes the issue perfectly 🙏
Oh sorry @dario-piotrowicz - I missed this.
|
@hiendv we had some CI issues that got fixed, I think your PR needs to be rebased in order for its CI checks to go green, could you do that? 🙂 (if you prefer I can rebase for you, just let me know 🙂) |
Co-authored-by: Dario Piotrowicz <dario.piotrowicz@gmail.com>
88e0515 to
a03a842
Compare
|
Awesome! Thanks a lot for the contribution @hiendv 🫶 This change will be part of tomorrow's release 🚀 |
Summary
RemoteProxySessionobjects during vitest-pool-workers pool shutdown to prevent hanging processesremoteProxySessionsDataMapfromconfig.tsso it can be iterated and cleared in theclose()handler--reporter=hanging-processto verify no hanging process warning appearsBackground
When a test project uses bindings that require a remote proxy (e.g. AI bindings), the pool creates
RemoteProxySessionobjects that wrap long-running dev worker processes. These sessions were never disposed during pool shutdown, causing vitest processes to hang after tests complete ("prevents Vite server from exiting" symptom).Reproduction
pnpm test run --reporter=hanging-process src/index.test.ts