-
Notifications
You must be signed in to change notification settings - Fork 11
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
Figure out why Python containers don't respond to SIGTERM #66
Comments
Seems that for some reason python is ignoring most of the signals when running with pid 1. |
Well, at least default handlers are not working when pid == 1. This could be fixed by installing own handlers: def receive_signal(signal_number, frame):
sys.stderr.write('Received: ' + str(signal_number) + "\n")
sys.exit(1)
return
signal.signal(signal.SIGTERM, receive_signal)
signal.signal(signal.SIGINT, receive_signal) |
Note that code above terminates python quite ungracefully by |
@lance I looked into it a bit ^^^ |
this probably should be fixed in |
Thank you! This is very helpful.
Agree |
@matejvasek this is some good and relevant reading https://hackernoon.com/my-process-became-pid-1-and-now-signals-behave-strangely-b05c52cc551c |
That checks out. The other two runtimes: golang and Quarkus are explicitly handling and they work as expected. |
@matejvasek see #70
After reading more about the problem, I don't think the solution belongs with parliament, since that would require that parliament actually implement a lot of stuff that is unrelated to what it does - e.g. reaping zombie and orphaned processes. Other tools like |
@lance I think it should be fixed in both: |
why? |
Well, that's what an init process is supposed to do. But of course, you are right to question this since parliament was previously PID 1. So, fair point. :) |
Actually it wasn't hence #68. |
It didn't work for two reason:
|
I know this is true for standard OS, but I have no idea if that's needed in OCI where the process is the only one. |
withoud exec:
with exec:
|
Although noting prevents user from calling fork, no idea what happens then. |
@lance I am not against |
Probably... I don't know enough about what the other runtimes are doing to avoid this to say with any confidence though. |
Rather than making that big change today (1.14 cutoff day) for all runtimes, I think we stick with your small changes like |
When run in a container, the Python applications built with these buildpacks don't respond to
SIGTERM
. When the same commands are run in a local execution environment, the applications respond correctly.#60 (comment)
The text was updated successfully, but these errors were encountered: