Docker PID 1

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Docker PID 1

Kathleen Sharp
Hi,

I was playing about with flink using the docker images provided,
however I noticed that the entry point is a bash script.

There is a problem in using bash as the PID1 process in a docker
container as docker sends SIGTERM, but bash doesn't send this to its
child processes.

This means for example that if a container was ever killed and a child
process had a file open then the file may get corrupted.

It's covered in more detail in a blog post here:
https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/

If this is a big enough concern should I raise a jira ticket?

Kat
Reply | Threaded
Open this post in threaded view
|

Re: Docker PID 1

Nico Kruber
Hi Kat,
yes, this looks like it may be an issue, please create the Jira ticket.

Some background:
Although docker-entrypoint.sh uses "exec" to run succeeding bash scripts for
jobmanager.sh and taskmanager.sh, respectively, and thus replaces itself with
these scripts, they do not seem to use exec themselves for foreground
processes and thus may run into the problem you described.
I may be wrong, but I did not find any other fallback to handle this in the
current code base.


Regards
Nico

On Monday, 10 April 2017 18:00:15 CEST Kathleen Sharp wrote:

> Hi,
>
> I was playing about with flink using the docker images provided,
> however I noticed that the entry point is a bash script.
>
> There is a problem in using bash as the PID1 process in a docker
> container as docker sends SIGTERM, but bash doesn't send this to its
> child processes.
>
> This means for example that if a container was ever killed and a child
> process had a file open then the file may get corrupted.
>
> It's covered in more detail in a blog post here:
> https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-probl
> em/
>
> If this is a big enough concern should I raise a jira ticket?
>
> Kat


signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Docker PID 1

Patrick Lucas
I concur with Nico. We're actively working on improving Flink-on-Docker, and this is a valid concern.

--
Patrick Lucas

On Tue, Apr 11, 2017 at 11:01 AM, Nico Kruber <[hidden email]> wrote:
Hi Kat,
yes, this looks like it may be an issue, please create the Jira ticket.

Some background:
Although docker-entrypoint.sh uses "exec" to run succeeding bash scripts for
jobmanager.sh and taskmanager.sh, respectively, and thus replaces itself with
these scripts, they do not seem to use exec themselves for foreground
processes and thus may run into the problem you described.
I may be wrong, but I did not find any other fallback to handle this in the
current code base.


Regards
Nico

On Monday, 10 April 2017 18:00:15 CEST Kathleen Sharp wrote:
> Hi,
>
> I was playing about with flink using the docker images provided,
> however I noticed that the entry point is a bash script.
>
> There is a problem in using bash as the PID1 process in a docker
> container as docker sends SIGTERM, but bash doesn't send this to its
> child processes.
>
> This means for example that if a container was ever killed and a child
> process had a file open then the file may get corrupted.
>
> It's covered in more detail in a blog post here:
> https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-probl
> em/
>
> If this is a big enough concern should I raise a jira ticket?
>
> Kat