requestWithStats will have data race in some edge cases
mkungla opened this issue · 0 comments
mkungla commented
Describe the bug
Some edge cases when request context is canceled while request with httptrace.WithClientTrace
is busy can cause data race,
Line 195 in 2c4a006
https://pkg.go.dev/net/http/httptrace#ContextClientTrace
ClientTrace is a set of hooks to run at various stages of an outgoing HTTP request. Any particular hook may be nil. Functions may be called concurrently from different goroutines and some may be called after the request has completed or failed.
To Reproduce
Steps to reproduce the behavior:
- When context is canceled nanoseconds after rate limiter allows next request