Skip to content

RUM-790 Fix PendingTrace ConcurrentModificationException#1623

Merged
xgouchet merged 2 commits into
developfrom
xgouchet/RUM-790/pending_trace
Sep 19, 2023
Merged

RUM-790 Fix PendingTrace ConcurrentModificationException#1623
xgouchet merged 2 commits into
developfrom
xgouchet/RUM-790/pending_trace

Conversation

@xgouchet

Copy link
Copy Markdown
Contributor

What does this PR do?

Add some thread safe guards for PendingTrace, and prevent ConcurrentModificationException.

Additional Notes

Fixes #1570

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@xgouchet
xgouchet requested a review from a team as a code owner September 19, 2023 10:22
@xgouchet
xgouchet force-pushed the xgouchet/RUM-790/pending_trace branch from 81b4e13 to bbfb51e Compare September 19, 2023 11:50
@xgouchet xgouchet changed the title Xgouchet/rum 790/pending trace RUM-790 Fix PendingTrace ConcurrentModificationException Sep 19, 2023
} else {
if (!isWritten.get()) {
addFirst(span);
} else {

@jonathanmos jonathanmos Sep 19, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is the empty else block intentional?

countDownLatch.await(20, TimeUnit.SECONDS)

// Then
assertThat(countDownLatch.count).isZero()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this assertion? Doesn't countdownlatch.await block until timeout or reaching a count of zero?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes we do, in case the await reaches timeout.

@codecov-commenter

codecov-commenter commented Sep 19, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1623 (c8fe700) into develop (2903002) will increase coverage by 0.16%.
Report is 5 commits behind head on develop.
The diff coverage is 46.15%.

@@             Coverage Diff             @@
##           develop    #1623      +/-   ##
===========================================
+ Coverage    83.57%   83.73%   +0.16%     
===========================================
  Files          452      452              
  Lines        15652    15656       +4     
  Branches      2324     2323       -1     
===========================================
+ Hits         13081    13109      +28     
+ Misses        1950     1932      -18     
+ Partials       621      615       -6     
Files Changed Coverage Δ
...ain/java/com/datadog/opentracing/PendingTrace.java 70.73% <46.15%> (+11.25%) ⬆️

... and 20 files with indirect coverage changes

if (span.getDurationNano() == 0) {
return;
}
if (traceId == null || span.context() == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm assuming that the reason all fail fast conditionals are separated is so that we can figure out exactly which one caused the problem in a stacktrace. If so, perhaps we should split this one also?

@xgouchet
xgouchet merged commit 9ef76a9 into develop Sep 19, 2023
@xgouchet
xgouchet deleted the xgouchet/RUM-790/pending_trace branch September 19, 2023 17:15
@xgouchet xgouchet added this to the 2.2.0 milestone Dec 13, 2023
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.

ConcurrentModificationException in TracingInterceptor

4 participants