Skip to content

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

@dimikot

Description

@dimikot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions