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: Host Scopes not being removed #2624

Merged
merged 4 commits into from
Apr 15, 2024
Merged

fix: Host Scopes not being removed #2624

merged 4 commits into from
Apr 15, 2024

Conversation

PROFeNoM
Copy link
Contributor

Description

May address #2592

Using the reproducer added as a test, the host scopes would keep on growing, hence slowly but surely increasing memory usage

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@PROFeNoM PROFeNoM self-assigned this Apr 15, 2024
@PROFeNoM PROFeNoM requested a review from a team as a code owner April 15, 2024 15:32
@@ -82,6 +82,8 @@ public function deactivate(Scope $scope)
if ($span instanceof Span && ObjectKVStore::get($span->internalSpan, 'ddtrace_scope_activated') !== null) {
ObjectKVStore::put($span->internalSpan, 'ddtrace_scope_activated', false);
}

array_splice($this->hostRootScopes, array_search($scope, $this->hostRootScopes, true), 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erratum: I may have to check for the index; will do it later as soon as I can

@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2024

Codecov Report

Merging #2624 (840fcf6) into master (e721e34) will increase coverage by 1.60%.
Report is 3 commits behind head on master.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2624      +/-   ##
============================================
+ Coverage     77.64%   79.25%   +1.60%     
- Complexity     2226     2229       +3     
============================================
  Files           226      200      -26     
  Lines         25942    21949    -3993     
  Branches        986        0     -986     
============================================
- Hits          20142    17395    -2747     
+ Misses         5274     4554     -720     
+ Partials        526        0     -526     
Flag Coverage Δ
appsec-extension ?
tracer-extension 78.54% <ø> (ø)
tracer-php 80.24% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/DDTrace/ScopeManager.php 100.00% <100.00%> (+5.00%) ⬆️
src/DDTrace/Tracer.php 82.43% <100.00%> (+0.11%) ⬆️

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e721e34...840fcf6. Read the comment docs.

@pr-commenter
Copy link

pr-commenter bot commented Apr 15, 2024

Benchmarks

Benchmark execution time: 2024-04-15 18:22:40

Comparing candidate commit 840fcf6 in PR branch alex/issue/gh2592 with baseline commit e721e34 in branch master.

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

scenario:ContextPropagationBench/benchInject64Bit

  • 🟩 execution_time [-610.536ns; -299.464ns] or [-8.089%; -3.967%]

scenario:PDOBench/benchPDOBaseline

  • 🟩 execution_time [-18.636µs; -17.704µs] or [-9.904%; -9.409%]

scenario:PDOBench/benchPDOOverhead

  • 🟩 execution_time [-18.120µs; -17.025µs] or [-9.656%; -9.073%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • 🟩 execution_time [-18.051µs; -17.184µs] or [-9.634%; -9.172%]

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • 🟩 execution_time [-550.772ns; -263.028ns] or [-8.486%; -4.053%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2

  • 🟩 execution_time [-407.922ns; -171.878ns] or [-6.284%; -2.648%]

scenario:TraceSerializationBench/benchSerializeTrace

  • 🟥 execution_time [+15.709µs; +20.391µs] or [+8.803%; +11.427%]

Copy link
Collaborator

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting. This is indeed suspicious.

Nice catch. Thanks!

@bwoebi bwoebi merged commit f6dab57 into master Apr 15, 2024
532 of 556 checks passed
@bwoebi bwoebi deleted the alex/issue/gh2592 branch April 15, 2024 20:06
@github-actions github-actions bot added this to the 0.99.0 milestone Apr 15, 2024
@bwoebi bwoebi modified the milestones: 0.99.0, 1.0.0beta1 Apr 15, 2024
morrisonlevi pushed a commit that referenced this pull request Apr 16, 2024
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.

3 participants