open-cli-tools / open-cli-tools/concurrently

Weird hanging bug with --kill-others

Open
#104 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.9k
Forks
281
Avg merge
17h 12m
Merged PRs (30d)
1

Description

Hi,

I've found a superweird bug that I'd like some help to figure out what to do with.

When running concurrently in my node-alpine docker container, PIDs are (consistently) one off.

To test this, I modified concurrently to print the PID first when spawning a child process, and also when trying to kill them in killOtherProcesses. http-server is constantly one higher than the saved PID.

Example output:

bash-4.3# ps aux
PID   USER     TIME   COMMAND
    1 root       0:00 bash
 1293 root       0:00 ps aux

bash-4.3# concurrently --kill-others "http-server ." "npm --version" &
[1] 1294
1300
1307
[0] Starting up http-server, serving .
[0] Available on:
[0]   http://127.0.0.1:8080
[0]   http://172.17.0.3:8080
[0] Hit CTRL-C to stop the server
[1] 4.4.4
[1] npm --version exited with code 0
--> Sending SIGTERM to other processes..
1300
bash-4.3#  ps
PID   USER     TIME   COMMAND
    1 root       0:00 bash
 1294 root       0:00 node /usr/bin/concurrently --kill-others http-server . npm --version
 1301 root       0:00 node /usr/bin/http-server .
 1315 root       0:00 ps

So it's trying to kill http-server on 1300, but http-server is actually on 1301. If I change the code to kill child.pid+1 instead, all is fine...

Any ideas? I'm stumped for ideas where to look further.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided concurrently --kill-others "http-server ." "npm --version" command in the node-alpine container and inspect the implementation around killOtherProcesses. Compare the spawned and terminated process IDs, then verify that the correct process receives SIGTERM without changing behavior outside this reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, node.js, typescript
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.