This topic is an extension of the conversation from Bug #1776295 “`stop` and `disable` should kill all processes reg...” : Bugs : snapd
The bug report states, as follows:
In Multipass, a daemon is set to use
stop-mode: sigterm
, but when issuingsnap stop multipass
orsnap disable multipass
, any processes spawned by the daemon stay alive. This seems wrong since the user is explicitly wanting the whole snap stopped or disabled.
The following conversation states the desire more clearly:
Right, so what I would like is on snap refresh, only sigterm is sent to the daemon process, ie, ‘stop-mode: sigterm’. But on snap disable/stop, all processes are killed, which really should be the default regardless of what stop-mode is set to because who would really want processes running from the snap when the snap has been stopped or disabled?
Looking at the code it doesn’t seem possible today to say stop-mode: sigterm-all
but still make it stop-mode: sigterm
when doing a refresh. Refresh with refresh-mode: endure
just skips touching a service.