Observed
Under load, after suspending a job with Ctrl+Z, jobs can list an extra job:
[1] - suspended (tty output)
[2] + suspended sleep 30
jobs -l and ps identify it as stty -echo in state TN (stopped by SIGTTOU). This was found while diagnosing the intermittent failure of the Ctrl+Z end-to-end test (JOBCOUNT=1), reproduced 6 times in 18 parallel runs.
Cause
NMSh's managed-zsh precmd hook runs stty -echo (and preexec runs stty echo) as ordinary commands with job control on. Right after a job stops, zsh can run the hook before it has taken the terminal back. stty then runs as a separate job, is stopped by SIGTTOU when it changes terminal modes, and stays in the user's job table.
Fix direction
Run those stty calls outside job control, with SIGTTOU ignored only for that call.
Observed
Under load, after suspending a job with Ctrl+Z,
jobscan list an extra job:jobs -landpsidentify it asstty -echoin stateTN(stopped by SIGTTOU). This was found while diagnosing the intermittent failure of the Ctrl+Z end-to-end test (JOBCOUNT=1), reproduced 6 times in 18 parallel runs.Cause
NMSh's managed-zsh
precmdhook runsstty -echo(andpreexecrunsstty echo) as ordinary commands with job control on. Right after a job stops, zsh can run the hook before it has taken the terminal back.sttythen runs as a separate job, is stopped by SIGTTOU when it changes terminal modes, and stays in the user's job table.Fix direction
Run those
sttycalls outside job control, with SIGTTOU ignored only for that call.