Skip to content

Make the upgrade-wrapper E2E marker read tolerant of the detached writer

Placeholder ppxd requested to merge fix/windows-upgrade-wrapper-marker-race into main

Summary

  • Wrapper_DetachedTask_RunsAsSystemAfterWrapperExits intermittently failed with IOException: ... because it is being used by another process (seen once on PR #440 CI, passed on re-run). The detached Task Scheduler inner script writes the identity marker asynchronously; the test waited for the file to exist, then immediately File.ReadAllText'd it — which opens with FileShare.Read and collides with the writer's still-open handle (and could also read a partial/empty file mid-write).
  • Replace the read with ReadMarkerWhenReady: open the marker with FileShare.ReadWrite (don't contend on the writer's handle) and poll until the content is non-empty, within a bounded 30s timeout with an actionable failure message naming the marker path.

Scope

  • Surgical to the test/helper. The other marker-based tests only assert existence, so only this content-read needed the fix.
  • No production change — the marker is a test fixture; production reads upgrade traces from the agent over Halibut RPC, not via a concurrent local File.ReadAllText, so the race does not exist in production code (verified).
  • Windows-only E2E (gated behind OperatingSystem.IsWindows()).

Test plan

  • Squid.WindowsTentacleE2ETests compiles clean cross-platform (the test body skips on non-Windows).
  • Windows E2E CI (WindowsTentacle*E2E) exercises the real path; the fix removes the file-handle contention that caused the intermittent IOException.

Merge request reports

Loading