foreman icon indicating copy to clipboard operation
foreman copied to clipboard

issue killing subprocesses using `cd` with failure at startup

Open mjhoy opened this issue 4 years ago • 1 comments

Hello,

I've run into an interesting problem, and reduced to it what I think is a minimal case. I have the following Procfile (note this requires python 3.x to run):

server: cd inner && python -m http.server 8000
failure: sleep 1 && false

Running foreman start in a directory with an inner subdirectory (so the cd doesn't fail), I get:

% foreman start   
10:20:30 server.1  | started with pid 15205
10:20:30 failure.1 | started with pid 15206
10:20:32 failure.1 | exited with code 1
10:20:32 system    | sending SIGTERM to all processes
10:20:32 server.1  | terminated by SIGTERM

However, the server is still running:

% lsof -i tcp:8000
COMMAND     PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
python3.7 15207 mikeyhoy    3u  IPv4 0xe5175633836f0ad9      0t0  TCP *:irdmi (LISTEN)

If I remove the cd inner && from the server child command, it works as expected, the subprocess getting terminated. Even more interestingly, if I remove the failure child, and exit foreman normally with Control-C, it correctly kills the subprocess. So it only seems to happen if another child process fails at startup.

Any ideas on what's going on?

Thanks.

EDIT: I'm using the current version,

% foreman --version
0.87.1

mjhoy avatar Jul 10 '20 14:07 mjhoy

Maybe due to https://github.com/ddollar/foreman/issues/779? That issue has been addressed in overman, a foreman fork, see https://github.com/ddollar/foreman/pull/780#issuecomment-1294980165

dentarg avatar Oct 28 '22 16:10 dentarg