GithubHelp home page GithubHelp logo

Comments (2)

benweint avatar benweint commented on August 27, 2024

Turns out I had misdiagnosed this!

nf really was delivering SIGINT to all direct children, but because it doesn't use process groups for each spawned child, if the child processes spawned their own children and didn't respond to SIGINT by exiting or forwarding to their children, then nf would just hang when one child exited.

In the repro case that I gave, the process tree looks like this after a exits:

❯ pstree -s nf.js
... snip ...
     \-+= 83622 ben node nf.js start
       \-+- 83628 ben /bin/bash ./wait-for-sigint.sh
         \--- 83632 ben sleep 1000000

The bash process (pid 83628) actually has received the SIGINT, but per the bash manual:

When Bash receives a signal for which a trap has been set while waiting for a command to complete, the trap will not be executed until the command completes.

So in this example:

  1. a exited
  2. nf sent SIGINT to the direct child process for b (bash, pid=83628)
  3. bash got the SIGINT, but was waiting to invoke the trap handler until the sleep command (pid=83632) exited
  4. The sleep command itself never received the SIGINT

The way that goreman solves this is by creating a process group for each spawned child, and then delivering the SIGINT signals to the group, rather than the direct child.

from node-foreman.

benweint avatar benweint commented on August 27, 2024

I've implemented support for using process groups in my fork (benweint@5cb9ee5) and can PR it if there's interest, but it looks like this project might be dead.

from node-foreman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.