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

fix datarace for parallel http client request #100

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

t-yuki
Copy link
Contributor

@t-yuki t-yuki commented Apr 3, 2019

There is a datarace problem on xray/segement_model.go when I use xray RoundTripper for parallel requests in a http handler like:

client -IncomingHeader-> handler
                            |-RoundTrip-> request1
                            |-RoundTrip-> request2

Since Segment.IncomingHeader object is shared across requests, modifying IncomingHeader in DownstreamHeader func will cause a datarace.
In this patch, DownstreamHeader never rewrite original IncomingHeader object.
Instead, it returns a modified copy of IncomingHeader for each call if available.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@t-yuki t-yuki force-pushed the fix-datarace-parallel-http-client branch from 4fd8895 to f09da60 Compare April 4, 2019 02:46
@luluzhao luluzhao merged commit e44e77c into aws:master Apr 30, 2019
logan pushed a commit to logan/aws-xray-sdk-go that referenced this pull request Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants