[GH-ISSUE #5657] Client hangs forever against a frozen server: no timeouts, no unreachable state #3134

Closed
opened 2026-10-21 05:59:52 +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/5657

Originally assigned to: @kolacheee on GitHub.

What happens

When the server stops responding but connections still open — exactly what a frozen Termux host looks like (the kernel accepts the TCP connection; the frozen process never reads it) — the client hangs forever with no explanation:

  • Opening a chat shows the "Opening chat…" spinner indefinitely: the chat fetch is a bare fetch with no timeout, so it never rejects and the error branch ("Could not open this chat") never runs.
  • The diagnostics panel renders "Unavailable" for every server field with no hint whether that means timeout, refusal, or anything else.

A Termux user reproduced this for 20+ seconds and had no signal about what was wrong; foregrounding Termux fixed it instantly. This is now a realistic everyday state on freezer-aggressive Android devices (see the background-freeze triage and #4956).

The fix

  • Add AbortSignal.timeout (~15–20s) to the chat-open fetch (useChat in packages/client/src/hooks/use-chats.ts) and the diagnostics /health query.
  • On timeout, show an explicit unreachable state instead of the spinner: "Server unreachable — if you host in Termux, bring Termux to the foreground and check its battery settings." The client can scope the Termux wording to Android + loopback — keep-alive.ts already computes exactly that predicate.
  • Diagnostics should render "Unreachable (timed out)" rather than the ambiguous "Unavailable".

Try it yourself

kill -STOP the server process (a faithful stand-in for the Android freezer), then open a chat and the diagnostics panel: infinite spinner, unlabeled "Unavailable", no guidance. kill -CONT recovers instantly.

Related: the checkVersion pending-fetch leak against a frozen server is filed separately — it can wedge even requests that do carry timeouts.

Originally created by @kolacheee on GitHub (Aug 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5657 Originally assigned to: @kolacheee on GitHub. **What happens** When the server stops responding but connections still open — exactly what a frozen Termux host looks like (the kernel accepts the TCP connection; the frozen process never reads it) — the client hangs forever with no explanation: - Opening a chat shows the "Opening chat…" spinner indefinitely: the chat fetch is a bare `fetch` with no timeout, so it never rejects and the error branch ("Could not open this chat") never runs. - The diagnostics panel renders "Unavailable" for every server field with no hint whether that means timeout, refusal, or anything else. A Termux user reproduced this for 20+ seconds and had no signal about what was wrong; foregrounding Termux fixed it instantly. This is now a realistic everyday state on freezer-aggressive Android devices (see the background-freeze triage and #4956). **The fix** - Add `AbortSignal.timeout` (~15–20s) to the chat-open fetch (`useChat` in `packages/client/src/hooks/use-chats.ts`) and the diagnostics `/health` query. - On timeout, show an explicit unreachable state instead of the spinner: "Server unreachable — if you host in Termux, bring Termux to the foreground and check its battery settings." The client can scope the Termux wording to Android + loopback — `keep-alive.ts` already computes exactly that predicate. - Diagnostics should render "Unreachable (timed out)" rather than the ambiguous "Unavailable". **Try it yourself** `kill -STOP` the server process (a faithful stand-in for the Android freezer), then open a chat and the diagnostics panel: infinite spinner, unlabeled "Unavailable", no guidance. `kill -CONT` recovers instantly. Related: the `checkVersion` pending-fetch leak against a frozen server is filed separately — it can wedge even requests that do carry timeouts.
bsakaguchi 2026-10-21 05:59:52 +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:5465584243 --> @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 #5658 (kolacheee + Claude agent) on branch fix/5657-5658-unreachable-server; draft PR to follow.

<!-- gh-comment-id:5465829858 --> @kolacheee commented on GitHub (Aug 30, 2026): Taking this together with #5658 (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#3134
No description provided.