Skip to content

A timed-out request is sent three more times at the full timeout, up to eight minutes before an error #438

Description

@DevEmperor

Split out of #437, from the same email: after a WhatsApp call, the reporter's spinner had been
running for about 700 s.

The arithmetic

executeForBody(maxRetries = 3) retries every kind for which isRetryable is true (TIMEOUT,
NETWORK, SERVER_ERROR and UNKNOWN), with RETRY_DELAY_MS = 3000 between attempts. For a
dictation, the per-operation and the whole-call timeout are both the user's Request timeout
(default 120 s). So a connection that stalls costs this much, whether the network changed under an
upload or the phone went into a call:

4 × 120 s + 3 × 3 s  =  489 s  ≈  8 minutes

With the timeout raised to 180 s, it is about 12 minutes. Soniox and AssemblyAI poll on their own
5-minute budget on top of that.

A retry earns its keep after an error that came fast: a refused connection, a reset, a 502. That is
what the retries are for, and each one costs seconds. A full-length timeout is a different thing. The
budget the user chose is already spent, and repeating it three times multiplies the wait they asked
for by four. #363 is the same pattern on the watch.

Being offline is not the problem. DNS fails at once there, and the error arrives after about 9 s. The
problem is a connection that stalls.

What to change

  1. Make a timeout that used the whole budget terminal, and let fast transport errors keep their
    three retries. That needs executeForBody to tell "timed out" apart from "failed quickly". The
    attempt's elapsed time is already measured (startedNanos). After the error, the resend chip is
    the retry, and the user decides whether to wait another round.
  2. Worth checking: when the active network drops or changes during a request
    (ConnectivityManager.NetworkCallback), cancel the stalled call and retry once on the new network
    straight away instead of waiting out the read timeout. If it was the call that moved the
    connection, that is what would have helped in the reported case.
  3. The file import keeps its own budgets (Suggested Optional UI Enhancement: Step-by-Step Video/Audio Transcription Progress #337). This issue is about dictation, rewording and the
    other calls that use Request timeout.

Related

#354/#355 (real timeout, elapsed seconds), #337 (the app's timeout map), #363 (the watch's version of
this).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions