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

requestWithStats will have data race in some edge cases #15

Open
mkungla opened this issue Mar 17, 2022 · 0 comments
Open

requestWithStats will have data race in some edge cases #15

mkungla opened this issue Mar 17, 2022 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mkungla
Copy link
Member

mkungla commented Mar 17, 2022

Describe the bug

Some edge cases when request context is canceled while request with httptrace.WithClientTrace is busy can cause data race,

func (c *Client) requestWithStats(req *http.Request, res *Response) (*http.Response, error) {

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:

  1. When context is canceled nanoseconds after rate limiter allows next request
@mkungla mkungla added bug Something isn't working help wanted Extra attention is needed labels Mar 17, 2022
@mkungla mkungla added this to the v1.0.0 milestone Mar 17, 2022
@mkungla mkungla removed this from the koios-go-client v1.0.0 milestone Apr 10, 2022
@mkungla mkungla added this to the koios-go-client v2.0.0 milestone Apr 28, 2022
@mkungla mkungla removed this from the koios-go-client v2.0.0 milestone Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant