docker-systemctl-replacement icon indicating copy to clipboard operation
docker-systemctl-replacement copied to clipboard

systemctl does not tail logs anymore immediately after pid 1 receives SIGTERM

Open dimikot opened this issue 4 months ago • 0 comments

Some services have graceful shutdown mechanism, and they print to stdout while they drain. When pid 1 receives SIGTERM (docker container stops), systemctl sends signals to the services and waits until they die. The problem is that whatever the service prints to its stdout/stderr gets swallowed unfortunately.

I think it's because self.print_log_files() (aka read_log_files) is not called anymore after init_loop_until_stop() finishes.

INFO:systemctl:interrupted - exit init-loop
INFO:systemctl:init-loop SIGTERM
INFO:systemctl:system is stopping
INFO:systemctl: stop unit app.service => '/etc/systemd/system/app.service'
INFO:systemctl:no ExecStop => systemctl kill
INFO:systemctl:STATUS /run/app.service.status 11

<<<< I expect app's journal to be tailing here

INFO:systemctl:stop kill PID 73
INFO:systemctl:done kill PID 73 OK

dimikot avatar Oct 15 '24 09:10 dimikot