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

adjust warn if slow for removing docker volumes #7408

Closed
medyagh opened this issue Apr 4, 2020 · 1 comment Β· Fixed by #7410
Closed

adjust warn if slow for removing docker volumes #7408

medyagh opened this issue Apr 4, 2020 · 1 comment Β· Fixed by #7410
Labels
co/docker-driver Issues related to kubernetes in container

Comments

@medyagh
Copy link
Member

medyagh commented Apr 4, 2020

medmac@~/workspace/minikube (wait_sa2) $ ./out/minikube delete --all
❗  Executing "docker volume rm --force minikube" took an unusually long time: 2.095775097s
πŸ’‘  Restarting the docker service may improve performance.

the warn should give a bit more time for removing a docker volume, that one is legit .
but for other tasks such as inspect, it should still warn more than 2 secs

// WarnIfSlow runs an oci command, warning about performance issues
func WarnIfSlow(arg ...string) ([]byte, error) {
	killTime := 15 * time.Second
	warnTime := 2 * time.Second

	ctx, cancel := context.WithTimeout(context.Background(), killTime)
	defer cancel()

	start := time.Now()
	glog.Infof("executing with %s timeout: %v", arg, killTime)
	cmd := exec.CommandContext(ctx, arg[0], arg[1:]...)
	stdout, err := cmd.Output()
	d := time.Since(start)
	if d > warnTime {
		out.WarningT(`Executing "{{.command}}" took an unusually long time: {{.duration}}`, out.V{"command": strings.Join(cmd.Args, " "), "duration": d})
		out.ErrT(out.Tip, `Restarting the {{.name}} service may improve performance.`, out.V{"name": arg[0]})
	}

	if ctx.Err() == context.DeadlineExceeded {
		return stdout, fmt.Errorf("%q timed out after %s", strings.Join(cmd.Args, " "), killTime)
	}
	if err != nil {
		if exitErr, ok := err.(*exec.ExitError); ok {
			return stdout, fmt.Errorf("%q failed: %v: %s", strings.Join(cmd.Args, " "), exitErr, exitErr.Stderr)
		}
		return stdout, fmt.Errorf("%q failed: %v", strings.Join(cmd.Args, " "), err)
	}
	return stdout, nil
}

@afbjorklund
Copy link
Collaborator

afbjorklund commented Apr 4, 2020

Why do we delete the docker volumes, when running e.g. the virtualbox driver ?

$ minikube start
πŸ˜„  minikube v1.9.1 on Ubuntu 16.04
✨  Using the virtualbox driver based on user configuration
πŸ‘  Starting control plane node m01 in cluster minikube
πŸ”₯  Creating virtualbox VM (CPUs=2, Memory=2200MB, Disk=20000MB) ...
❗  Unable to verify SSH connectivity: dial tcp 192.168.99.100:22: i/o timeout. Will retry...
❗  Unable to verify SSH connectivity: dial tcp 192.168.99.100:22: i/o timeout. Will retry...
🐳  Preparing Kubernetes v1.18.0 on Docker 19.03.8 ...
🌟  Enabling addons: default-storageclass, storage-provisioner
πŸ„  Done! kubectl is now configured to use "minikube"
$ minikube delete
❗  Executing "docker volume prune -f --filter label=name.minikube.sigs.k8s.io=minikube" took an unusually long time: 15.004494256s
πŸ’‘  Restarting the docker service may improve performance.
πŸ”₯  Deleting "minikube" in virtualbox ...
πŸ’€  Removed all traces of the "minikube" cluster.

@afbjorklund afbjorklund added the co/docker-driver Issues related to kubernetes in container label Apr 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/docker-driver Issues related to kubernetes in container
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants