Snap disable timeout

Is there a way to set the snap stop --disable timeout? It seems it is set to 1 min now.

We have a case where the snap stop --disable at [1] times out in some times (I guess on a stressed machine). The issue was reported by a MicroK8s user at [2].

Thanks

[1] https://github.com/ubuntu/microk8s/blob/master/microk8s-resources/wrappers/microk8s-stop.wrapper#L40
[2] https://github.com/ubuntu/microk8s/issues/774

Daemons can set a stop-timeout, yes.

1 Like

I’ve been working on the bug mentioned by @kjackal before and I’m havin issues using this stop-timeout setting.

I added it to all the daemons like this:

apps:
  daemon-etcd:
    command: run-etcd-with-args
    daemon: simple
    stop-command: sleep-infinity
    stop-timeout: 300s

The stop-command: sleep-infinity making the daemon sleep until the timeout occurs. Nevertheless, the timeout still occurs after a minute. What else am I missing?

There is a bug here in that snap stop doesn’t obey the timeout set by the snap.yaml.

Specifically, the service-control change creates a exec-command task, which is hard-coded to fail after 61 seconds. See https://github.com/snapcore/snapd/blob/master/overlord/servicestate/servicestate.go#L111

Fixing this however is probably non-trivial and requires most of the work detailed in Systemctl service management unification, which is queued up but not yet being actively worked on.