Problem
Background
PID1 on Unix has special responsibilities. Mainly, it needs to take parentship of orphan children, and reap zombie processes.
One important thing to note is that the number of PIDs on a machine is limited, and using all PIDs will prevent new processes from getting created. Reaping zombies helps ensuring that no PIDs are used for nothing.
When working with containers and/or pods, since they usually have their own namespace, the pod/container's PID1 is responsible of this handling.
However, how this is done depends on the platform to which the container is deployed and how it is deployed.
There are mainly two ways to do this:
- Using the pause container as part of the pod, and enabled PID sharing for the whole pod. There, the
pause container will be PID1 and handle those responsibilities
- Having the entrypoint of the container that will be PID1 handling those responsibilities.
What happens if this is not done?
Failing to do so can lead a misbehaving application to own all the PIDs on a node and make this node unsuable/crash.
There are ways of mitigating this, e.g. ensuring each application is limited on the number of PIDs it can create. However this is not ideal.
Our needs
We currently need to deploy to platforms where 1. is not possible for us, and we therefore need to ensure 2. works.
Currently, ensuring this with Buildpacks is tricky:
- Buildpack's processes cannot be overriden by another buildpack, so we cannot "just add" a new buildpack that would install a valid
init as PID1.
- We do not want users of our buildpacks to have to know about this and do special handling, and would like only the 'builders' owners to have to care about this.
Question
Would CNB want to, and if so, how could we enable owners of buildpack builders to ensure that buildpack built images have a valid PID1 so they can safely be deployed to any platform regardless of how it is configured?
Potential solutions
- Having the
launch in the lifecycle install itself as PID1 and reaping processes automatically
Problem
Background
PID1 on Unix has special responsibilities. Mainly, it needs to take parentship of orphan children, and reap zombie processes.
One important thing to note is that the number of PIDs on a machine is limited, and using all PIDs will prevent new processes from getting created. Reaping zombies helps ensuring that no PIDs are used for nothing.
When working with containers and/or pods, since they usually have their own namespace, the pod/container's PID1 is responsible of this handling.
However, how this is done depends on the platform to which the container is deployed and how it is deployed.
There are mainly two ways to do this:
pausecontainer will be PID1 and handle those responsibilitiesWhat happens if this is not done?
Failing to do so can lead a misbehaving application to own all the PIDs on a node and make this node unsuable/crash.
There are ways of mitigating this, e.g. ensuring each application is limited on the number of PIDs it can create. However this is not ideal.
Our needs
We currently need to deploy to platforms where 1. is not possible for us, and we therefore need to ensure 2. works.
Currently, ensuring this with Buildpacks is tricky:
initas PID1.Question
Would CNB want to, and if so, how could we enable owners of buildpack builders to ensure that buildpack built images have a valid PID1 so they can safely be deployed to any platform regardless of how it is configured?
Potential solutions
launchin the lifecycle install itself as PID1 and reaping processes automatically