Skip to content

fix(storage): widen the Windows ADS query timeout for cold Add-Type compiles - #4041

Merged
Astro-Han merged 1 commit into
apache:mainfrom
liuxiaocs7:fix/windows-ads-cold-compile-timeout
Aug 27, 2026
Merged

fix(storage): widen the Windows ADS query timeout for cold Add-Type compiles#4041
Astro-Han merged 1 commit into
apache:mainfrom
liuxiaocs7:fix/windows-ads-cold-compile-timeout

Conversation

@liuxiaocs7

Copy link
Copy Markdown
Member

Summary

The managed-dependency alternate-stream guard (assertNoWindowsAlternateStreams in packages/storage/src/managed-dependency-environment.ts) spawns a fresh powershell.exe per query that JIT-compiles the FindFirstStreamW P/Invoke helper via Add-Type. On a cold GitHub-hosted Windows runner that first compile — a cold csc.exe launch plus .NET Framework warmup — was observed at ~31s, tripping the 30s WINDOWS_STREAM_QUERY_TIMEOUT_MS. It then rejected with Timed out querying Windows alternate data streams, which is the wrong error for the test's assert.rejects, so the "rejects an NTFS alternate stream created inside a dependency artifact" subtest failed. The next two subtests reused the now-warm compiler and passed in 2–4s.

This flaked the unfiltered main-push Windows recovery lane (run 33096120938) even though the triggering commit only touched desktop tests. The lane had been green for the prior ~4 hours; the ADS code itself was unchanged since #3789.

The tree walk feeding the query is bounded and non-recursive, so the query cannot hang — the timeout exists only to bound a wedged interpreter. This raises it to 120s so the one-time cold compile has generous headroom rather than being misreported as a wedge. The 45-minute job budget still bounds a true hang. I kept the P/Invoke design (which deliberately replaced the recursive Get-Item -Stream walk) rather than rewrite a security boundary; the cold compile is the sole ~30s cost.

Refs #3789

Verification

  • Change is a single constant widening (30_000120_000) plus an explanatory comment; no behavioral change to the query or its callers.
  • No deterministic regression test accompanies it: the failure is a runner-cold-start timing artifact, not a logic bug, so there is no input that fails at 30s but passes at 120s on a warm machine. The existing three Windows ADS subtests continue to assert correctness; this only removes their cold-start flake.
  • Note on local checks: tsc/suite runs could not be executed in my environment because dependencies are not installed (@types/node absent). CI (test + Windows recovery) will exercise the build and the affected Windows suite.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code diagnosed the failing run and authored the one-line timeout change and its comment. Commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

…ompiles

The managed-dependency alternate-stream guard spawns a fresh powershell.exe
per query that JIT-compiles the FindFirstStreamW P/Invoke helper via
`Add-Type`. On a cold GitHub-hosted Windows runner that first compile — a
cold csc.exe launch plus .NET Framework warmup — has been observed at ~31s,
tripping the 30s WINDOWS_STREAM_QUERY_TIMEOUT_MS and rejecting with "Timed
out querying Windows alternate data streams". That is the wrong error for
the test's assert.rejects, so the "rejects an NTFS alternate stream created
inside a dependency artifact" subtest failed; the following two subtests
reused the now-warm compiler and passed in 2-4s. This flaked the unfiltered
main-push Windows recovery lane (run 33096120938) even though the triggering
commit only touched desktop tests.

The tree walk is bounded and non-recursive, so the query cannot hang; the
timeout exists only to bound a wedged interpreter. Raise it to 120s so the
one-time cold compile has generous headroom rather than being misreported as
a wedge. The 45-minute job budget still bounds a true hang.

Refs apache#3789

Generated-by: Claude Code
@github-actions github-actions Bot added the effort/XS Under 10 readable lines label Aug 27, 2026

@Astro-Han Astro-Han 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.

LGTM.

@Astro-Han
Astro-Han merged commit ac08865 into apache:main Aug 27, 2026
3 checks passed
saltand pushed a commit to saltand/maka-agent that referenced this pull request Aug 31, 2026
…ompiles (apache#4041)

The managed-dependency alternate-stream guard spawns a fresh powershell.exe
per query that JIT-compiles the FindFirstStreamW P/Invoke helper via
`Add-Type`. On a cold GitHub-hosted Windows runner that first compile — a
cold csc.exe launch plus .NET Framework warmup — has been observed at ~31s,
tripping the 30s WINDOWS_STREAM_QUERY_TIMEOUT_MS and rejecting with "Timed
out querying Windows alternate data streams". That is the wrong error for
the test's assert.rejects, so the "rejects an NTFS alternate stream created
inside a dependency artifact" subtest failed; the following two subtests
reused the now-warm compiler and passed in 2-4s. This flaked the unfiltered
main-push Windows recovery lane (run 33096120938) even though the triggering
commit only touched desktop tests.

The tree walk is bounded and non-recursive, so the query cannot hang; the
timeout exists only to bound a wedged interpreter. Raise it to 120s so the
one-time cold compile has generous headroom rather than being misreported as
a wedge. The 45-minute job budget still bounds a true hang.

Refs apache#3789

Generated-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XS Under 10 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants