Skip to content

A killed session's segments stay in tmp until a later native load #1148

Backlog

Description

@robertontheair

What happened?

The sweep that removes abandoned session directories only runs when a SegmentCache or a disk packet spool is created. A load that creates neither never runs it:

  • the software path with the memory packet store (the tvOS default),
  • audio-only sources.

So when the app is killed during a native session, that session's aether-segments/<uuid>/ directory stays in the temporary directory until some later load takes the native route. On an Apple TV 4K (4th generation) running a NuvioTVOS build, a session killed during a 4K title left 886 MB in tmp/aether-segments/. It survived several later playbacks on a route that creates no segment cache, hours after it was past the one-hour age.

Steps to reproduce

On macOS with aetherctl from main (cf3c6ea):

  1. Plant an abandoned session directory older than an hour:
    T=$(getconf DARWIN_USER_TEMP_DIR)aether-segments
    D=$T/0E0D0C0B-1111-2222-3333-444455556666
    mkdir -p $D && dd if=/dev/zero of=$D/seg-1-1.m4s bs=1m count=50 && touch $D/session.lock
    SetFile -d "11/28/2026 04:22:00" $D
    
  2. swift run aetherctl play --seconds 8 vp9.webm (route = software). The directory is still there.
  3. swift run aetherctl play --seconds 6 tone.m4a (route = audio). Still there.
  4. swift run aetherctl play --seconds 8 h264.mp4 (route = loopback). Now it is gone.

(TMPDIR= does not move the engine's directory; NSTemporaryDirectory() answers the per-user folder.)

AetherEngine version or commit SHA

7.77.0 / main cf3c6ea (also seen in the copy NuvioTVOS vendors, 7.76.0 plus patches)

Host app

Custom / my own integration

Platform

tvOS

OS version

tvOS 27.2.1; macOS 27.2.1 for the repro

Device / chip

Apple TV 4K (4th generation), AppleTV18,1; Mac for aetherctl

Playback path

Not sure / not a playback bug

Source media (for playback bugs)

Not media specific. Killed session: a 4K HEVC title on the native route. Later playbacks that did not clean up: a 1080p TV episode the engine played without a segment cache, plus synthetic VP9 WebM and AAC M4A clips in the repro.

Error codes / log lines

None. Nothing is logged, because the sweep never runs.

Anything else

Related: AE#451 made the sweep spare live sessions. This is the other side: when the sweep runs at all.

Suggested fix: schedule the same bounded sweep (both the segment cache and the packet spool kinds) at every load(), off the load's path. It keeps the existing rules: one hour of age and an unheld marker. I have a PR ready.

Activity

  1. added
    bug
    on Nov 28, 2026
  2. superuser404notfound commented on Nov 30, 2026

    @superuser404notfound
    Owner

    The fix from #1149 is on main as c20705a, plus a ten-minute throttle and a sweep at engine creation. It will be in the next release. If you get a chance, could you check on the Apple TV that a killed session's directory still goes at the next play? I'll leave this open until then.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions