Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

With SIGCHLD ignored, `Drop` takes 2 s per terminal and signals an already-reaped pid

Open
#630 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli, testing

Research direction

Start with spawn.rs:84-86, then read terminal.rs:4052-4068, 4350-4368, and 4390-4392, along with DESIGN.md’s Drop guarantee. The issue calls for a separate-binary test because it changes process-wide signal state; use the described ignored-SIGCHLD setup and verify that drop finishes in milliseconds without signaling. Also check that signal() refuses and wait_exit names the ECHILD cause.

Written by the indexing model from the issue text.

Description

bug

What happens. When the test process ignores SIGCHLD, the kernel reaps children itself. spawn.rs:84-86 already routes this setup to the PTY layer on purpose. But teardown treats the missing child as still alive:

signal(SIGCHLD, SIG_IGN); spawn `sh -c "echo done"`; wait for "done"; drop
wait_exit: Err("i/o error: No child processes (os error 10)")
drop (child exited, wait_exit not ok) took 2.000238871s
drop of exited child, no wait_exit, took 2.000225776s

A reviewer's strace showed kill(pid, SIGHUP) = -1 ESRCH and kill(pid, SIGKILL) = -1 ESRCH, for every terminal.

Cause. try_wait returns Err(ECHILD), and Drop and stop_child (terminal.rs:4350-4368, 4421-4422) read that as "not reaped". They send SIGHUP, poll for HANGUP_GRACE, send SIGKILL, then poll until DROP_REAP_GRACE. signal() (4052-4068) would likewise kill the pid, because exit_status is still None.

The claim. send_signal's SAFETY comment (4390-4392) says the pid "is never an unrelated, recycled pid". DESIGN.md says Drop kills "unless already reaped". Once the kernel has reaped the child, its pid can be recycled, so both claims fail here.

Fix direction.

  • Treat try_wait() == Err(ECHILD) as "reaped, status unknown", and skip stop_child.
  • Record the state so signal() refuses with Error::Input.
  • Have wait_exit's error name the cause ("SIGCHLD is ignored; the kernel reaped the child").

Done when a drop in this setup takes milliseconds and sends no signal, with a test in its own binary (it changes process-wide signal state).

Dominant language
Rust
Stars
28
Forks
24
Avg merge
11h 23m
Merged PRs (30d)
42

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vyncint/termlens

All issues in vyncint/termlens

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.