nhddhr 0 Posted 2 hours ago Posted 2 hours ago Environment - Server: Emby Server 4.10.2.0 (docker, host networking), item played as direct play (static file stream) - Client: Emby for Android TV 2.1.54g (ExoPlayer) on Sony KD-55X9000H - Timestamps below are UTC, taken from embyserver.txt Summary When a client disappears without sending /Sessions/Playing/Stopped (e.g. the TV is powered off at the mains), the session is ended ~60 s later by the "has gone idle while playing" reaper. The position written to the item's resume point at that moment is NOT the last client-reported position — it closely tracks the lifetime of the HTTP stream, which includes the TCP half-open linger (up to ~25 min with default tcp_retries2=15). The accurate last-reported position is demonstrably available to the server, but gets overwritten by the inflated estimate. Result: the resume point is systematically pushed forward by 20–40 minutes past what was actually watched. Controlled test (watched ~1.5 minutes, then mains power cut) 05:41:41.810 SessionManager: Playback start reported by app AndroidTv 2.1.54g on SONY KD-55X9000H playing Warcraft. Position: 0 ms. PlaySessionId: de99a5e4837e4936bf279a029ced5e85 05:43:10 client powered off at the wall (no graceful close, no Stopped request) 05:55:31 item API: PlaybackPositionTicks = 915190000 (91.5 s — the last client-reported position, accurate) 06:08:52.773 VideoService: http/1.1 Response completed after client disconnected ... Time: 1630099 ms (TCP send finally failed on kernel retransmission timeout, tcp_retries2 = 15 — connection was half-open for ~26 min) 06:09:52.675 SessionManager: PlaySession de99a5e4837e4936bf279a029ced5e85 has gone idle while playing (exactly 60 s after the stream died) 06:09:52.675 SessionManager: Playback stopped reported by app AndroidTv 2.1.54g ... Position: 1456628 ms After the reaper, the item's PlaybackPositionTicks = 14566283154 (24:16) — the correct 91.5 s was overwritten by a value that matches the stream lifetime (1630099 ms ≈ 27 min), not anything the client reported. Resume point ended up ~23 minutes past the actual watch point. Second occurrence, different day (watched ~10 minutes) Stream socket lived 2411607 ms (~40 min) before "Response completed after client disconnected"; 57 s later the idle reaper wrote Position: 2267017 ms (37:47). Same pattern: saved position ≈ stream lifetime. Full log excerpts of both occurrences are attached. Expected When a session is ended by the idle reaper, the saved resume position should be the last position reported by the client (91.5 s in the test above) — which the server demonstrably already had (it was in the item's UserData during the entire linger). Actual The saved position tracks the elapsed stream lifetime (including the TCP half-open linger), so every "kill without stop" inflates the resume point by the linger duration (typically 20–40 min with default TCP settings). Repro 1. Play any item as direct play. 2. Kill the client device at the mains (no FIN, no Stopped). 3. Wait for the TCP retransmission timeout (~25 min, tcp_retries2=15) + the 60 s idle window. 4. Check the item's resume position: it will be ≈ stream lifetime instead of the last reported position. Workarounds found - Press Stop/Back in the client before powering off: the explicit Stopped request saves the accurate position immediately. - Lowering net.ipv4.tcp_retries2 shrinks the inflation window but is a global TCP change we'd rather avoid. Request Could the idle reaper save the last client-reported position instead of the stream-derived estimate? Alternatively, making the idle timeout configurable (it currently isn't, per system.xml/encoding.xml) would at least limit the damage. embyserver-excerpt-20261205-warcraft.txt embyserver-excerpt-20261206-test.txt
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now