test(e2e): de-flake the downstream idle-timeout suite's stale-pool race - #824
Conversation
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.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
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
beforeAllpropagation 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 asTypeError: fetch failed / SocketError: other side closed(the serialized error'sbytesRead: 1078shows 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
AgentwithkeepAliveTimeout: 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 --noEmitclean.