Skip to content

Commit 6110b3a

Browse files
committed
Fix race condition in doctor command provider check
The provider match check was running in parallel with provider detection, causing intermittent failures where Docker was reported as not installed even though it was. Root cause: - checkPrerequisites() and checkVvvInstallation() ran in parallel - checkPrerequisites() populates ctx.availableProviders - checkVvvInstallation() reads ctx.availableProviders - Race condition: sometimes checkVvvInstallation() read before checkPrerequisites() wrote, seeing empty array Fix: - Run checkPrerequisites() first to populate ctx.availableProviders - Then run checkVvvInstallation() and checkConfiguration() in parallel - Both can now safely read ctx.availableProviders - Maintains parallelization where possible Impact: - Consistent provider detection across all runs - No more false "docker not installed" errors - Still maintains good performance with partial parallelization
1 parent 7167c51 commit 6110b3a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/commands/doctor.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,18 +720,22 @@ async function runAllChecks(vvvPath: string): Promise<CheckResult[]> {
720720
const results: CheckResult[] = [];
721721
let phaseStart: number;
722722

723-
// Phase 1: Run independent checks in parallel
723+
// Phase 1: Prerequisites first (needed to populate ctx.availableProviders)
724724
phaseStart = Date.now();
725725
cli.info("Running initial checks...");
726-
verbose("Running prerequisite, installation, and configuration checks in parallel...");
726+
verbose("Checking prerequisites...");
727727

728-
const [prereqResults, vvvResults, configResults] = await Promise.all([
729-
checkPrerequisites(ctx),
728+
const prereqResults = await checkPrerequisites(ctx);
729+
results.push(...prereqResults);
730+
731+
// Now run VVV installation and configuration checks in parallel (they can use ctx.availableProviders)
732+
verbose("Checking VVV installation and configuration in parallel...");
733+
const [vvvResults, configResults] = await Promise.all([
730734
checkVvvInstallation(ctx),
731735
checkConfiguration(ctx),
732736
]);
733737

734-
results.push(...prereqResults, ...vvvResults, ...configResults);
738+
results.push(...vvvResults, ...configResults);
735739
showPhaseProgress("Initial Checks", [...prereqResults, ...vvvResults, ...configResults], phaseStart);
736740

737741
// Phase 2: VM State (determines if we can continue with VM-dependent checks)

0 commit comments

Comments
 (0)