New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overlord/snapstate: discard mount namespace when undoing 1st link snap #6509
Conversation
When a snap is installed for the first time but the installation fails, e.g. because the install hook fails or because a service fails to start, the mount namespace would remain behind, possibly messing up subsequent attempts to install the snap. When the undo handler for "link-snap" detects that it runs for the 1st revision is already removes snap cookies, this is the perfect place to add the logic to discard the mount namespace. Thanks to Samuele for pointing this out! Fixes: https://bugs.launchpad.net/snapd/+bug/1815722 Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
err = m.backend.DiscardSnapNamespace(snapsup.InstanceName()) | ||
if err != nil { | ||
t.Errorf("cannot discard snap namespace %q, will retry in 3 mins: %s", snapsup.InstanceName(), err) | ||
return &state.Retry{After: 3 * time.Minute} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 minutes is a lot, is there a reason to wait that long?
Also two questions:
- shouldn't we bail out if it keeps failing? Unlike Retry in other places where we know a problem (e.g. a conflict) will eventually go away, in this case it might be a persistent issue (until rebooted)?
- what happens if there is a reboot before we execute undo and the namespace is naturally gone? Will we hit an error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also use 3 minutes in the natural case in discard-snap. I don't recall why we wait this long but I didn't want to invent a new time now.
- This doesn't fail in any way I know of
- If there's a reboot this gets cleaned up and snap-discard-ns just happily goes ahead
Codecov Report
@@ Coverage Diff @@
## master #6509 +/- ##
==========================================
- Coverage 79.16% 79.15% -0.02%
==========================================
Files 575 575
Lines 44518 44522 +4
==========================================
- Hits 35244 35241 -3
- Misses 6424 6428 +4
- Partials 2850 2853 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
When a snap is installed for the first time but the installation fails,
e.g. because the install hook fails or because a service fails to start,
the mount namespace would remain behind, possibly messing up subsequent
attempts to install the snap.
When the undo handler for "link-snap" detects that it runs for the 1st
revision is already removes snap cookies, this is the perfect place to
add the logic to discard the mount namespace.
Thanks to Samuele for pointing this out!
Fixes: https://bugs.launchpad.net/snapd/+bug/1815722
Signed-off-by: Zygmunt Krynicki me@zygoon.pl