[Bug] Service shutdown can detach playback before final session sync snapshots progress #46
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Classification
Playback/session lifecycle correctness follow-up discovered while investigating #43 / GitHub PR #140. Keep this separate from the cold-resumption fix; it is a teardown ordering defect, not a reason to add another resume policy.
Current defect
PlaybackService.onDestroy()currently orders teardown as:flushProgress()— launches the local progress record asynchronously on the application scope;sessionSync.onShutdown()— itself launches asynchronous shutdown work;sessionSync.attach(null);SessionSyncCoordinator.onShutdown()eventually closes the current session with aServiceShutdownreason. That close needs a player snapshot. Becauseattach(null)is not ordered behind completion of the asynchronous shutdown close, the coordinator can observe no player and skip the final session/progress close.This is especially relevant during process/service replacement or an app update, where the last server-acknowledged progress may otherwise lag what the listener actually heard.
Expected behavior
Service teardown must capture the final playback/session snapshot while the player required to produce it is still attached, and must order final local/server durability work explicitly before detaching that dependency.
The fix must not rely on
onDestroy()as the only durability mechanism for abrupt process death; existing periodic/local durability remains necessary.Investigation / implementation scope
PlaybackServiceandSessionSyncCoordinator.SessionSyncCoordinator.onShutdown()regression test.Out of scope
ResumeFreshnessCoordinatorremains the position-decision owner.Acceptance criteria
onShutdown()-> immediateattach(null)ordering and passes after the repair.adb install -rupdate where practical.Related