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

fix timeout when stopping KVM machine with CRI-O container runtime #19758

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

prezha
Copy link
Contributor

@prezha prezha commented Oct 7, 2024

we noticed in our integration tests that kvm machine with cri-o container runtime will sometime not gracefully shutdown waiting a given time of two minutes (eg: https://storage.googleapis.com/minikube-builds/logs/19736/36442/KVM_Linux_crio.html#fail_TestStartStop%2fgroup%2fembed-certs%2fserial%2fStop)

there is a known upstream issue that is tracking that

as we had similar issues in the past (and increased the timeout value several times), this pr aims to solve that problem by:

  • waiting initial 90 seconds for the kvm machine to gracefully stop, and if that fails, instead of terminating with error:
  • requesting a forceful shutdown (ie, "destroy" in libvirt) and waiting for another 30 seconds

in total, this should: self-resolve the issue in many cases, while reducing the total wait period

bonus:

  • ensure any error from trying to close connection/domain is caught and logged but does not overwrite the underlying error
  • more consistent error handling
  • more consistent logging

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 7, 2024
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 7, 2024
@prezha
Copy link
Contributor Author

prezha commented Oct 7, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Oct 7, 2024
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot

This comment has been minimized.

@spowelljr
Copy link
Member

Hi @prezha, following up on this according to cri-o/cri-o#8609 (comment), this was fixed in crun 1.17. We've updated to crun 1.17 in #19640, is this PR still needed?

@prezha
Copy link
Contributor Author

prezha commented Oct 25, 2024

hey @spowelljr, i think we do as we've occasionally seen these timeouts even before (for reasons related to other/different issues), so it would also reduce the flakiness of our integration tests

pkg/drivers/kvm/kvm.go Outdated Show resolved Hide resolved
pkg/drivers/kvm/kvm.go Outdated Show resolved Hide resolved
}

if d.ExtraDisks > 20 {
// Limiting the number of disks to 20 arbitrarily. If more disks are
// needed, the logical name generation has to changed to create them if
// the form hdaa, hdab, etc
return errors.Wrap(err, "cannot create more than 20 extra disks")
return errors.New("creating more than 20 extra disks")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The before message is a better user facing error, cannot create vs creating, although we should have validation for this way before

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, reworded it

prezha and others added 3 commits October 25, 2024 19:54
Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>
Co-authored-by: Steven Powell <44844360+spowelljr@users.noreply.github.com>
@minikube-pr-bot

This comment has been minimized.

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 19758) |
+----------------+----------+---------------------+
| minikube start | 52.5s    | 51.2s               |
| enable ingress | 18.4s    | 18.0s               |
+----------------+----------+---------------------+

Times for minikube ingress: 16.6s 19.1s 19.6s 19.5s 17.1s
Times for minikube (PR 19758) ingress: 18.6s 16.6s 19.1s 19.1s 16.6s

Times for minikube start: 52.2s 53.5s 49.5s 52.9s 54.3s
Times for minikube (PR 19758) start: 51.5s 54.4s 49.8s 48.3s 51.9s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 19758) |
+----------------+----------+---------------------+
| minikube start | 23.6s    | 24.0s               |
| enable ingress | 13.0s    | 12.8s               |
+----------------+----------+---------------------+

Times for minikube start: 24.7s 24.4s 21.6s 22.4s 25.0s
Times for minikube (PR 19758) start: 24.7s 22.3s 25.2s 22.4s 25.3s

Times for minikube ingress: 13.8s 12.3s 12.9s 13.3s 12.8s
Times for minikube (PR 19758) ingress: 13.3s 12.4s 13.3s 12.3s 12.9s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 19758) |
+----------------+----------+---------------------+
| minikube start | 23.1s    | 21.3s               |
| enable ingress | 28.8s    | 33.2s               |
+----------------+----------+---------------------+

Times for minikube start: 23.0s 21.2s 23.9s 22.8s 24.6s
Times for minikube (PR 19758) start: 20.6s 20.8s 20.9s 21.0s 23.2s

Times for minikube ingress: 22.8s 31.8s 27.8s 22.8s 38.8s
Times for minikube (PR 19758) ingress: 28.9s 30.8s 38.8s 38.8s 28.8s

@minikube-pr-bot

This comment has been minimized.

Copy link
Member

@spowelljr spowelljr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a typo, but the tests look good!

}

return fmt.Errorf("unable to stop vm, current state %q", s.String())
return s, fmt.Errorf("timed out waitig for domain %s, current state is %q", method, s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return s, fmt.Errorf("timed out waitig for domain %s, current state is %q", method, s)
return s, fmt.Errorf("timed out waiting for domain %s, current state is %q", method, s)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: prezha, spowelljr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@minikube-pr-bot
Copy link

Here are the number of top 10 failed tests in each environments with lowest flake rate.

Environment Test Name Flake Rate
Docker_Linux_containerd_arm64 (1 failed) TestFunctional/parallel/MountCmd/specific-port(gopogh) 0.00% (chart)
KVM_Linux (1 failed) TestFunctional/parallel/MountCmd/specific-port(gopogh) 0.00% (chart)

Besides the following environments also have failed tests:

To see the flake rates of all tests by environment, click here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants