Stop-timeout not override-able

Recently I had my bad first impression of snapcraft after I realised it unpromptedly had upgraded my docker installation, and only had a 30 second stop-sigterm timeout set in the systemd service configuration. After that, it started SIGKILLing every arbitrary process belonging to containers running under docker. (even running database servers under load, thank god for journalling)

I started doing some testing. For my particular docker installation, allowing a graceful timeout of 1 minute would have been enough for docker to clean everything up, and have shut down all containers with no data loss, so i decided i wanted to make the new timeout 2 minutes.

However, I could not set a permanent timeout override anywhere, not in the fleeting regularly-updated snapcraft.yaml file, not in a global configuration file, not in a specific override file, not anywhere.

The hardcoded 30 second timeout as a sigterm timeout is probable to break many installations once they have been scaled and are stretching the machine’s resources, it needs to be able to be overridden, even when a snap itself defines a timeout.

i think @ijohnson mentioned that in:

Snap disable timeout

This is not even about internal configuration definitions, this is a request to be able to override them, to have a sysadmin be able to let snapd step back to make way for it’s own configuration. This critical setting that manages when systemctl sends a sigkill, or at all, needs to be exposable for individual configurations.

All I want to ask if that is agreeable, and if it’s on the roadmap for the large systemctl overhaul. That thread talks about an internal bug/spaghetti problem, I am talking about complete user configurability in the critical situation that is automatic snap refreshes.

@shadowjonathan does editing the service file in (something like) /etc/systemd/system/snap.docker.docker.service get you what you need?

Yes, but only till snapd updates that configuration file with it’s auto-generated one, which it does (before) every refresh, so manually setting the timeout, or duct-taping it to a cron job, will not be robust in the long run if the file is just a proxy for an internal snap configuration, but only specifically templated for systemd.

if that works, then use ‘systemctl edit’ to have a .d directory that adds just the line you want?

3 Likes

…I’ll admit, I didn’t exactly find the right article/stackoverflow answer when someone else suggested this exact thing before. This’ll work, thank you.

1 Like