Repository navigation
Commit 42096ab
Reduce CI test timeout and fix busy-spin in
The `CanAttachScriptWithPathMappings` E2E test intermittently hung
`windows-latest` CI for the full six-hour default — three of the last
eleven `main` runs died this way, all the same test, interspersed with
green runs (a classic flaky race, not a regression). None of the commits
whose runs hung touched the debugger attach path.
The hang mechanism lived in `ReadScriptLogLineAsync`: at EOF
`StreamReader.ReadLineAsync()` completes *synchronously* with `null`, so
the `while`/`await` polling loop never actually yielded. It busy-spun one
CPU at 100%, which starved the scheduler so none of the existing
cooperative safety nets — xUnit's `[SkippableFact(Timeout = 15000)]`, the
30s `debugTaskCts`, or `WaitForExitAsync` — could ever schedule their
continuations. A flaky few-second race thus escalated into a six-hour
wedge. Ironically the busy-loop landed in #2208, a PR meant to reduce
flakiness, and lay dormant until #2251 added a Windows-racy attach test
that actually hits the EOF spin.
- Back off with `await Task.Delay(100, token)` on EOF so we yield instead
of busy-spinning, and cap the whole read with a 15s linked CTS that
throws a clear `TimeoutException` naming the log path.
- Add `timeout-minutes: 15` to the `ci` job as a backstop so any future
hang fails in 15 minutes instead of riding GitHub's 6-hour default. A
normal run finishes well under that (Windows, the slowest, is ~12-14m).
The underlying attach race (reflection-based wait for `Debug-Runspace` to
subscribe) is still worth hardening, but it now fails fast instead of
hanging.
Drafted by Copilot (Claude Opus 4.8).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>ReadScriptLogLineAsync
1 parent c3cd6e2 commit 42096ab
2 files changed
Lines changed: 47 additions & 19 deletions
File tree
- .github/workflows
- test/PowerShellEditorServices.Test.E2E
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
223 | 233 | | |
224 | | - | |
| 234 | + | |
225 | 235 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
234 | 251 | | |
235 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
236 | 256 | | |
237 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
238 | 264 | | |
| 265 | + | |
239 | 266 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 267 | + | |
244 | 268 | | |
245 | | - | |
| 269 | + | |
| 270 | + | |
246 | 271 | | |
247 | | - | |
248 | 272 | | |
249 | 273 | | |
250 | 274 | | |
| |||
0 commit comments