Skip to content

Fix environment cleanup when server startup fails - #24167

Closed
mayur-dhavan wants to merge 3 commits into
vitejs:mainfrom
mayur-dhavan:fix-env-cleanup-on-start-failure
Closed

mayur-dhavan wants to merge 3 commits into
vitejs:mainfrom
mayur-dhavan:fix-env-cleanup-on-start-failure

Conversation

@mayur-dhavan

Copy link
Copy Markdown

When one environment fails during server startup, other environments might still be initializing in the background. The cleanup can run before those environments finish, leaving their resources open.

This change waits for all environment initializations to settle before rethrowing the error, so the server can properly clean up everything that was created. Also added a guard in DevEnvironment.close() to handle cases where initialization fails before the plugin container is created, without skipping the rest of the cleanup.

One tradeoff is that if an environment takes too long or gets stuck during initialization, the startup error will also be delayed until it settles.

Copilot AI balanced review requested due to automatic review settings November 20, 2026 13:28

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot added the bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically flagged as likely to be created by a bot, LLM, or agent, and will be automatically closed. These contributions harm the maintenance of the project. Please read our AI policy for more information.

If you believe this is a mistake, please reply to this comment and we will review it.

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

Labels

bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants