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

"warn if docker is slow" logic doesnt work #19577

Open
medyagh opened this issue Sep 6, 2024 · 1 comment · May be fixed by #19580
Open

"warn if docker is slow" logic doesnt work #19577

medyagh opened this issue Sep 6, 2024 · 1 comment · May be fixed by #19580
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@medyagh
Copy link
Member

medyagh commented Sep 6, 2024

when trying to fix this issue #19576
that docker desktop Hangs on listing containers... I didnt get any warnninig from minikube that docker is slow and minikube hanged....

(only with a docker desktop Docker Desktop 4.34.0 with macos)

$ minikube delete --all --alsologtostderr
I0906 10:47:45.127199   28913 out.go:291] Setting OutFile to fd 1 ...
I0906 10:47:45.128263   28913 out.go:343] isatty.IsTerminal(1) = true
I0906 10:47:45.128272   28913 out.go:304] Setting ErrFile to fd 2...
I0906 10:47:45.128278   28913 out.go:343] isatty.IsTerminal(2) = true
I0906 10:47:45.128634   28913 root.go:338] Updating PATH: /Users/medya/.minikube/bin
I0906 10:47:45.130362   28913 out.go:298] Setting JSON to false
I0906 10:47:45.130901   28913 cli_runner.go:164] Run: docker ps -a --filter label=name.minikube.sigs.k8s.io --format {{.Names}}

I remembered that we had a logic that was supposed to Warn users but apparantly that logic doesnt work
here is the code that lists the containers in oci.go

// ListContainersByLabel returns all the container names with a specified label
func ListContainersByLabel(ctx context.Context, ociBin string, label string, warnSlow ...bool) ([]string, error) {
	rr, err := runCmd(exec.CommandContext(ctx, ociBin, "ps", "-a", "--filter", fmt.Sprintf("label=%s", label), "--format", "{{.Names}}"), warnSlow...)
	if err != nil {
		return nil, err
	}
	s := bufio.NewScanner(bytes.NewReader(rr.Stdout.Bytes()))
	var names []string
	for s.Scan() {
		n := strings.TrimSpace(s.Text())
		if n != "" {
			names = append(names, n)
		}
	}
	return names, s.Err()

and also here is the runCmd logic that was supposed to Warn users that the docker or podman is returning slow

the logic is in cli_runner.go

// runCmd runs a command exec.Command against docker daemon or podman
func runCmd(cmd *exec.Cmd, warnSlow ...bool) (*RunResult, error) {
	cmd = PrefixCmd(cmd)

	warn := false
	if len(warnSlow) > 0 {
		warn = warnSlow[0]
	}

	killTime := 19 * time.Second // this will be applied only if warnSlow is true
	warnTime := 2 * time.Second

we need to fix this code so it can be triggered the slowness of docker or podman. it really hurts user experience when they try to delete minikube and it just hangs ...without any info

to mock this , you can make a dummy "docker" binary in your path that Waits 10 minutes(to emulate a slow docker)

@medyagh medyagh added kind/bug Categorizes issue or PR as related to a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Sep 6, 2024
@xcarolan
Copy link
Contributor

xcarolan commented Sep 6, 2024

I'll take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants