TOCTOU Bug in Circuit Breaker
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 131
- Forks
- 16
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 11
Description
In each test we create circuit breaker:
func New(name string, config Config) *CircuitBreaker {
breaker := manager.GetCircuit(name)
if breaker != nil {
return &CircuitBreaker{
Circuit: breaker,
}
}
/* ... */
breaker = manager.MustCreateCircuit(name, /* ... */)
}
Here we have a TOCTOU bug, which sometimes causes test to flap:
--- FAIL: TestColdStoreIntegration (21.99s)
--- FAIL: TestColdStoreIntegration/TestAgg (0.01s)
manager.go:69: test panicked: circuit with that name already exists
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at manager.go:69 and trace the New function and the manager circuit lookup and creation calls shown in the issue. Run TestColdStoreIntegration/TestAgg to reproduce the panic, then verify that concurrent circuit creation no longer reports that the circuit already exists and the test stops flapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100