pingcap / pingcap/tiup

Retry function timeout parameter invalid

Open
#2,037 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/bug
Dominant language
Go
Stars
466
Forks
338
Avg merge
3d 7h
Merged PRs (30d)
8

Description

Bug Report

https://github.com/pingcap/tiup/blob/master/pkg/utils/retry.go#L80-L92

        for attemptCount = 0; attemptCount < cfg.Attempts; attemptCount++ {
		if err := doFunc(); err == nil {
			return nil
		}

		// check for timeout
		select {
		case <-timeoutChan:
			return fmt.Errorf("operation timed out after %s", cfg.Timeout)
		default:
			time.Sleep(cfg.Delay)
		}
	}

It looks like the Retry function will always wait for doFunc() to complete and then check the timeout channel.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pkg/utils/retry.go lines 80-92 and trace how Retry handles the timeout around doFunc(). Reproduce the behavior with a focused test for a long-running doFunc, then verify that the timeout behavior matches the intended semantics and the test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.