contrib/net/http: Copy span options and resource name to avoid data race#2204
Merged
Conversation
BenchmarksBenchmark execution time: 2023-09-06 14:13:21 Comparing candidate commit c2958d2 in PR branch Found 3 performance improvements and 0 performance regressions! Performance is the same for 37 metrics, 1 unstable metrics. scenario:BenchmarkHttpServeTrace-24
|
Contributor
Author
These aren't real performance improvements. They appear here because the benchmark was improved to focus on the |
ajgajg1134
marked this pull request as ready for review
September 5, 2023 19:39
darccio
approved these changes
Sep 6, 2023
ajgajg1134
added a commit
that referenced
this pull request
Sep 6, 2023
ajgajg1134
added a commit
that referenced
this pull request
Sep 6, 2023
nsrip-dd
added a commit
that referenced
this pull request
Sep 9, 2024
With Go 1.23 released on 2024-08-13, we drop support for Go 1.21. This means Go 1.22 is now our minimum supported Go release. Update our CI files to reflect our current supported Go versions, and remove pre-Go 1.22 workarounds. In addition to the CI bumps, this PR changes/fixes a few things related to the upgrade: - Drops the old `rand` from the tracer, now that we can depend on `math/rand/v2`. - Uses `slices` in the appsec package. - The `TestWrapHandlerWithResourceNameNoRace` got a new data race. Specifically, by bumping our `go.mod` to 1.22, we get the new 1.22 ServeMux behavior internally. The 1.22 ServeMux modifies the Request, introducing a race with all the goroutines accessing/modifying the request concurrently. Fix it by giving each goroutine its own request. I verified that the test still catches the intended bug by reverting the fix from #2204 and verifying that the test fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Found a few data races in how we handle span options.
Motivation
The data race here could result in clobbered start span options for concurrent HTTP requests.
Reviewer's Checklist
For Datadog employees:
@DataDog/security-design-and-guidance.Unsure? Have a question? Request a review!