| Summary: | sshd hangs on shell exit if user spawned child with /bin/nohup | ||
|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Kerry Schwab <kerry.schwab> |
| Component: | sshd | Assignee: | OpenSSH Bugzilla mailing list <openssh-bugs> |
| Status: | CLOSED DUPLICATE | ||
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | -current | ||
| Hardware: | UltraSPARC | ||
| OS: | Solaris | ||
|
Description
Kerry Schwab
2002-06-12 05:54:35 AEST
Debug output, with comments: Get this once i'm in: >>[some omitted for brevity] >>debug1: session_new: session 0 >>debug1: Allocating pty. >>debug1: session_pty_req: session 0 alloc /dev/pts/12 >>debug1: fd 4 setting TCP_NODELAY >>debug1: Entering interactive session. >>debug1: fd 7 setting O_NONBLOCK >>debug1: fd 10 setting O_NONBLOCK >>debug1: fd 11 setting O_NONBLOCK >>debug1: server_init_dispatch_13 >>debug1: server_init_dispatch_15 Now I start the "nohup job" with ./nohup somescript & I then try to exit the ksh shell. Ksh first tells you "You have running jobs" ( normal...) then I give the second exit. At that point, my ksh becomes a <defunct> process (zombie). sshd apparently gets the SIGCHLD: >debug1: Received SIGCHLD. But, my ssh session is "hung". sshd itself is running poll() over and over on fd0,1,2. If I then kill the nohupped process ( from another session ), the session is closed: >>debug1: End of interactive session; stdin 20, stdout (read 584, sent 584), >>stderr 0 bytes. >>debug1: Command exited with status 0. >>debug1: Received exit confirmation. >>debug1: session_close: session 0 pid 24164 >>debug1: session_pty_cleanup: session 0 release /dev/pts/12 Please let me know if you need more detail. I'll be happy to help any way I can. i also have this exact same problem using OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090603f i start a program with "nohup <program> &" and upon returning to my native machine, the terminal is balnk, frozen with no bash prompt. i must kill the ssh pid form another terminal to get my original terminal back. thanks, Sam > i start a program with "nohup <program> &" and
> upon returning to my native machine, the terminal
> is balnk, frozen with no bash prompt.
Don't do that.
Do this instead:
(nohup <program> &)
Note the order of the '&' and the enclosing parentheses.
(nohup ./script &) is a workaround of sorts, but that's not really a good answer. People expect ssh to be an rsh replacement, and rsh doesn't require a double fork to avoid the hang-on-exit. This is a variant of the infamous hang-on-exit bug *** This bug has been marked as a duplicate of 52 *** Mass change of RESOLVED bugs to CLOSED |