Repository navigation
Conversation
A progressive direct-play load is one Media3 load task for the whole file, and its retry budget ran from the task's first failure. After a cut that resumed, the next cut minutes later (a proxy reload, an idle reset during a pause) was already past the 90 s window, or past the count-derived bound left by an earlier outage, and failed on its first retry. The player then raised an error and was rebuilt, reopening the file from the start. Each outage now gets its own window and count: a failure after an attempt that loaded at least 1 MiB starts a new one. A backend that trickles a few kilobytes and stalls again stays in the same outage and still runs out of window. HLS keeps the old behaviour, because its segment retries start over. A TLS read failure after progress is now resumable too. Android 10 reports a peer that reset the connection under a read as a bare SSLException, which nothing retried, so such a cut went straight to a player error. The retry log now records every failed direct-play load, with the cause chain's exception classes (plus HTTP status or HTTP/2 reset code) and no messages, which can carry the server's address. Refs Silo-Server#981
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedThis organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing. Next included review available in 18 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
The Evidence section includes policy and integration test output, but no user-facing captures.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
| ) { nowMs() } | ||
| val now = nowMs() | ||
| val outage = outageByLoadTask.compute(loadErrorInfo.loadEventInfo.loadTaskId) { _, current -> | ||
| if (current == null || (resumableDirectPlay && bytesLoaded >= MEDIA_LOAD_OUTAGE_PROGRESS_BYTES)) { |
There was a problem hiding this comment.
Large partial responses can renew the retry window indefinitely
Repeated large partial responses can restart the 90-second window indefinitely, even when failures occur rapidly or at the same endpoint. Renew the window only after 20 seconds, at least 512 KiB, and a different cut endpoint; retain the previous meaningful endpoint across small or zero-byte failures.
Also found in:
android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaLoadRetryPolicy.kt:351-351
Kody rule violation: Renew media retry windows only after meaningful recovery
Prompt for LLM
File android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaLoadRetryPolicy.kt, line 70:
Large partial responses can renew the retry window indefinitely
Renew the outage window only when at least 20 seconds have passed since the previous failure, the attempt delivered at least 512 KiB, and its cut endpoint differs from the previous meaningful cut. Retain the previous meaningful endpoint across small or zero-byte failures. As written, repeated large partial responses can restart the 90-second window indefinitely, even when they fail rapidly or repeatedly stop at the same endpoint.
**Also found in:**
- `android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaLoadRetryPolicy.kt:351-351`
Kody rule violation: [Renew media retry windows only after meaningful recovery](https://kodus.siloserver.org/settings/code-review/1247142403/kody-rules/88d6152c-9f94-438c-a2da-ff2c4746e2ea?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| if (current == null || (resumableDirectPlay && bytesLoaded >= MEDIA_LOAD_OUTAGE_PROGRESS_BYTES)) { | ||
| MediaLoadOutage(startedAtMs = now, failures = 1) |
There was a problem hiding this comment.
Low-bitrate resumed streams still fail on later disconnects
A second disconnect after 90 seconds can fail immediately even when playback resumed successfully, because transfers under 1 MiB retain the first outage's timestamp. Account for sustained progress over time as well as MEDIA_LOAD_OUTAGE_PROGRESS_BYTES when identifying a new outage.
Prompt for LLM
File android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/MediaLoadRetryPolicy.kt, lines 70-71:
Low-bitrate resumed streams still fail on later disconnects
A resumed stream that transfers less than 1 MiB before a later disconnect retains the first outage's timestamp, so a second cut after 90 seconds fails immediately even if playback ran successfully between cuts. Account for sustained progress over time as well as the per-attempt byte threshold when identifying a new outage.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
A failure started a new retry window after any attempt that loaded 1 MiB. A load that keeps dying at the same byte re-reads from the extractor's position on each retry, so it could load that much every time and retry forever. Start a new outage only when the attempt ran at least 20 s past the previous failure, loaded at least 512 KiB, and was cut somewhere else than where the outage began. The lower threshold also lets low-bitrate streams recover. Refs Silo-Server#981
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
Related issue: #981
Validation tasks: changes #7 and #8 Resilience ("mid-stream drop → auto-resume"), not yet validated
Other clients: Apple N/A (reads in bounded ranges and has its own retry code); Roku N/A (separate player stack, no shared retry policy); Web N/A (browser player, no client retry policy)
On Android TV and phone, direct play survived only the first dropped connection in a playback. When a later drop came minutes after a successful resume, such as a reverse proxy reloading or an idle reset during a pause, the app gave up on its first retry. It showed a player error, rebuilt the player and reopened the file from the start. Users see a spinner and a restart where playback should carry on from the next byte.
A direct-play file is a single Media3 load for the whole movie, and the 90 s retry window was measured from that load's first failure. A cut eleven minutes after a resumed one was already outside the window, which is the
retry exhausted … attempt=2line in the issue's second report. A load that had ridden out a long outage earlier could also still be at its retry-count limit when the next cut came.Approach
Each outage now gets its own retry window and count. On direct play, a failure after an attempt that loaded at least 1 MiB starts a new outage. A backend that sends a few kilobytes and stalls again stays in the same outage, so it still gives up after 90 s. HLS keeps its current behaviour, because a segment retry starts over from the segment's first byte.
A TLS read failure after progress is now resumable, like an HTTP/2 stream reset. Android can report a peer that reset a TLS connection mid-read as a plain
SSLException, which nothing retried. That is the likely cause of the issue's first report, which logged no retry line at all, but it is not confirmed. Handshake failures, such as a rejected certificate, stay fatal. The same rule applies to sidecar subtitle loads, where such a failure now counts against their existing two-extraction budget like a socket reset does.The retry log now covers every failed direct-play load, not only HTTP/2 resets and EOFs. It names the exception classes in the cause chain, with the HTTP status or HTTP/2 reset code where there is one. It does not log exception messages, because they can contain the server address. The next report of this kind will show which exception it was.
This keeps one open-ended request per playback. Reading the file in bounded ranges, as proposed in discussion #980, would also avoid a cut during a long pause, but it is a separate change.
Validation
mainthis ends in a fatal player error; with the fix it plays to the end with no error../gradlew testDebugUnitTest: every module passes except threeFormattersTestcases inandroidApp, which this change does not touch. They fail only because the test machine's locale formats1,0 TB.:android-shared:lintDebug,:androidApp:assembleDebugand:androidTvApp:assembleDebugpass.androidApp/androidTvApplint tasks (no app code changed). Not checked on a TV behind a real proxy reload.Evidence
No screen changes. Playback that used to end in an error now continues. Checked with tests on e8b92d2:
Risks
A direct-play stream that keeps failing after making real progress now keeps retrying. Each retry continues from where the last one stopped, so playback still moves forward. #635 changes the same log line; whichever merges second needs a small rebase.
Checklist
AI Disclosure
Note
Fix direct-play retry policy to resume after a later cut instead of failing
MediaLoadOutagestate model in MediaLoadRetryPolicy.kt. Retry delays now use the outage's own failure count and elapsed time instead of Media3's error count and time since the task's first failure.Throwable.isResumableTransportFailure; handshake failures stay fatal.Throwable.logLabellabels exceptions with HTTP status or HTTP/2 reset codes, and the resume-decision log distinguishes scheduled retries, exhausted retries, and non-retryable failures. Exception messages are no longer logged.Macroscope summarized d47d274.