You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Child keeps running after its client is killed by SIGTERM, SIGHUP or SIGKILL #764
When a Spring 4.7.0 client process ends by "deadly" signals such as SIGTERM, SIGKILL, SIGHUP, the command process spawned by the Spring application will keep running until it finishes on its own, or forever if it waits on something. That can cause problems when it's consuming resources or holding locks.
SIGINT works as expected but it would be great if other signals were covered as well. It would be useful, for example, when...
timeout(1) times out (SIGTERM)
an agent subprocess is ended (often SIGTERM then SIGKILL)
a terminal window or tab is closed, or an SSH or docker session is lost (SIGHUP)
just using plain kill with default args (SIGTERM)
I'd be happy to prepare a PR for it if that's welcome. My proposed fix is to treat unexpected EOF on the client socket as the client's death in Spring::Application#wait and send TERM to the command's process group - that should cover all cases.
EDIT: Actually it would be more accurate to forward termination signals like TERM, HUP and ALRM the same way INT is forwarded, and use EOF as a catch-all for a crash (SEGV and the like, which would be a bit silly to forward) and most importantly KILL (which can't be forwarded).
EDIT: I've also noticed that with orphaned children, spring stop reports success but leaves the server and the application process (that spawned the orphan) running until all orphans have exited. That would be fixed as a side-effect ✨
We hit this too: a hung spec under timeout 300 bin/rspec … | tail kept the pipeline open overnight, since timeout only ended the client. I've opened #765 following your proposal: TERM/HUP are forwarded once the command runs (not queued during the preload, so timeout still ends a client stuck there), and EOF on the client socket while the command runs sends TERM to its process group, covering KILL and crashes. @jscheid, happy to fold in anything you'd planned, or to close mine if you'd rather send yours.
Activity
fuzzyrichie commentedon Nov 24, 2026
We hit this too: a hung spec under
timeout 300 bin/rspec … | tailkept the pipeline open overnight, sincetimeoutonly ended the client. I've opened #765 following your proposal:TERM/HUPare forwarded once the command runs (not queued during the preload, sotimeoutstill ends a client stuck there), and EOF on the client socket while the command runs sendsTERMto its process group, coveringKILLand crashes. @jscheid, happy to fold in anything you'd planned, or to close mine if you'd rather send yours.