At 13:11 +0300 11 Sep 2023, Max Amelchenko <maxamel2002@xxxxxxxxx> wrote:
Maybe it's connected also to the underlying infrastructure? We are getting this in AWS lambda jobs and we're hitting a system limit of max processes because of it.
Running as a lambda, or in a container, could definitely be why you're seeing a difference. Normally when a process is orphaned it gets adopted by `init` (PID 1), and that will take care of cleaning up after orphaned zombie processes.
But most of the time containers just run the configured process directly, without an init process. That leaves nothing to clean orphan processes.
Although for that to really be a problem, would require hitting that max process limit inside a single container invocation. Of course since containers usually aren't meant to be spawning a lot of processes, that limit might be a lot lower than on a normal system.
I know that Docker provides a way to include an init process in the started container (`docker run --init`), but I don't think that AWS Lambda does.