Skip to content

fix(tracing): SpanStack::$active unset corruption#3962

Merged
morrisonlevi merged 5 commits into
masterfrom
levi/span-fixes-round2
Jun 8, 2026
Merged

fix(tracing): SpanStack::$active unset corruption#3962
morrisonlevi merged 5 commits into
masterfrom
levi/span-fixes-round2

Conversation

@morrisonlevi

@morrisonlevi morrisonlevi commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Both active and parent are supposed to be protected, but the handlers are currently a bit patchy. This adds a .phpt for unset specifically and makes the handlers more consistent with each other.

We're still seeing crashes in ddtrace_inherit_span_properties, so I'm continuing to spend time with AI agents to try and diagnose and fix them. The last batch had technical but unlikely fixes. This PR continues in that vein, but it does seem a little bit more likely that it might help.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 6, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 11 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-php | appsec code coverage   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | helper-rust code coverage   View in Datadog   GitLab

DataDog/apm-reliability/dd-trace-php | helper-rust integration coverage   View in Datadog   GitLab

View all 11 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 2 jobs - 1 passed on retry View in Datadog

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 309db71 | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented Jun 7, 2026

Copy link
Copy Markdown

Benchmarks [ tracer ]

Benchmark execution time: 2026-06-08 12:21:15

Comparing candidate commit 309db71 in PR branch levi/span-fixes-round2 with baseline commit 8b837e8 in branch master.

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:PDOBench/benchPDOOverhead

  • 🟥 execution_time [+8.995µs; +10.951µs] or [+3.479%; +4.235%]

scenario:PHPRedisBench/benchRedisOverhead

  • 🟥 execution_time [+30.057µs; +113.281µs] or [+3.234%; +12.188%]

Comment thread tests/ext/span_stack/span_stack_active_unset_child.phpt Outdated
Co-authored-by: Bob Weinand <bob.weinand@datadoghq.com>
@morrisonlevi morrisonlevi marked this pull request as ready for review June 8, 2026 11:40
@morrisonlevi morrisonlevi requested a review from a team as a code owner June 8, 2026 11:40
@morrisonlevi morrisonlevi merged commit 5c5fdb8 into master Jun 8, 2026
2123 of 2135 checks passed
@morrisonlevi morrisonlevi deleted the levi/span-fixes-round2 branch June 8, 2026 15:30
@github-actions github-actions Bot added this to the 1.22.0 milestone Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants