Do not leak call depth threadlocal in jdbc instrumentation#7468
Merged
Do not leak call depth threadlocal in jdbc instrumentation#7468
Conversation
PerfectSlayer
approved these changes
Aug 19, 2024
Contributor
PerfectSlayer
left a comment
There was a problem hiding this comment.
Thanks for the fix
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 48 metrics, 15 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.047 s) : 0, 1047093
Total [baseline] (8.492 s) : 0, 8491701
Agent [candidate] (1.065 s) : 0, 1064629
Total [candidate] (8.551 s) : 0, 8550608
section iast
Agent [baseline] (1.188 s) : 0, 1188499
Total [baseline] (9.042 s) : 0, 9042137
Agent [candidate] (1.175 s) : 0, 1175350
Total [candidate] (8.99 s) : 0, 8990398
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.176 s) : 0, 1175690
Total [baseline] (8.958 s) : 0, 8958246
Agent [candidate] (1.178 s) : 0, 1178319
Total [candidate] (8.968 s) : 0, 8968203
section iast_TELEMETRY_OFF
Agent [baseline] (1.181 s) : 0, 1180734
Total [baseline] (9.032 s) : 0, 9032000
Agent [candidate] (1.171 s) : 0, 1171315
Total [candidate] (8.992 s) : 0, 8992153
gantt
title insecure-bank - break down per module: candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (667.978 ms) : 0, 667978
BytebuddyAgent [candidate] (679.927 ms) : 0, 679927
GlobalTracer [baseline] (306.201 ms) : 0, 306201
GlobalTracer [candidate] (310.916 ms) : 0, 310916
AppSec [baseline] (51.166 ms) : 0, 51166
AppSec [candidate] (51.766 ms) : 0, 51766
Remote Config [baseline] (690.129 µs) : 0, 690
Remote Config [candidate] (694.485 µs) : 0, 694
Telemetry [baseline] (7.58 ms) : 0, 7580
Telemetry [candidate] (7.589 ms) : 0, 7589
section iast
BytebuddyAgent [baseline] (790.549 ms) : 0, 790549
BytebuddyAgent [candidate] (781.952 ms) : 0, 781952
GlobalTracer [baseline] (299.421 ms) : 0, 299421
GlobalTracer [candidate] (295.947 ms) : 0, 295947
AppSec [baseline] (51.077 ms) : 0, 51077
AppSec [candidate] (51.251 ms) : 0, 51251
Remote Config [baseline] (585.254 µs) : 0, 585
Remote Config [candidate] (596.22 µs) : 0, 596
Telemetry [baseline] (10.406 ms) : 0, 10406
Telemetry [candidate] (9.486 ms) : 0, 9486
IAST [baseline] (22.843 ms) : 0, 22843
IAST [candidate] (22.612 ms) : 0, 22612
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (781.756 ms) : 0, 781756
BytebuddyAgent [candidate] (782.971 ms) : 0, 782971
GlobalTracer [baseline] (296.332 ms) : 0, 296332
GlobalTracer [candidate] (297.618 ms) : 0, 297618
AppSec [baseline] (48.596 ms) : 0, 48596
AppSec [candidate] (48.766 ms) : 0, 48766
Remote Config [baseline] (577.564 µs) : 0, 578
Remote Config [candidate] (571.358 µs) : 0, 571
Telemetry [baseline] (9.548 ms) : 0, 9548
Telemetry [candidate] (7.944 ms) : 0, 7944
IAST [baseline] (25.329 ms) : 0, 25329
IAST [candidate] (26.89 ms) : 0, 26890
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (785.759 ms) : 0, 785759
BytebuddyAgent [candidate] (780.927 ms) : 0, 780927
GlobalTracer [baseline] (298.544 ms) : 0, 298544
GlobalTracer [candidate] (297.191 ms) : 0, 297191
AppSec [baseline] (52.584 ms) : 0, 52584
AppSec [candidate] (50.487 ms) : 0, 50487
Remote Config [baseline] (625.024 µs) : 0, 625
Remote Config [candidate] (613.945 µs) : 0, 614
Telemetry [baseline] (7.95 ms) : 0, 7950
Telemetry [candidate] (7.125 ms) : 0, 7125
IAST [baseline] (21.62 ms) : 0, 21620
IAST [candidate] (21.384 ms) : 0, 21384
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.049 s) : 0, 1048758
Total [baseline] (10.376 s) : 0, 10375679
Agent [candidate] (1.049 s) : 0, 1048726
Total [candidate] (10.339 s) : 0, 10339177
section appsec
Agent [baseline] (1.175 s) : 0, 1175400
Total [baseline] (10.508 s) : 0, 10507754
Agent [candidate] (1.172 s) : 0, 1172204
Total [candidate] (10.442 s) : 0, 10442013
section iast
Agent [baseline] (1.181 s) : 0, 1181222
Total [baseline] (10.901 s) : 0, 10901076
Agent [candidate] (1.187 s) : 0, 1187014
Total [candidate] (10.849 s) : 0, 10849144
section profiling
Agent [baseline] (1.249 s) : 0, 1248933
Total [baseline] (10.52 s) : 0, 10519598
Agent [candidate] (1.265 s) : 0, 1264745
Total [candidate] (10.698 s) : 0, 10697708
gantt
title petclinic - break down per module: candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (668.905 ms) : 0, 668905
BytebuddyAgent [candidate] (668.84 ms) : 0, 668840
GlobalTracer [baseline] (307.252 ms) : 0, 307252
GlobalTracer [candidate] (306.939 ms) : 0, 306939
AppSec [baseline] (50.932 ms) : 0, 50932
AppSec [candidate] (51.268 ms) : 0, 51268
Remote Config [baseline] (683.391 µs) : 0, 683
Remote Config [candidate] (684.896 µs) : 0, 685
Telemetry [baseline] (7.505 ms) : 0, 7505
Telemetry [candidate] (7.513 ms) : 0, 7513
section appsec
BytebuddyAgent [baseline] (682.447 ms) : 0, 682447
BytebuddyAgent [candidate] (680.419 ms) : 0, 680419
GlobalTracer [baseline] (301.365 ms) : 0, 301365
GlobalTracer [candidate] (300.915 ms) : 0, 300915
AppSec [baseline] (158.201 ms) : 0, 158201
AppSec [candidate] (157.043 ms) : 0, 157043
IAST [baseline] (22.044 ms) : 0, 22044
IAST [candidate] (22.152 ms) : 0, 22152
Remote Config [baseline] (605.084 µs) : 0, 605
Remote Config [candidate] (600.887 µs) : 0, 601
Telemetry [baseline] (8.16 ms) : 0, 8160
Telemetry [candidate] (8.644 ms) : 0, 8644
section iast
BytebuddyAgent [baseline] (785.71 ms) : 0, 785710
BytebuddyAgent [candidate] (789.408 ms) : 0, 789408
GlobalTracer [baseline] (297.721 ms) : 0, 297721
GlobalTracer [candidate] (298.986 ms) : 0, 298986
AppSec [baseline] (51.655 ms) : 0, 51655
AppSec [candidate] (51.935 ms) : 0, 51935
IAST [baseline] (22.549 ms) : 0, 22549
IAST [candidate] (22.834 ms) : 0, 22834
Remote Config [baseline] (594.583 µs) : 0, 595
Remote Config [candidate] (585.643 µs) : 0, 586
Telemetry [baseline] (9.432 ms) : 0, 9432
Telemetry [candidate] (9.624 ms) : 0, 9624
section profiling
BytebuddyAgent [baseline] (665.091 ms) : 0, 665091
BytebuddyAgent [candidate] (674.367 ms) : 0, 674367
GlobalTracer [baseline] (391.537 ms) : 0, 391537
GlobalTracer [candidate] (395.392 ms) : 0, 395392
AppSec [baseline] (52.315 ms) : 0, 52315
AppSec [candidate] (52.627 ms) : 0, 52627
Remote Config [baseline] (693.886 µs) : 0, 694
Remote Config [candidate] (703.928 µs) : 0, 704
Telemetry [baseline] (7.432 ms) : 0, 7432
Telemetry [candidate] (7.574 ms) : 0, 7574
ProfilingAgent [baseline] (94.602 ms) : 0, 94602
ProfilingAgent [candidate] (96.24 ms) : 0, 96240
Profiling [baseline] (94.626 ms) : 0, 94626
Profiling [candidate] (96.265 ms) : 0, 96265
LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 17 unstable metrics. Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section baseline
no_agent (1.341 ms) : 1322, 1361
. : milestone, 1341,
appsec (1.706 ms) : 1681, 1730
. : milestone, 1706,
appsec_no_iast (1.704 ms) : 1679, 1730
. : milestone, 1704,
iast (1.475 ms) : 1452, 1498
. : milestone, 1475,
profiling (1.478 ms) : 1453, 1503
. : milestone, 1478,
tracing (1.451 ms) : 1426, 1476
. : milestone, 1451,
section candidate
no_agent (1.336 ms) : 1317, 1356
. : milestone, 1336,
appsec (1.731 ms) : 1708, 1755
. : milestone, 1731,
appsec_no_iast (1.711 ms) : 1686, 1737
. : milestone, 1711,
iast (1.482 ms) : 1461, 1504
. : milestone, 1482,
profiling (1.499 ms) : 1473, 1526
. : milestone, 1499,
tracing (1.463 ms) : 1437, 1488
. : milestone, 1463,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section baseline
no_agent (360.828 µs) : 341, 381
. : milestone, 361,
iast (475.404 µs) : 454, 496
. : milestone, 475,
iast_FULL (547.303 µs) : 525, 570
. : milestone, 547,
iast_GLOBAL (501.277 µs) : 479, 524
. : milestone, 501,
iast_HARDCODED_SECRET_DISABLED (469.198 µs) : 448, 490
. : milestone, 469,
iast_INACTIVE (453.561 µs) : 431, 476
. : milestone, 454,
iast_TELEMETRY_OFF (469.504 µs) : 448, 491
. : milestone, 470,
tracing (435.003 µs) : 415, 455
. : milestone, 435,
section candidate
no_agent (363.655 µs) : 344, 384
. : milestone, 364,
iast (476.119 µs) : 455, 497
. : milestone, 476,
iast_FULL (551.749 µs) : 529, 574
. : milestone, 552,
iast_GLOBAL (498.464 µs) : 476, 521
. : milestone, 498,
iast_HARDCODED_SECRET_DISABLED (471.156 µs) : 450, 492
. : milestone, 471,
iast_INACTIVE (449.732 µs) : 428, 472
. : milestone, 450,
iast_TELEMETRY_OFF (463.875 µs) : 443, 485
. : milestone, 464,
tracing (436.842 µs) : 417, 457
. : milestone, 437,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section baseline
no_agent (1.459 ms) : 1448, 1470
. : milestone, 1459,
appsec (2.229 ms) : 2194, 2263
. : milestone, 2229,
iast (1.963 ms) : 1922, 2005
. : milestone, 1963,
iast_GLOBAL (2.02 ms) : 1978, 2062
. : milestone, 2020,
profiling (1.863 ms) : 1828, 1899
. : milestone, 1863,
tracing (1.842 ms) : 1809, 1875
. : milestone, 1842,
section candidate
no_agent (1.459 ms) : 1448, 1470
. : milestone, 1459,
appsec (2.218 ms) : 2183, 2253
. : milestone, 2218,
iast (1.968 ms) : 1927, 2010
. : milestone, 1968,
iast_GLOBAL (2.015 ms) : 1972, 2058
. : milestone, 2015,
profiling (1.858 ms) : 1823, 1892
. : milestone, 1858,
tracing (1.842 ms) : 1809, 1875
. : milestone, 1842,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.39.0-SNAPSHOT~2eb99a23d7, baseline=1.39.0-SNAPSHOT~26bee84a41
dateFormat X
axisFormat %s
section baseline
no_agent (15.08 s) : 15080000, 15080000
. : milestone, 15080000,
appsec (15.222 s) : 15222000, 15222000
. : milestone, 15222000,
iast (18.958 s) : 18958000, 18958000
. : milestone, 18958000,
iast_GLOBAL (17.749 s) : 17749000, 17749000
. : milestone, 17749000,
profiling (15.484 s) : 15484000, 15484000
. : milestone, 15484000,
tracing (15.101 s) : 15101000, 15101000
. : milestone, 15101000,
section candidate
no_agent (15.715 s) : 15715000, 15715000
. : milestone, 15715000,
appsec (15.259 s) : 15259000, 15259000
. : milestone, 15259000,
iast (18.67 s) : 18670000, 18670000
. : milestone, 18670000,
iast_GLOBAL (17.979 s) : 17979000, 17979000
. : milestone, 17979000,
profiling (15.871 s) : 15871000, 15871000
. : milestone, 15871000,
tracing (14.851 s) : 14851000, 14851000
. : milestone, 14851000,
|
mcculls
approved these changes
Aug 19, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
If the query info is missing, the jdbc advice onEnter is returning a null scope but the threadlocal for its calldepth is not reset.
That means that subsequent queries done on the same thread will not be traced because the calldepth threadlocal is dirty
Motivation
Additional Notes
Jira ticket: APMS-12988