Skip to content

Large session logs cause apparent infinite scroll on reattach #6

@DonaldoDes

Description

@DonaldoDes

Description

When reattaching to a session with a large log file (>1MB), replay_session_log() reads the entire file from the beginning. For sessions with heavy output (build logs, progress bars, ANSI sequences), this causes thousands of lines to scroll rapidly, appearing as an infinite loop.

Reproduction

  1. Create a session and run a long build (e.g., cmake) generating >1MB of output
  2. Detach
  3. Reattach → output scrolls for a very long time

Root cause

replay_session_log() reads from byte 0 of the log file regardless of size. There's no cap on how much is replayed.

Suggested fix

lseek to max(0, filesize - SCROLLBACK_SIZE) before reading, consistent with the 128KB in-memory ring buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions