gojek / heimdall

An enhanced HTTP client for Go
http://gojek.tech
Apache License 2.0
2.61k stars 217 forks source link

data race in hystrix client #137

Open ysuliu opened 1 year ago

ysuliu commented 1 year ago

We are facing the data race error using the latest code. After checking the history, you have recognized the same issue and proposed the fix in heimdall/pull/67. I have no idea why the fix hadn't been merged.

We can easily reproduce the error just by: 1, copy the unit test from test case to the latest code base. 2, run this test using "go test -race" several times

Note that, sometimes this is very easy to be reproduced (just run go test 3-5 rounds). But I also faced the case that I run about 20 rounds to get it reproduced.

==================
WARNING: DATA RACE
Write at 0x00c000191650 by goroutine 299:
  github.com/gojek/heimdall/v7/hystrix.(*Client).Do()
      /home/allen/src/go/src/gojek/heimdall/v7/hystrix/hystrix_client.go:189 +0x6b8
  github.com/gojek/heimdall/v7/hystrix.(*Client).Get()
      /home/allen/src/go/src/gojek/heimdall/v7/hystrix/hystrix_client.go:113 +0xe4
......

Previous write at 0x00c000191650 by goroutine 11006:
  github.com/gojek/heimdall/v7/hystrix.(*Client).Do.func1()
      /home/allen/src/go/src/gojek/heimdall/v7/hystrix/hystrix_client.go:190 +0xb6
  github.com/afex/hystrix-go/hystrix.Do.func1()
      /home/allen/src/go/src/github.com/afex/hystrix-go/hystrix/hystrix.go:204 +0x30
  github.com/afex/hystrix-go/hystrix.DoC.func1()
      /home/allen/src/go/src/github.com/afex/hystrix-go/hystrix/hystrix.go:221 +0x51
......

Could you please help to evaluate the issue and provide a fix? Thanks!

gwthm-in commented 5 months ago

https://github.com/gojek/heimdall/pull/67#issuecomment-701916482

As this is fixed, can we close this issue?