Skip to content

test(e2e): de-flake the downstream idle-timeout suite's stale-pool race - #824

Merged
jarvis9443 merged 2 commits into
mainfrom
fix/downstream-idle-e2e-stale-pool
Jul 27, 2026
Merged

test(e2e): de-flake the downstream idle-timeout suite's stale-pool race#824
jarvis9443 merged 2 commits into
mainfrom
fix/downstream-idle-e2e-stale-pool

Conversation

@jarvis9443

Copy link
Copy Markdown
Contributor

The idle-timeout describe (#813, AISIX-Cloud#1126) sets a 2s server idle deadline while its probe + assertions share the default global fetch pool. A keep-alive socket left idle by the beforeAll propagation probe can be FIN'd by the gateway at the very moment the "request in flight past the idle timeout still completes" test reuses it — a client-pool race that surfaces as TypeError: fetch failed / SocketError: other side closed (the serialized error's bytesRead: 1078 shows the socket had already served a response). First seen failing on PR #822's e2e run (job 89900299932), where the diff touches nothing on this path.

Fix: the suite routes its requests through a dedicated undici Agent with keepAliveTimeout: 500ms — client-side idle discard well inside the 2s server deadline, so a pooled socket is never reused in the window where the server may be closing it. Assertions stay about the gateway's behavior; the SSE-heartbeat describe is untouched (it configures no idle timeout).

Verified locally: the file passes 3/3 consecutive runs against a real binary + etcd; tsc --noEmit clean.

The idle-timeout describe configures a 2s server idle deadline, but its
probe and assertions shared Node's default global fetch pool: a
keep-alive socket left idle by the beforeAll propagation probe could be
FIN'd by the gateway at the exact moment the in-flight test reused it,
surfacing as a flaky "SocketError: other side closed" (seen on CI in
run 30241681106). That is precisely the stale-connection race the
feature exists to document — but the test should assert the gateway's
behavior, not lose a race in the client pool.

The suite now routes its requests through a dedicated undici Agent
whose keepAliveTimeout (0.5s) sits well inside the server deadline
(2s), so the client never reuses a socket the server might be closing.
The SSE-heartbeat describe is untouched — it configures no idle
timeout, so its pooled connections are safe.
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a4dbcf82-006c-4816-ae32-3ce5681ed5b6

📥 Commits

Reviewing files that changed from the base of the PR and between a4b4681 and 439fad4.

📒 Files selected for processing (1)
  • tests/e2e/src/cases/downstream-connection-e2e.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/downstream-idle-e2e-stale-pool

Comment @coderabbitai help to get the list of available commands.

A local dependency install generated tests/e2e/pnpm-workspace.yaml and
the previous commit swept it in; its empty packages field breaks
'pnpm install' on CI. The e2e suite is not a workspace.
@jarvis9443
jarvis9443 merged commit 741f7bc into main Jul 27, 2026
11 checks passed
@jarvis9443
jarvis9443 deleted the fix/downstream-idle-e2e-stale-pool branch July 27, 2026 06:30
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.

1 participant