Closed
Description
When a Gitpod task starts a process in the background (e.g. sudo docker-up &
) that process might not be subject to the same termination rules that other children of supervisor are.
When supervisor is asked to shut down (receives SIGINT/SIGTERM) it sends SIGINT to its terminals followed by a SIGKILL a few seconds later.
We should investigate what happens to background processes started by supervisor's task in this scenario.
Do they receive the same signal regimen, are they SIGKILL'ed or reparented to some supervisor process?
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
csweichel commentedon Jan 13, 2021
The motivation for this issue is running
docker-up
during prebuilds. Prebuilds finish when all their tasks finish, which means we can't just runsudo docker-up
in a prebuild. Instead, we have a few options:sudo docker-up &
sigint
/sigterm
to background processes but kills them hard. This prevents orderly shutdown of the background task.discover background tasks and gracefully terminate
We'd have the supervisor inspect the process hierarchy, detect background tasks and terminate them with the same shutdown procedure it uses for terminals (sigterm followed by sigkill).
gp daemonize
We'd introduce a
gp daemonize
(e.g.gp daemonize -- sudo docker-up
) command which would fork the child and then exit, making sure the child is reparented to the PID1 process beforehand.background
tasks in.gitpod.yml
We'd introduce a special background task, or possibly a marker on the tasks whereby prebuilds would no longer wait for those tasks to complete.
background
task differ from aninit
task? If we wanted to annotate existing tasks instead, how would we go about that? A task is defined by its command only.[supervisor] Make reaper terminating during shutdown
[supervisor] Make reaper terminating during shutdown
weitzman commentedon Feb 14, 2021
So is it now possible to use dockerd in prebuild?
6 remaining items