Skip to content
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

Creating snapshot before app startup can hang #5849

Closed
Tracked by #5876
mook-as opened this issue Oct 26, 2023 · 4 comments · Fixed by #6059
Closed
Tracked by #5876

Creating snapshot before app startup can hang #5849

mook-as opened this issue Oct 26, 2023 · 4 comments · Fixed by #6059
Assignees
Labels
area/snapshots kind/bug Something isn't working platform/windows qase Issue is related to manual test in Qase
Milestone

Comments

@mook-as
Copy link
Contributor

mook-as commented Oct 26, 2023

Actual Behavior

If a snapshot is created, and then the app is started during the snapshot creation process, this can break the snapshot process.

Steps to Reproduce

  1. rdctl factory-reset
  2. Start Rancher Desktop.
  3. Quit Rancher Desktop.
  4. rdctl snapshot create abc
  5. While the snapshot is still running, start Rancher Desktop.
  6. You should see a modal dialog when RD starts, noting that a snapshot is in progress. (This is correct.)
  7. The snapshot never finishes successfully.

Result

The rdctl process handling the snapshot exits with:

Error: failed to restart backend: 401 Unauthorized: user/password not accepted

The UI still has the modal dialog (and it never goes away).

Expected Behavior

The snapshot should (eventually) complete, and Rancher Desktop should be interactive.

Additional Information

Test case RD-178: Create/restore snapshot when app is not running

This also happens if the operation is rdctl snapshot restore instead of create.

Rancher Desktop Version

1.10.0-566-g9034e36d (1.11 RC1)

Rancher Desktop K8s Version

N/A

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11 Pro 22H2 (Build 22621.2428)

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

@mook-as mook-as added kind/bug Something isn't working area/snapshots labels Oct 26, 2023
@rak-phillip
Copy link
Contributor

#5846 might be related

@rak-phillip
Copy link
Contributor

The error appears to originate here:

func ensureBackendStarted() error {
connectionInfo, err := config.GetConnectionInfo(true)
if err != nil || connectionInfo == nil {
return err
}
rdClient := client.NewRDClient(connectionInfo)
desiredState := client.BackendState{
VMState: "STARTED",
Locked: false,
}
err = rdClient.UpdateBackendState(desiredState)
if err != nil && !errors.Is(err, client.ErrConnectionRefused) {
return fmt.Errorf("failed to restart backend: %w", err)
}
return nil
}

What seems to be happening is that the ensureBackendStarted function reads credentials from the config while Rancher Desktop isn't running. Rancher Desktop generates new credentials when it starts, invalidating the credentials that the snapshot process originally read, leading to the 401 Unauthorized: user/password not accepted error.

const httpCredentialHelperServer = new HttpCredentialHelperServer();

@rak-phillip
Copy link
Contributor

We might want to consider modifying the ensureBackendStarted function to re-read credentials when attempting to restart the backend, especially in the event that we encounter the ErrConnectionRefused error.

@gaktive
Copy link
Contributor

gaktive commented Nov 17, 2023

Upon discussion, @jandubois to coordinate with @rak-phillip on updating both rdctl and the UI to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snapshots kind/bug Something isn't working platform/windows qase Issue is related to manual test in Qase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants