Skip to content

Processes not terminating correctly (or at all?) #135

@mindplay-dk

Description

@mindplay-dk

I've started using concurrently quite heavily.

For example, I might have tsc, webpack and node-sass all running with --watch during development.

I started noticing weird behavior, including on several occasions, my source files randomly getting deleted when I run git commands! Fortunately these are usually under source-control, so I can get them back with a git reset, but it's quite confusing.

The problem, it seems, is when I try to shut down concurrently, I can sometimes wait for several minutes and nothing happens - often this happens after e.g. webpack has crashed or stalled, which is tends to do if I remove one of the source-files it's watching.

So eventually I press CTRL+C again, which terminates concurrently, but appears to leave running processes hanging in the background.

Here's some terminal output:

$ ps -a
  PID TTY          TIME CMD
 1541 tty1     00:00:00 node
 1685 tty1     00:00:26 node-sass
 1723 tty1     00:00:00 node
 1867 tty1     00:00:06 node-sass
 5220 tty2     00:00:00 sudo
 5221 tty2     00:00:03 caddy
 5504 tty1     00:00:00 node
 5648 tty1     00:02:16 node-sass
 6041 tty1     00:00:00 ps
$ kill 1685
$ ps -a
  PID TTY          TIME CMD
 1541 tty1     00:00:00 node
 1685 tty1     00:00:26 node-sass
 1723 tty1     00:00:00 node
 1867 tty1     00:00:06 node-sass
 5220 tty2     00:00:00 sudo
 5221 tty2     00:00:03 caddy
 5504 tty1     00:00:00 node
 5648 tty1     00:02:16 node-sass
 6042 tty1     00:00:00 ps
$ kill -9 1685
$ [1] npm run watch-sass exited with code null
^C
$ ps -a
  PID TTY          TIME CMD
 1723 tty1     00:00:00 node
 1867 tty1     00:00:06 node-sass
 5220 tty2     00:00:00 sudo
 5221 tty2     00:00:03 caddy
 5504 tty1     00:00:00 node
 5648 tty1     00:02:16 node-sass
 6043 tty1     00:00:00 ps

As you can see, my first attempt to kill 1685 fails - I'm betting this is why concurrently hangs as well, it isn't able to shut down the hanging node-sass process the normal way.

Forcing node-sass to stop with kill -9 1685 also apparently causes the hanging node process (which is running concurrently) to report that node-sass has finally stopped - and as you can see from the last ps -a, both the node process that was running concurrently, and the node-sass process it was running, have finally stopped.

Is it possible to set a timeout for concurrently, e.g. forcing child processes to stop after a set maximum period of waiting? I didn't see a command-line option for that.

Any idea how to resolve this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions