-
Notifications
You must be signed in to change notification settings - Fork 562
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: fix prerequisite base snap silently not being installed due to conflict #13589
Conversation
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.
I think we are ready to discuss solution options
overlord/snapstate/handlers.go
Outdated
@@ -345,6 +351,7 @@ func (m *SnapManager) installOneBaseOrRequired(t *state.Task, snapName string, c | |||
if conflErr, ok := err.(*ChangeConflictError); ok { | |||
// conflicted with an install in the same change, just skip | |||
if conflErr.ChangeID == t.Change().ID() { |
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.
This was added 3 years ago already as part of this PR
This change works for the specific case described here, but is arguable dangerous in terms of the ability to causing silent failure.
- One improvement would be to at least issue warning when this happens so that the reason for downstream failure is obvious to the user.
- Could the conflict check perhaps take into account if the tasks associated with a conflicting snap was completed (e.g. after retries). From the description where A continues to install dependencies B, but still the conflict remains.. this superficially seems a little odd.
overlord/snapstate/conflict.go
Outdated
@@ -135,6 +141,7 @@ func changeIsSnapdDowngrade(st *state.State, chg *state.Change) (bool, error) { | |||
// On older snapd's 'Version' might be empty, and in this case we assume | |||
// that snapd is downgrading as we cannot determine otherwise. | |||
if snapsup.Version == "" { | |||
fmt.Printf("@@@ This is a snapd downgrade!!!\n") |
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.
This was introduced here.
The snapd snapsetup with version == "" comes from a previous snapd version changing to this code which is the later version. The changes to add the version to snapsetup and to add this check was merged on 23 and 30 June 2023.
The test sets up a scenario where a snap, upon refresh, needs to pull in core22 base snap, but the change incorrectly conflicts with a parallel refresh of snapd that is artifically crippled to not record its version attribute. Two new test-only snap IDs are added to fake store backend: - some-snap-with-new-base-id this snap uses core22 as base - snapd-without-version-id this snap creates a snapd without the version field. In fact the suffix -without-version-id causes this behavior for other snaps should we choose to add more. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
…sOnCore This is needed by the new non-test logic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
As seen on https://paste.ubuntu.com/p/QmDxmh2Mvg/ Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
9fc2022
to
38d5b9d
Compare
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.
thank you, one small remark
if err != nil { | ||
return fmt.Errorf("cannot get current snapd snap info: %v", err) | ||
} | ||
if snapsup.Version == "" { |
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 might want some kind of comment here:
// fill version to make snapd downgrade check not trigger ()
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
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.
lgtm
… to conflict (snapcore#13589) * o/snapstate: add test for spurious snapd downgrade The test sets up a scenario where a snap, upon refresh, needs to pull in core22 base snap, but the change incorrectly conflicts with a parallel refresh of snapd that is artifically crippled to not record its version attribute. Two new test-only snap IDs are added to fake store backend: - some-snap-with-new-base-id this snap uses core22 as base - snapd-without-version-id this snap creates a snapd without the version field. In fact the suffix -without-version-id causes this behavior for other snaps should we choose to add more. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: add snap-setup to TestFinishRestartGeneratesSnapdWrappersOnCore This is needed by the new non-test logic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: apply fix for snapd downgrade from Samuele As seen on https://paste.ubuntu.com/p/QmDxmh2Mvg/ Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: explain snapd version special logic Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> --------- Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
… to conflict (snapcore#13589) * o/snapstate: add test for spurious snapd downgrade The test sets up a scenario where a snap, upon refresh, needs to pull in core22 base snap, but the change incorrectly conflicts with a parallel refresh of snapd that is artifically crippled to not record its version attribute. Two new test-only snap IDs are added to fake store backend: - some-snap-with-new-base-id this snap uses core22 as base - snapd-without-version-id this snap creates a snapd without the version field. In fact the suffix -without-version-id causes this behavior for other snaps should we choose to add more. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: add snap-setup to TestFinishRestartGeneratesSnapdWrappersOnCore This is needed by the new non-test logic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: apply fix for snapd downgrade from Samuele As seen on https://paste.ubuntu.com/p/QmDxmh2Mvg/ Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: explain snapd version special logic Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> --------- Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
… to conflict (#13589) * o/snapstate: add test for spurious snapd downgrade The test sets up a scenario where a snap, upon refresh, needs to pull in core22 base snap, but the change incorrectly conflicts with a parallel refresh of snapd that is artifically crippled to not record its version attribute. Two new test-only snap IDs are added to fake store backend: - some-snap-with-new-base-id this snap uses core22 as base - snapd-without-version-id this snap creates a snapd without the version field. In fact the suffix -without-version-id causes this behavior for other snaps should we choose to add more. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: add snap-setup to TestFinishRestartGeneratesSnapdWrappersOnCore This is needed by the new non-test logic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: apply fix for snapd downgrade from Samuele As seen on https://paste.ubuntu.com/p/QmDxmh2Mvg/ Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: explain snapd version special logic Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> --------- Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
… to conflict (snapcore#13589) * o/snapstate: add test for spurious snapd downgrade The test sets up a scenario where a snap, upon refresh, needs to pull in core22 base snap, but the change incorrectly conflicts with a parallel refresh of snapd that is artifically crippled to not record its version attribute. Two new test-only snap IDs are added to fake store backend: - some-snap-with-new-base-id this snap uses core22 as base - snapd-without-version-id this snap creates a snapd without the version field. In fact the suffix -without-version-id causes this behavior for other snaps should we choose to add more. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: add snap-setup to TestFinishRestartGeneratesSnapdWrappersOnCore This is needed by the new non-test logic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: apply fix for snapd downgrade from Samuele As seen on https://paste.ubuntu.com/p/QmDxmh2Mvg/ Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: explain snapd version special logic Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> --------- Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
… to conflict (snapcore#13589) * o/snapstate: add test for spurious snapd downgrade The test sets up a scenario where a snap, upon refresh, needs to pull in core22 base snap, but the change incorrectly conflicts with a parallel refresh of snapd that is artifically crippled to not record its version attribute. Two new test-only snap IDs are added to fake store backend: - some-snap-with-new-base-id this snap uses core22 as base - snapd-without-version-id this snap creates a snapd without the version field. In fact the suffix -without-version-id causes this behavior for other snaps should we choose to add more. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: add snap-setup to TestFinishRestartGeneratesSnapdWrappersOnCore This is needed by the new non-test logic. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: apply fix for snapd downgrade from Samuele As seen on https://paste.ubuntu.com/p/QmDxmh2Mvg/ Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> * o/snapstate: explain snapd version special logic Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com> --------- Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
This pull request contains a number of patches that should be dropped, followed by a currently-failing test that reproduces the scenario from https://warthogs.atlassian.net/browse/SNAPDENG-13768
As debugged by Ernest and Samuele earlier, the debug output of the test shows (in messages prefixed with
@@@
) that a conflict is detected and then subsequently ignored.This branch serves as a playground for fixing the problem.