Skip to content

Client crashes with SIGABRT on stderr write when host terminal is closed #2927

Description

@abuamar142

Current behavior

Closing the host terminal (Ghostty) without detaching first (Ctrl+B Q) causes the herdr client to crash with SIGABRT. A core dump is generated. The crash occurs when the client attempts to write to stderr after the terminal's file descriptors have become invalid.

Expected behavior

The herdr client should handle terminal death gracefully — clean disconnect and exit cleanly (exit 0 or exit 1) instead of panicking/aborting. For comparison, tmux handles this scenario without crashing.

Reproduction

  1. Open herdr in a terminal (herdr)
  2. Open a few panes/tabs
  3. Close the terminal window directly (do not detach with Ctrl+B Q first)
  4. Core dump is generated

Impact

Core dump occurs every time the terminal is closed without detaching. This is a common mistake, especially when closing multiple windows quickly. The core dump fills systemd journal and coredumpctl with crash reports.

Environment

  • herdr v0.8.0 stable
  • OS: CachyOS (Arch-based), Linux
  • Terminal: Ghostty 1.3.1
  • Shell: Fish 4.8.1
  • Session: Wayland

Additional context

The crash stack trace shows the abort happens in std::io::default_write_fmtStderr::write_str — the client panics when trying to write to stderr after the terminal FD is closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions