Fix defunct processes by correctly reaping them (fixes #74)
Mounter Parameters
This PR adds support for custom mounter parameters (although it is only implemented for rclone as of now). I needed to be able to specify additional parameters to rclone as the --s3-provider=AWS flag broke support for mounting MinIO buckets. I'm not sure why the tests didn't catch that (I guess thedev-full is not updated) but with this PR it's possible to overwrite the flags. The additional mounter parameters must be prefixed with the mounter name so it's more obvious what those parameters are for.
It's now possible to include/exclude support for mounters from the binary. The mounters are still installed in the Docker image. I basically needed this since I wasn't able to get the go build with goofys to work as it always errors with some strange Go runtime linking in github.com/kahing/fusego.
By default, the docker image will contain support for all mounters but it's now possible to specify it:
make container TAGS="rclone,s3fs"
Defunct Processes
Additionally, this PR fixes the issue with defunct processes.
We're running in the container as PID-1 which gets some special treatment by the kernel. In particular, if a process in the container terminates and there are still active child processes, the kernel will move those orphaned processes to be child processes of PID-1.
Init-systems are expected to handle this case by reaping those "orphan" processes once they exit. The kernel notifies the then active parent process (either the real parent or PID-1 in case the real parent terminated) by sending a SIGCHLD.
Since all available mounters are instructed to daemonize, we need to reap the daemonized processes since their parent (the mounter) exists once the daemon is running.
Hi and thanks for your work on this!
This PR includes the following changes:
Mounter Parameters
This PR adds support for custom mounter parameters (although it is only implemented for rclone as of now). I needed to be able to specify additional parameters to rclone as the
--s3-provider=AWS
flag broke support for mounting MinIO buckets. I'm not sure why the tests didn't catch that (I guess thedev-full
is not updated) but with this PR it's possible to overwrite the flags. The additional mounter parameters must be prefixed with the mounter name so it's more obvious what those parameters are for.An example would be:
Build Tags
It's now possible to include/exclude support for mounters from the binary. The mounters are still installed in the Docker image. I basically needed this since I wasn't able to get the go build with goofys to work as it always errors with some strange Go runtime linking in
github.com/kahing/fusego
.By default, the docker image will contain support for all mounters but it's now possible to specify it:
Defunct Processes
Additionally, this PR fixes the issue with
defunct
processes.We're running in the container as PID-1 which gets some special treatment by the kernel. In particular, if a process in the container terminates and there are still active child processes, the kernel will move those orphaned processes to be child processes of PID-1.
Init-systems are expected to handle this case by reaping those "orphan" processes once they exit. The kernel notifies the then active parent process (either the real parent or PID-1 in case the real parent terminated) by sending a
SIGCHLD
.Since all available mounters are instructed to daemonize, we need to reap the daemonized processes since their parent (the mounter) exists once the daemon is running.