New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bra closes stdout/stderr before finishing stopping child process #4
Comments
I think what should probably happen is,
when the signal is received, it should kill the child process (using sigterm), but wait until it exits. |
Thanks your feedback! Just to confirm that you are running as |
Here, do you mean send a |
right.
either one of sigint or sigterm should work fine to issue a termination request to the child process. they are very similar. |
Thanks for following up! I got it now, so I'll change bra to send a |
Hi @Dieterbe , I've pushed code for graceful shutdown which first sends |
weird. i couldn't reproduce it. |
Hi, I've met this issue before, so if your child process handles kill signal itself, bra can't control it, and of course child process captures your ctrl+c and handles it as well. |
no i sent sigterm (via kill) to bra, bra stopped, i didn't send anything to the child process (though bra should have) |
Yes, but if your child process handles sigterm, bra still exits as it should and can't do anything to child process anymore. |
it looks like child process is not getting a signal at all from bra. because if i send it sigterm (kill) or sigint (kill -int), it successfully exits in both cases within the second. when running under bra, i was stracing the child process and also looking at its log output. when i killed bra i couldn't find evidence of the child process receiving a signal from bra. |
bra does not send sigterm to child process. But from what I understood and experienced, your sigterm is passed by something in the middle to your child process, and your child process should exit itself. Not pro on this topic, can't really tell what's in the black box... But, I can let Bra captures your sigterm and pass it to child process. |
there is nothing "in the middle". i have bra just run the grafana process, which i monitor. |
Yeah, that's good idea. |
Hi @Dieterbe , I've pushed code to |
i can confirm using the latest bra, when bra is asked to exit and shuts down, grafana does not suffer sigpipe anymore, it is given the chance to write some stuff to stdout and exit cleanly. nice! thank you. |
Thanks your confirmation! |
when bra runs a program, in this case grafana (https://github.com/raintank/grafana)
and then you kill bra with sigterm, then grafana dies like so:
a child process (such as grafana here) when asked to terminate (via sigterm, sigint) should be able to write some final messages to stdout/stderr before it calls
exit()
but bra closes the file descriptors prematurely, resulting in the sigpipe error.
The text was updated successfully, but these errors were encountered: