-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[vite-plugin] Dispose remote proxy sessions when the server closes #15269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@cloudflare/vite-plugin": patch | ||
| --- | ||
|
|
||
| Fix `vite build` hanging when `remoteBindings` is enabled | ||
|
|
||
| With `remoteBindings` enabled, `vite build` produced all of its output but then never exited, so builds had to be killed manually and could not complete in CI. Builds using remote bindings now finish and exit as expected. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,10 @@ import { | |
| compareWorkerNameToExportTypesMaps, | ||
| getCurrentWorkerNameToExportTypesMap, | ||
| } from "../export-types"; | ||
| import { getDevMiniflareOptions } from "../miniflare-options"; | ||
| import { | ||
| disposeRemoteProxySessions, | ||
| getDevMiniflareOptions, | ||
| } from "../miniflare-options"; | ||
| import { UNKNOWN_HOST } from "../shared"; | ||
| import { | ||
| createPlugin, | ||
|
|
@@ -84,6 +87,7 @@ export const devPlugin = createPlugin("dev", (ctx) => { | |
| } catch (error) { | ||
| debuglog("Failed to dispose Miniflare instance:", error); | ||
| } | ||
| await disposeRemoteProxySessions(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if this throws?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would have failed
|
||
| } | ||
| } | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to only clear this map after we're certain that the session disposition call passed for all sessions?
That way we could even add retries if it does fail for whatever reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The previous version copied the values and cleared the map first, so a failed
dispose()left a listening handle with nothing to retry against.Pushed a531542: the map entry is deleted only after
session.dispose()resolves. A later close, or a subsequent start that still reads the map, can retry. Added a test that rejects the first dispose and checks the session is still passed through as pre-existing.