Skip to content

Fix a crash on ^C during a REPL command - #49

Merged
plotnick merged 1 commit into
mainfrom
repl-signals
Aug 15, 2026
Merged

Fix a crash on ^C during a REPL command#49
plotnick merged 1 commit into
mainfrom
repl-signals

Conversation

@plotnick

@plotnick plotnick commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Interrupting a REPL command could crash the client with a core dump. The crash came from a stale rustyline signal handler writing to a closed pipe. Enabling rustyline's signal-hook feature makes it share the signal registry that tokio uses, and no stale handler remains installed.

Example crash:

sush# job start -i -T 14 bash
✅ Session is now `disorder-episode-young-unaware-will-token-page-sort`
⠐  Waiting for signature on `leopard-bar-force-hair-farm-volcano-fish-virus` [00:00:28]
^C
thread 'main' (1) panicked at /home/build/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustyline-17.0.2/src/tty/unix.rs:83:18:
fd != -1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'main' (1) panicked at /rustc/8bab26f4f68e0e26f0bb7960be334d5b520ea452/library/core/src/panicking.rs:225:5:
panic in a function that cannot unwind
stack backtrace:
   0:          0x1a5e1c6 - <<std[a3c1d0ae1e0a836a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[31c3886e4e16a981]::fmt::Display>::fmt
   1:          0x1a9ed1a - core[31c3886e4e16a981]::fmt::write
   2:          0x1a6e181 - <std[a3c1d0ae1e0a836a]::sys::stdio::unix::Stderr as std[a3c1d0ae1e0a836a]::io::Write>::write_fmt
   3:          0x1a340a4 - std[a3c1d0ae1e0a836a]::panicking::default_hook::{closure#0}
   4:          0x1a54a33 - std[a3c1d0ae1e0a836a]::panicking::default_hook
   5:          0x1a54d91 - std[a3c1d0ae1e0a836a]::panicking::panic_with_hook
   6:          0x1a34192 - std[a3c1d0ae1e0a836a]::panicking::panic_handler::{closure#0}
   7:          0x1a282f9 - std[a3c1d0ae1e0a836a]::sys::backtrace::__rust_end_short_backtrace::<std[a3c1d0ae1e0a836a]::panicking::panic_handler::{closure#0}, !>
   8:          0x1a3541c - __rustc[6ef78fba13ac776c]::rust_begin_unwind
   9:          0x1a9f4fc - core[31c3886e4e16a981]::panicking::panic_nounwind_fmt
  10:          0x1a9f43a - core[31c3886e4e16a981]::panicking::panic_nounwind
  11:          0x1a9f602 - core[31c3886e4e16a981]::panicking::panic_cannot_unwind
⠐  Waiting for signature on `leopard-bar-force-hair-farm-volcano-fish-virus` [00:00:28]                                            12:          0x1017a3c - rustyline[992a51073e1d6952]::tty::unix::sig_handler
  13:          0x1934f66 - signal_hook_registry[f8137fdb20e9e5c4]::handler
  14: 0xfffffc7fe9c3b916 - __sighndlr
Segmentation Fault (core dumped)

Pressing ^C while a REPL command ran could crash the client with a
core dump. The crash came from a stale rustyline signal handler
writing to a closed pipe. Enabling rustyline's signal-hook feature
makes it share the signal registry that tokio uses, and no stale
handler remains installed.

Co-Authored-By: Claude Mythos 5 <noreply@anthropic.com>
@plotnick
plotnick merged commit bd52252 into main Aug 15, 2026
5 checks passed
@plotnick
plotnick deleted the repl-signals branch August 15, 2026 17:12
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