Skip to content

Skip Inno spawn when another instance is already installing#318486

Open
dmitrivMS wants to merge 14 commits into
mainfrom
dev/dmitriv/update-conflict
Open

Skip Inno spawn when another instance is already installing#318486
dmitrivMS wants to merge 14 commits into
mainfrom
dev/dmitriv/update-conflict

Conversation

@dmitrivMS
Copy link
Copy Markdown
Contributor

@dmitrivMS dmitrivMS commented May 27, 2026

Fixes #62476

Problem

When two VS Code Insiders instances are running against the same install (for example a normal instance plus one started with --transient) and an update becomes available, both instances independently progress through the update state machine to doApplyUpdate for the same downloaded CodeSetup-*.exe and each spawn Inno Setup.

The second spawn races into Inno's built-in "Setup is already running" modal, because Inno protects itself with a global per-install mutex.

Fix

In updateService.win32.ts doApplyUpdate, check the existing ${win32MutexName}-updating Windows named mutex (already held by the running Inno Setup process) before spawning. If another instance is already running setup for this install:

  • Skip the spawn.
  • Do not track an updateProcess (we must not kill the other instance's installer if the user cancels here).
  • Keep the existing -ready mutex polling loop running so this instance still transitions Updating → Ready when the other instance's install finishes.

The existing 1-hour cancelTimeout continues to act as the safety net if the other instance crashes mid-install.

Notes

  • All filesystem coordination (flag file, cancel file, progress file, cache path) is already shared between instances, so the non-spawning instance still observes the same install correctly.
  • A tiny residual race remains (both isActive checks return false before either process actually grabs the mutex), but the reported scenario — one instance already mid-install when the other tries to start — is handled.
  • No new dependency: reuses @vscode/windows-mutex already imported a few lines down for -ready.

Two VS Code instances (e.g. a normal one plus one started with --transient) sharing the same install can both reach doApplyUpdate for the same downloaded package and each spawn Inno Setup. The second spawn races into Inno's 'Setup is already running' modal.

Check the existing '<mutex>-updating' mutex before spawning. If another instance is already running setup, skip the spawn and rely on the existing '-ready' mutex polling loop to transition this instance to Ready when the install finishes.
Copilot AI review requested due to automatic review settings May 27, 2026 01:44
@dmitrivMS dmitrivMS added the install-update VS Code installation and upgrade system issues label May 27, 2026
@dmitrivMS dmitrivMS self-assigned this May 27, 2026
@dmitrivMS dmitrivMS changed the title fix(update): skip Inno spawn when another instance is already installing Skip Inno spawn when another instance is already installing May 27, 2026
@dmitrivMS dmitrivMS requested a review from deepak1556 May 27, 2026 01:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Prevents multiple VS Code instances sharing the same Windows installation from spawning a second Inno Setup installer during a background update, avoiding Inno’s “Setup is already running” modal by checking the existing *-updating named mutex before spawning.

Changes:

  • Adds an -updating mutex pre-check in doApplyUpdate to detect an already-running installer.
  • Skips spawning and process tracking when another instance is already installing, relying on existing -ready mutex polling to advance state.
  • Logs when installation is delegated to another instance.
Show a summary per file
File Description
src/vs/platform/update/electron-main/updateService.win32.ts Adds -updating mutex check to avoid spawning a second Inno Setup installer and continues readiness polling.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/vs/platform/update/electron-main/updateService.win32.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/vs/platform/update/electron-main/updateService.win32.ts Outdated
dmitrivMS and others added 2 commits May 27, 2026 10:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread src/vs/platform/update/electron-main/updateService.win32.ts
Comment thread src/vs/platform/update/electron-main/updateService.win32.ts Outdated
Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/vs/platform/update/electron-main/updateService.win32.ts Outdated
@dmitrivMS dmitrivMS requested a review from Copilot May 27, 2026 19:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread src/vs/platform/update/electron-main/updateService.win32.ts
@dmitrivMS dmitrivMS added the windows VS Code on Windows issues label May 27, 2026
@dmitrivMS dmitrivMS marked this pull request as ready for review May 28, 2026 00:42
@dmitrivMS dmitrivMS enabled auto-merge (squash) May 28, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

install-update VS Code installation and upgrade system issues windows VS Code on Windows issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup has detected that setup is currently running

2 participants