Hello Mitch, excellent report, thanks. This is working as intended.
The Unix process model is complicated, and Linux has added a few additional complications on top; I'll try to summarize it but it's just not going to be easy. When a parent process exits, child processes are not notified by default. The prctl(2) syscall allows a process to be informed when its parent exits. There is no easy mechanism for grand-children to be informed when a grand-parent process exits. bash will send signals to all currently running jobs when it exits. (You can ask bash to skip sending a signal to a job by using the 'disown' shell built-in.) These signals can only be sent if bash continues to run when exiting -- using 'kill -9' in your example above prevents bash from sending signals to its children because a process cannot handle SIGKILL. Try it again with SIGHUP instead of SIGKILL. Processes can ignore or block the SIGHUP signal that bash will send. It is expected that killing a parent process may not influence child processes. If you want to kill a process that has a socket open, you should kill that process directly. ss(8), lsof(8), fuser(1), etc can report which processes are using a given socket. For more details check the signal(7) manpage, bash(1) manpage near 'disown', the prctl(2) manpage near 'PR_SET_PDEATHSIG'. The book Advanced Programming in the Unix Environment also has an excellent description of the Unix process lifecycle. Thanks -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1857210 Title: process does not close when shell is killed To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1857210/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
