Skip to content

Fix AssertionError when ServiceTalk context captured with no activeSpan #8951

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ygree
Copy link
Contributor

@ygree ygree commented Jun 9, 2025

What Does This Do

Fixes

java.lang.AssertionError
	at datadog.trace.core.scopemanager.ContinuableScopeManager.activate(ContinuableScopeManager.java:144)
	at datadog.trace.core.scopemanager.ContinuableScopeManager.activateSpan(ContinuableScopeManager.java:94)
	at datadog.trace.core.CoreTracer.activateSpan(CoreTracer.java:906)
	at org.spockframework.mock.runtime.ByteBuddyMethodInvoker.respond(ByteBuddyMethodInvoker.java:20)
	at org.spockframework.mock.runtime.MockInvocation.callRealMethod(MockInvocation.java:61)
	at org.spockframework.mock.CallRealMethodResponse.respond(CallRealMethodResponse.java:30)
	at org.spockframework.mock.runtime.MockController.handle(MockController.java:50)
	at org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:86)
	at org.spockframework.mock.runtime.ByteBuddyInterceptorAdapter.interceptNonAbstract(ByteBuddyInterceptorAdapter.java:35)
	at datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan(AgentTracer.java:87)
	at datadog.trace.instrumentation.servicetalk0_42_56.DatadogCapturedContextProvider$WithDatadogCapturedContext.attachContext(DatadogCapturedContextProvider.java:43)
	at ContextPreservingInstrumentationTest.capturedContext without activeSpan_closure4(ContextPreservingInstrumentationTest.groovy:37)
	at ContextPreservingInstrumentationTest.capturedContext without activeSpan_closure4(ContextPreservingInstrumentationTest.groovy)
	at groovy.lang.Closure.call(Closure.java:412)
	at groovy.lang.Closure.call(Closure.java:406)
	at groovy.lang.Closure.run(Closure.java:493)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@ygree ygree added this to the 1.50.0 milestone Jun 9, 2025
@ygree ygree self-assigned this Jun 9, 2025
@ygree ygree added type: bug inst: others All other instrumentations labels Jun 9, 2025
@ygree ygree marked this pull request as ready for review June 9, 2025 23:47
@ygree ygree requested a review from a team as a code owner June 9, 2025 23:47
@pr-commenter
Copy link

pr-commenter bot commented Jun 10, 2025

Benchmarks

Startup

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-06-10T16:36:24 2025-06-10T16:47:40
git_branch master ygree/fix-servicetalk-assertion-error
git_commit_date 1749044153 1749572659
git_commit_sha 7787af7 aeeac4a
release_version 1.50.0-SNAPSHOT~7787af738f 1.50.0-SNAPSHOT~aeeac4ad9d
start_time 2025-06-10T16:36:10 2025-06-10T16:47:26
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1749575217 1749575217
ci_job_id 975558081 975558081
ci_pipeline_id 67385058 67385058
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-wygnhpf-project-304-concurrent-0-flr82c39 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-wygnhpf-project-304-concurrent-0-flr82c39 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
thresholds_or_results results results
variant iast iast

Summary

Found 1 performance improvements and 4 performance regressions! Performance is the same for 8 metrics, 17 unstable metrics.

scenario Δ mean http_req_duration Δ mean throughput candidate mean http_req_duration candidate mean throughput baseline mean http_req_duration baseline mean throughput
scenario:load:petclinic:appsec worse
[+6.599ms; +6.731ms] or [+411.459%; +419.685%]
unstable
[-3996.463op/s; +29.203op/s] or [-154.863%; +1.132%]
8.268ms 597.015op/s 1.604ms 2580.645op/s
scenario:load:petclinic:code_origins worse
[+1.784ms; +1.849ms] or [+24.234%; +25.123%]
worse
[-150.903op/s; -118.184op/s] or [-22.447%; -17.580%]
9.177ms 537.725op/s 7.360ms 672.269op/s
scenario:load:petclinic:profiling worse
[+6.075ms; +6.222ms] or [+263.160%; +269.508%]
unstable
[-2729.458op/s; +167.948op/s] or [-146.708%; +9.027%]
8.457ms 579.710op/s 2.309ms 1860.465op/s
scenario:load:petclinic:tracing better
[-2.967ms; -2.843ms] or [-27.217%; -26.077%]
unstable
[+131.347op/s; +190.331op/s] or [+28.896%; +41.873%]
7.997ms 615.385op/s 10.902ms 454.545op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~aeeac4ad9d, baseline=1.50.0-SNAPSHOT~7787af738f
    dateFormat X
    axisFormat %s
section baseline
no_agent (379.301 µs) : 359, 399
.   : milestone, 379,
iast (525.442 µs) : 504, 547
.   : milestone, 525,
iast_FULL (739.153 µs) : 716, 763
.   : milestone, 739,
iast_GLOBAL (577.294 µs) : 554, 601
.   : milestone, 577,
iast_HARDCODED_SECRET_DISABLED (522.953 µs) : 501, 545
.   : milestone, 523,
iast_INACTIVE (474.041 µs) : 451, 497
.   : milestone, 474,
iast_TELEMETRY_OFF (520.171 µs) : 497, 544
.   : milestone, 520,
tracing (475.608 µs) : 453, 498
.   : milestone, 476,
section candidate
no_agent (379.168 µs) : 359, 399
.   : milestone, 379,
iast (533.595 µs) : 510, 557
.   : milestone, 534,
iast_FULL (739.043 µs) : 715, 763
.   : milestone, 739,
iast_GLOBAL (569.518 µs) : 547, 592
.   : milestone, 570,
iast_HARDCODED_SECRET_DISABLED (527.41 µs) : 506, 549
.   : milestone, 527,
iast_INACTIVE (480.223 µs) : 457, 503
.   : milestone, 480,
iast_TELEMETRY_OFF (514.024 µs) : 492, 536
.   : milestone, 514,
tracing (465.44 µs) : 443, 487
.   : milestone, 465,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 379.301 µs [359.133 µs, 399.468 µs] -
iast 525.442 µs [503.607 µs, 547.277 µs] 146.142 µs (38.5%)
iast_FULL 739.153 µs [715.649 µs, 762.656 µs] 359.852 µs (94.9%)
iast_GLOBAL 577.294 µs [553.875 µs, 600.713 µs] 197.994 µs (52.2%)
iast_HARDCODED_SECRET_DISABLED 522.953 µs [501.224 µs, 544.682 µs] 143.652 µs (37.9%)
iast_INACTIVE 474.041 µs [451.304 µs, 496.779 µs] 94.74 µs (25.0%)
iast_TELEMETRY_OFF 520.171 µs [496.814 µs, 543.527 µs] 140.87 µs (37.1%)
tracing 475.608 µs [453.439 µs, 497.777 µs] 96.307 µs (25.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 379.168 µs [359.038 µs, 399.297 µs] -
iast 533.595 µs [510.349 µs, 556.841 µs] 154.427 µs (40.7%)
iast_FULL 739.043 µs [715.32 µs, 762.765 µs] 359.875 µs (94.9%)
iast_GLOBAL 569.518 µs [547.318 µs, 591.719 µs] 190.351 µs (50.2%)
iast_HARDCODED_SECRET_DISABLED 527.41 µs [505.815 µs, 549.004 µs] 148.242 µs (39.1%)
iast_INACTIVE 480.223 µs [457.207 µs, 503.238 µs] 101.055 µs (26.7%)
iast_TELEMETRY_OFF 514.024 µs [491.954 µs, 536.093 µs] 134.856 µs (35.6%)
tracing 465.44 µs [443.465 µs, 487.415 µs] 86.272 µs (22.8%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~aeeac4ad9d, baseline=1.50.0-SNAPSHOT~7787af738f
    dateFormat X
    axisFormat %s
section baseline
no_agent (8.719 ms) : 8696, 8742
.   : milestone, 8719,
appsec (1.604 ms) : 1521, 1686
.   : milestone, 1604,
appsec_no_iast (906.004 µs) : 839, 973
.   : milestone, 906,
code_origins (7.36 ms) : 7331, 7390
.   : milestone, 7360,
iast (258.628 µs) : 216, 302
.   : milestone, 259,
profiling (2.309 ms) : 2217, 2400
.   : milestone, 2309,
tracing (10.902 ms) : 10824, 10979
.   : milestone, 10902,
section candidate
no_agent (8.698 ms) : 8676, 8720
.   : milestone, 8698,
appsec (8.268 ms) : 8242, 8295
.   : milestone, 8268,
appsec_no_iast (8.29 ms) : 8263, 8316
.   : milestone, 8290,
code_origins (9.177 ms) : 9146, 9208
.   : milestone, 9177,
iast (8.073 ms) : 8046, 8100
.   : milestone, 8073,
profiling (8.457 ms) : 8426, 8488
.   : milestone, 8457,
tracing (7.997 ms) : 7971, 8023
.   : milestone, 7997,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 8.719 ms [8.696 ms, 8.742 ms] -
appsec 1.604 ms [1.521 ms, 1.686 ms] -7.115 ms (-81.6%)
appsec_no_iast 906.004 µs [839.139 µs, 972.868 µs] -7.813 ms (-89.6%)
code_origins 7.36 ms [7.331 ms, 7.39 ms] -1.358 ms (-15.6%)
iast 258.628 µs [215.51 µs, 301.747 µs] -8.46 ms (-97.0%)
profiling 2.309 ms [2.217 ms, 2.4 ms] -6.41 ms (-73.5%)
tracing 10.902 ms [10.824 ms, 10.979 ms] 2.183 ms (25.0%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 8.698 ms [8.676 ms, 8.72 ms] -
appsec 8.268 ms [8.242 ms, 8.295 ms] -429.623 µs (-4.9%)
appsec_no_iast 8.29 ms [8.263 ms, 8.316 ms] -408.47 µs (-4.7%)
code_origins 9.177 ms [9.146 ms, 9.208 ms] 478.96 µs (5.5%)
iast 8.073 ms [8.046 ms, 8.1 ms] -625.333 µs (-7.2%)
profiling 8.457 ms [8.426 ms, 8.488 ms] -241.132 µs (-2.8%)
tracing 7.997 ms [7.971 ms, 8.023 ms] -701.166 µs (-8.1%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master ygree/fix-servicetalk-assertion-error
git_commit_date 1749044153 1749572659
git_commit_sha 7787af7 aeeac4a
release_version 1.50.0-SNAPSHOT~7787af738f 1.50.0-SNAPSHOT~aeeac4ad9d
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1749574771 1749574771
ci_job_id 975558082 975558082
ci_pipeline_id 67385058 67385058
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-qys7bcb-project-304-concurrent-1-5zp28r28 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-qys7bcb-project-304-concurrent-1-5zp28r28 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant appsec appsec

Summary

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

Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~aeeac4ad9d, baseline=1.50.0-SNAPSHOT~7787af738f
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.849 s) : 14849000, 14849000
.   : milestone, 14849000,
appsec (14.626 s) : 14626000, 14626000
.   : milestone, 14626000,
iast (18.716 s) : 18716000, 18716000
.   : milestone, 18716000,
iast_GLOBAL (17.953 s) : 17953000, 17953000
.   : milestone, 17953000,
profiling (15.17 s) : 15170000, 15170000
.   : milestone, 15170000,
tracing (15.189 s) : 15189000, 15189000
.   : milestone, 15189000,
section candidate
no_agent (15.283 s) : 15283000, 15283000
.   : milestone, 15283000,
appsec (14.912 s) : 14912000, 14912000
.   : milestone, 14912000,
iast (19.132 s) : 19132000, 19132000
.   : milestone, 19132000,
iast_GLOBAL (18.316 s) : 18316000, 18316000
.   : milestone, 18316000,
profiling (15.267 s) : 15267000, 15267000
.   : milestone, 15267000,
tracing (14.993 s) : 14993000, 14993000
.   : milestone, 14993000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.849 s [14.849 s, 14.849 s] -
appsec 14.626 s [14.626 s, 14.626 s] -223.0 ms (-1.5%)
iast 18.716 s [18.716 s, 18.716 s] 3.867 s (26.0%)
iast_GLOBAL 17.953 s [17.953 s, 17.953 s] 3.104 s (20.9%)
profiling 15.17 s [15.17 s, 15.17 s] 321.0 ms (2.2%)
tracing 15.189 s [15.189 s, 15.189 s] 340.0 ms (2.3%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.283 s [15.283 s, 15.283 s] -
appsec 14.912 s [14.912 s, 14.912 s] -371.0 ms (-2.4%)
iast 19.132 s [19.132 s, 19.132 s] 3.849 s (25.2%)
iast_GLOBAL 18.316 s [18.316 s, 18.316 s] 3.033 s (19.8%)
profiling 15.267 s [15.267 s, 15.267 s] -16.0 ms (-0.1%)
tracing 14.993 s [14.993 s, 14.993 s] -290.0 ms (-1.9%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~aeeac4ad9d, baseline=1.50.0-SNAPSHOT~7787af738f
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.48 ms) : 1469, 1492
.   : milestone, 1480,
appsec (2.418 ms) : 2369, 2466
.   : milestone, 2418,
iast (2.196 ms) : 2135, 2257
.   : milestone, 2196,
iast_GLOBAL (2.239 ms) : 2178, 2301
.   : milestone, 2239,
profiling (2.056 ms) : 2006, 2106
.   : milestone, 2056,
tracing (2.002 ms) : 1955, 2049
.   : milestone, 2002,
section candidate
no_agent (1.479 ms) : 1468, 1491
.   : milestone, 1479,
appsec (2.409 ms) : 2361, 2457
.   : milestone, 2409,
iast (2.194 ms) : 2133, 2255
.   : milestone, 2194,
iast_GLOBAL (2.224 ms) : 2163, 2285
.   : milestone, 2224,
profiling (2.036 ms) : 1987, 2085
.   : milestone, 2036,
tracing (2.022 ms) : 1974, 2070
.   : milestone, 2022,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.48 ms [1.469 ms, 1.492 ms] -
appsec 2.418 ms [2.369 ms, 2.466 ms] 937.261 µs (63.3%)
iast 2.196 ms [2.135 ms, 2.257 ms] 715.889 µs (48.4%)
iast_GLOBAL 2.239 ms [2.178 ms, 2.301 ms] 758.915 µs (51.3%)
profiling 2.056 ms [2.006 ms, 2.106 ms] 575.418 µs (38.9%)
tracing 2.002 ms [1.955 ms, 2.049 ms] 521.983 µs (35.3%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.479 ms [1.468 ms, 1.491 ms] -
appsec 2.409 ms [2.361 ms, 2.457 ms] 929.353 µs (62.8%)
iast 2.194 ms [2.133 ms, 2.255 ms] 714.609 µs (48.3%)
iast_GLOBAL 2.224 ms [2.163 ms, 2.285 ms] 744.389 µs (50.3%)
profiling 2.036 ms [1.987 ms, 2.085 ms] 556.551 µs (37.6%)
tracing 2.022 ms [1.974 ms, 2.07 ms] 542.674 µs (36.7%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: others All other instrumentations type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant