Skip to content

[Bug] CI: Linux test shards intermittently hang ~15 minutes and are killed, leaving an orphan bun process #1302

Description

@lidge-jun

Client or integration

GitHub Actions — Cross-platform CI (ci.yml), Linux test N/4 shards

Area

Service lifecycle

Summary

Linux test shards intermittently stop producing output mid-run and are killed at the 15-minute job timeout. The run reports cancelled, not failure, so it reads as infrastructure noise — but it is reproducible enough across unrelated branches to be worth tracking rather than rerunning past.

Filing this because I hit it five times today while doing maintainer triage and kept treating it as flake. That was the wrong call: the hang is consistent in shape, and cancelled runs are easy to rerun into green without anyone noticing the underlying problem.

Observed pattern

Every occurrence looks the same:

  1. the shard runs normally for ~30-90 seconds and passes hundreds of tests;
  2. output stops abruptly right after a test that starts a proxy server;
  3. nothing further is logged for ~14 minutes;
  4. the runner cancels at the 15-minute timeout;
  5. cleanup reports Terminate orphan process: pid (NNNN) (bun).

Across four runs on four unrelated branches, the affected shard varies, which argues against a single bad test:

Run Branch Shard Result
31263738953 codex/260808-1185-windows-shard-assertion test 4/4 cancelled (twice, incl. rerun)
31255199569 fix/windows-powershell-popup test 2/4 cancelled, green on retry
31258815611 codex/260808-1195-unbound-quota-unknown test 3/4 cancelled, green on retry
31152916419 agent/test-windows-ci-shard-command test 3/4 failure — EEXIST: epoll_ctl in a Bun WriteStream

It also occurred on dev itself with no PR involved (runs 31259450263, 31259447622), so it is not contributor-branch specific.

The one non-cancelled instance is the useful clue

Run 31152916419 did not hang — it crashed outright while loading tests/autostart-health.test.ts:

# Unhandled error between tests
error: EEXIST: file already exists, epoll_ctl
      at new WriteStream (internal:fs/streams:244:58)
# collateral:
error: Cannot call describe() after the test run has completed

EEXIST from epoll_ctl means a file descriptor was registered with the event loop twice. That is the same class of resource-lifecycle problem a hang would produce if the registration deadlocked instead of erroring, which suggests the hang and the crash are one bug with two outcomes rather than two problems.

Last log line before the stall

In 31263738953 (test 4/4), the final output before 14 minutes of silence:

[web-search-loop] done — 1 search, 2 iterations, 13ms
[web-search-loop] cancelled — 1 real searches, 0 placeholders, 13ms
(pass) routed Claude requests give OpenAI sidecars main auth without leaking it to the routed provider

That test is in tests/claude-messages-endpoint.test.ts, and the stall is after it passes — so the suspect is teardown or the next file's setup, not the assertion. In the other runs the stall also follows a test that had just started a proxy listener.

Not reproducible locally

bun test tests/claude-messages-endpoint.test.ts → 38 pass / 0 fail in 2.7s on macOS. Full bun run test → 10009 pass / 0 fail. So this needs the sharded Linux runner environment; a single-file local run will not show it.

Why this matters beyond the noise

cancelled is not failure, and the natural response is to rerun. That works — three of the four went green on retry. The risk is that a genuine hang introduced by a future change is indistinguishable from this, and gets rerun into green by whoever is on triage that day.

Suggested starting points

  • The orphan is always bun, and the stall always follows a proxy-server test, so an un-awaited server close or an fd registered twice across test-file boundaries is the first place to look.
  • --isolate is already used; whether shard boundaries share any process-global listener state is worth checking.
  • Raising the timeout would hide it. A shard that stops emitting for 14 minutes has already failed.

Version

dev at 14e948525.

Operating system

ubuntu-latest GitHub-hosted runners.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserviceService lifecycle (WinSW/launchd/scheduler)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions