Skip to content

Backport gzip I/O retry logic and redirected-input console guard to release/10.0.4xx#54400

Merged
marcpopMSFT merged 2 commits into
release/10.0.4xxfrom
copilot/backport-gzip-change-again
May 28, 2026
Merged

Backport gzip I/O retry logic and redirected-input console guard to release/10.0.4xx#54400
marcpopMSFT merged 2 commits into
release/10.0.4xxfrom
copilot/backport-gzip-change-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Two transient-failure paths from main (#53424) were missing from the servicing branch.

Changes

  • GZipCompress.cs — replaces bare try/catch with a bounded retry loop (3 attempts, 200ms × attempt backoff) that retries only IOException, covering transient file locks from antivirus/indexers on CI machines:

    catch (IOException) when (attempt < MaxRetries)
    {
        Log.LogMessage(MessageImportance.Low,
            "Retrying compression of '{0}' (attempt {1}/{2}) due to transient I/O error.",
            file.ItemSpec, attempt, MaxRetries);
        Thread.Sleep(RetryDelayMs * attempt);
    }
  • PhysicalConsole.cs — gates ListenToConsoleKeyPressAsync() behind !Console.IsInputRedirected, preventing Console.ReadKey from blocking/throwing in redirected-stdin environments:

    if (testFlags.HasFlag(TestFlags.ReadKeyFromStdin))
        _ = ListenToStandardInputAsync();
    else if (!Console.IsInputRedirected)
        _ = ListenToConsoleKeyPressAsync();

Copilot AI and others added 2 commits May 20, 2026 22:11
@marcpopMSFT
Copy link
Copy Markdown
Member

@MichaelSimons per #54277, I asked copilot which changes from Matt's test stability PR to backport and it chose these two. 4xx doesn't require tactics so should be reasonable to backport. We'd have to consider risk more closely for a 1xx backport.

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

Backports two reliability fixes from main into release/10.0.4xx: (1) bounded retry logic around gzip compression to reduce transient CI flakiness, and (2) avoiding Console.ReadKey in redirected-stdin scenarios to prevent hangs/exceptions.

Changes:

  • Add bounded IOException retry loop with backoff to GZipCompress compression work.
  • Gate ListenToConsoleKeyPressAsync() behind !Console.IsInputRedirected in PhysicalConsole.
  • (Unrelated) Modify Microsoft.CodeAnalysis.NetAnalyzers.sarif formatting/encoding.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif Unrelated formatting/encoding-only change; likely should be excluded from this backport.
src/Dotnet.Watch/Watch/UI/PhysicalConsole.cs Avoids Console.ReadKey when stdin is redirected, but currently also drops Ctrl+C handling in that scenario.
src/BlazorWasmSdk/Tasks/GZipCompress.cs Adds bounded retry/backoff around gzip I/O to mitigate transient IOException flakiness.

Comment thread src/Dotnet.Watch/Watch/UI/PhysicalConsole.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants