Child keeps running after its client is killed by SIGTERM, SIGHUP or SIGKILL
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- backend, operating-systems
Research direction
Start by reading Spring::Application#wait and the existing SIGINT forwarding path. Reproduce the issue with the Linux shell commands in the report, then trace how the client socket and spawned command process are managed. Done means child processes are cleaned up after the described client signals or socket EOF, and spring stop no longer waits on orphaned children.
Written by the indexing model from the issue text.
Description
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.
Minimal repro (tested on Linux):
bin/rails runner 'sleep 60' & sleep 10; kill -TERM $! # or -HUP, -KILL
sleep 2; ps -eo pid,args | grep '[r]ails_runner' # still running
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
killwith 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 ✨
- Dominant language
- Ruby
- Stars
- 2.8k
- Forks
- 343
- PR merge metrics
- No merged PRs in 30d
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rails/spring
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Bug: undefined method `hide_cursor' for Reline::GeneralIO:Class (NoMethodError)Possibly taken @rafaelfranca claimed this 143 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
開発用DockerイメージにPlaywrightのシステム依存を追加するPossibly taken @momocus claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
sakazuki-org/sakazuki#1453 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
jenkins-infra/jenkins.io#9615 · 1 comment ·
Maintainers usually reply within 1 day
-
fix(ocr): compile the Tesseract-free pipeline with Tokio runtimePossibly taken @Goldziher claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Metric tooltips that contradict how the metric is calculatedPossibly taken @aniadeadu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
WikiEducationFoundation/WikiEduDashboard#7303 · 1 comment ·
Maintainers usually reply within 1 day
-
WhatsApp Cloud template sync saves a partial template list when one page of the Graph API response failsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days