Open dcu opened 4 years ago
Hi @dcu ,
would you mind describing your application setup and provide repro steps ?
Looks like data race is not happening within X-Ray SDK but when this goroutine (https://github.com/aws/aws-xray-sdk-go/blob/master/strategy/sampling/centralized.go#L206) tries to make a http request, this codebase (https://github.com/jarcoal/httpmock/blob/v1/transport.go#L716) from httpmock library updates the value of http.DefaultTransport.
is there a way to disable xray so I can do that in my tests?
Hi @dcu ,
Sorry for the inconvenience. Currently we don't have support for disabling XRay in XRay Go SDK. We have a pending item in our backlog to support this feature. Meanwhile I am looking more into this issue to see if we can provide any work around to avoid this issue.
maybe allowing to set my own transport or http client
Hi @dcu ,
That's a good idea I will look more into it to see if we can do that. Also, I'm currently working on disabling XRay Go SDK using environment variable (https://github.com/aws/aws-xray-sdk-go/pull/219). Let me know if this will be able to solve your issue. Would you mind trying this change out and provide your feedback ?
I just did, setting AWS_XRAY_SDK_DISABLED to TRUE works and doesn't produce a race condition in my tests.
Still I think you should also allow to set the http client since the default one is not great, pool size is too limited and timeouts are not configured by default
Hi @dcu ,
That's good to hear. Would you mind providing more details about http client approach you're talking about ? I want to understand more on that so that we can provide best possible solution to avoid this issue.
from what I see, XRay is using the default HTTP client to send the data to its API. It'd be better if you expose a way to change that client so I can use my own configured client.
In the offical AWS SDK you can configure this when creating a session.Session by passing a aws.Config but it doesn't seem possible to do that with the xray SDK
In your patch, if I disable xray would I still catch panics like this: failed to begin subsegment named 'kinesis': segment cannot be found.
?
No, Ideally you shouldn't receive those panics if you have disabled xray. Are you getting those panics ?
no I didn't test that. My concern is not catching those in tests but later after deployment
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
any news on this issue?
Hi @dcu ,
We still need to prioritize those efforts as you have mentioned (exposing a way to change default client while calling X-Ray API) in comments. I will put this item in our backlog. Meanwhile we have this PR ready to merge in (https://github.com/aws/aws-xray-sdk-go/pull/219). Let me know if you have any concerns about this PR and we can work accordingly.