Skip to content

agent exits when drained so the launcher can wait for a clean upload - #22

Merged
CodingInAVan merged 2 commits into
mainfrom
retry-handling
Jun 21, 2026
Merged

CodingInAVan merged 2 commits into
mainfrom
retry-handling

Conversation

@CodingInAVan

Copy link
Copy Markdown
Contributor

The agent is a daemon that blocks forever, so gpufl trace --upload relied on
the launcher hard-killing it after a fixed delay - which truncated the live
upload whenever the drain took longer than that delay.

LogTailer assumed logrotate-style rotation (.1 = newest) with a live active
file at the session root, but the client writes monotonic incrementing windows
(<channel>.<index>.log[.gz], 1 = oldest) with the active file hidden in
<sessionId>/.tmp/. Live-tailing a session large enough to rotate past one
window dropped every window after the first (~50% kernel loss on large
sessions; on-disk data was intact, only the live upload was truncated).

Rewrite tail() to the window model: send each complete window whole in
ascending index order and finish once the session's .tmp/ dir is gone (the
client removes it after every channel closes) plus a short straggler grace.

In stream mode a published .gz window is already the exact gzipped-NDJSON wire
format, so upload it verbatim as one chunk (publishStreamGz) instead of
decompressing and re-batching into <=1MB POSTs: the agent no longer holds a
whole decompressed window and a large session uploads in a handful of chunks.
The cursor advances immediately after the durable 2xx so a crash cannot
re-send the whole window.

Drop the dead RandomAccessFile-based readLineUtf8 left from the old tailer.
@CodingInAVan
CodingInAVan merged commit c0ebebc into main Jun 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant