Skip to content

fix(ddtrace/tracer): replace RLock with Lock for NoDebugStack check to prevent race condition #3446

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

Merged
merged 1 commit into from
Apr 16, 2025

Conversation

darccio
Copy link
Member

@darccio darccio commented Apr 16, 2025

What does this PR do?

Reduces to a single locking operation everything in Finish's NoDebugStack.

Motivation

Per @felixge's comment, there is a potential race condition in the NoDebugStack when finishing a span.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running golangci-lint run locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 16, 2025

Datadog Report

Branch report: dario.castane/single-lock-on-nodebugstack-finish
Commit report: 295b632
Test service: dd-trace-go

✅ 0 Failed, 4481 Passed, 64 Skipped, 3m 46.43s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Apr 16, 2025

Benchmarks

Benchmark execution time: 2025-04-16 13:36:12

Comparing candidate commit 8d7ee8a in PR branch dario.castane/single-lock-on-nodebugstack-finish with baseline commit f3d284b in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 55 metrics, 1 unstable metrics.

@darccio darccio merged commit 05ae714 into main Apr 16, 2025
180 checks passed
@darccio darccio deleted the dario.castane/single-lock-on-nodebugstack-finish branch April 16, 2025 16:11
darccio added a commit that referenced this pull request Apr 16, 2025
@darccio darccio added the v2.0 label Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants