[GH-ISSUE #5658] checkVersion leaks a pending health fetch per visibility flip, saturating the browser connection pool #3135

Closed
opened 2026-10-21 05:59:54 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Aug 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5658

Originally assigned to: @kolacheee on GitHub.

What happens

checkVersion in packages/client/src/App.tsx fires a /api/health fetch with no timeout and no in-flight guard, and it runs on every visibility change. Against a frozen server (connections accepted, never answered — the Android/Termux freezer state we just triaged), each tab-switch to the app leaks one more permanently-pending fetch.

Firefox caps ~6 concurrent connections per host, so a few visibility flips while the server is frozen saturate the pool — at which point even the requests that do carry timeouts (the 10s loopback keep-alive heartbeat, any user-triggered fetches) queue behind dead connections and stop behaving. The client's degraded state gets progressively worse the more the user pokes at it, which matches how the field report described it.

The fix

Give checkVersion an in-flight guard (skip if the previous check hasn't settled) and an AbortSignal.timeout. Both are a few lines.

Try it yourself

kill -STOP the server, then switch away from and back to the app tab several times with the network panel open: one pending /api/health per flip, never settling. kill -CONT releases them all at once.

Found during the Termux background-freeze triage; the general unreachable-state UX is filed separately.

Originally created by @kolacheee on GitHub (Aug 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5658 Originally assigned to: @kolacheee on GitHub. **What happens** `checkVersion` in `packages/client/src/App.tsx` fires a `/api/health` fetch with **no timeout and no in-flight guard**, and it runs on every visibility change. Against a frozen server (connections accepted, never answered — the Android/Termux freezer state we just triaged), each tab-switch to the app leaks one more permanently-pending fetch. Firefox caps ~6 concurrent connections per host, so a few visibility flips while the server is frozen saturate the pool — at which point **even the requests that do carry timeouts** (the 10s loopback keep-alive heartbeat, any user-triggered fetches) queue behind dead connections and stop behaving. The client's degraded state gets progressively worse the more the user pokes at it, which matches how the field report described it. **The fix** Give `checkVersion` an in-flight guard (skip if the previous check hasn't settled) and an `AbortSignal.timeout`. Both are a few lines. **Try it yourself** `kill -STOP` the server, then switch away from and back to the app tab several times with the network panel open: one pending `/api/health` per flip, never settling. `kill -CONT` releases them all at once. Found during the Termux background-freeze triage; the general unreachable-state UX is filed separately.
bsakaguchi 2026-10-21 05:59:54 +07:00
Author
Owner

@kolacheee commented on GitHub (Aug 29, 2026):

Termux background-freeze follow-up family (from the 2026-08-30 triage; verdict: the battery-efficiency waves removed the ambient polling that had kept vendor freezers from classifying backgrounded Termux as dormant — see #4956 for the first field report): #5655 server freeze detector, #5656 wake-lock surfacing, #5657 client unreachable-state UX, #5658 checkVersion fetch leak, #5659 TROUBLESHOOTING corrections.

<!-- gh-comment-id:5465584322 --> @kolacheee commented on GitHub (Aug 29, 2026): Termux background-freeze follow-up family (from the 2026-08-30 triage; verdict: the battery-efficiency waves removed the ambient polling that had kept vendor freezers from classifying backgrounded Termux as dormant — see #4956 for the first field report): #5655 server freeze detector, #5656 wake-lock surfacing, #5657 client unreachable-state UX, #5658 checkVersion fetch leak, #5659 TROUBLESHOOTING corrections.
Author
Owner

@kolacheee commented on GitHub (Aug 30, 2026):

Taking this together with #5657 (kolacheee + Claude agent) on branch fix/5657-5658-unreachable-server; draft PR to follow.

<!-- gh-comment-id:5465829947 --> @kolacheee commented on GitHub (Aug 30, 2026): Taking this together with #5657 (kolacheee + Claude agent) on branch fix/5657-5658-unreachable-server; draft PR to follow.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3135
No description provided.