Skip to content

Conversation

@AlexeyKuznetsov-DD
Copy link
Contributor

What Does This Do

Quick fix proposed by IntelliJ IDEA Qodana.

Motivation

Correct code.

Additional Notes

Description from IDEA:

Reports java.lang.ThreadLocal.set() with null as an argument.
This call does not free the resources, and it may cause a memory leak.
It may happen because:
Firstly, ThreadLocal.set(null) finds a map associated with the current Thread. If there is no such a map, it will be created
It sets key and value: map.set(this, value), where this refers to instance of ThreadLocal
java.lang.ThreadLocal.remove() should be used to free the resources.

Inspection ID: ThreadLocalSetWithNull

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD self-assigned this Oct 24, 2025
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD added tag: no release notes Changes to exclude from release notes type: refactoring labels Oct 24, 2025
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD marked this pull request as ready for review October 24, 2025 15:35
@AlexeyKuznetsov-DD AlexeyKuznetsov-DD requested a review from a team as a code owner October 24, 2025 15:35
@datadog-official
Copy link

datadog-official bot commented Oct 24, 2025

🎯 Code Coverage
Patch Coverage: 0.00%
Total Coverage: 63.27% (+3.60%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4e03d23 | Docs | Was this helpful? Give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Oct 24, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master alexeyk/thread-local-fix-IDEA-detected
git_commit_date 1761314866 1761319617
git_commit_sha 5370add 4e03d23
release_version 1.55.0-SNAPSHOT~5370add8f6 1.55.0-SNAPSHOT~4e03d23c61
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1761321724 1761321724
ci_job_id 1196551805 1196551805
ci_pipeline_id 80234151 80234151
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-ictz2vcr 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-ictz2vcr 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

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

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.035 s) : 0, 1034716
Total [baseline] (10.798 s) : 0, 10797516
Agent [candidate] (1.028 s) : 0, 1028458
Total [candidate] (10.728 s) : 0, 10728146
section appsec
Agent [baseline] (1.203 s) : 0, 1202889
Total [baseline] (10.972 s) : 0, 10972476
Agent [candidate] (1.211 s) : 0, 1211011
Total [candidate] (10.942 s) : 0, 10942162
section iast
Agent [baseline] (1.167 s) : 0, 1167017
Total [baseline] (11.009 s) : 0, 11008537
Agent [candidate] (1.169 s) : 0, 1169323
Total [candidate] (11.127 s) : 0, 11126944
section profiling
Agent [baseline] (1.172 s) : 0, 1172082
Total [baseline] (10.893 s) : 0, 10892762
Agent [candidate] (1.179 s) : 0, 1178916
Total [candidate] (10.887 s) : 0, 10886995
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.035 s -
Agent appsec 1.203 s 168.173 ms (16.3%)
Agent iast 1.167 s 132.302 ms (12.8%)
Agent profiling 1.172 s 137.366 ms (13.3%)
Total tracing 10.798 s -
Total appsec 10.972 s 174.96 ms (1.6%)
Total iast 11.009 s 211.021 ms (2.0%)
Total profiling 10.893 s 95.245 ms (0.9%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.028 s -
Agent appsec 1.211 s 182.553 ms (17.8%)
Agent iast 1.169 s 140.865 ms (13.7%)
Agent profiling 1.179 s 150.458 ms (14.6%)
Total tracing 10.728 s -
Total appsec 10.942 s 214.016 ms (2.0%)
Total iast 11.127 s 398.798 ms (3.7%)
Total profiling 10.887 s 158.849 ms (1.5%)
gantt
    title petclinic - break down per module: candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.47 ms) : 0, 1470
crashtracking [candidate] (1.468 ms) : 0, 1468
BytebuddyAgent [baseline] (705.464 ms) : 0, 705464
BytebuddyAgent [candidate] (700.941 ms) : 0, 700941
GlobalTracer [baseline] (245.858 ms) : 0, 245858
GlobalTracer [candidate] (244.409 ms) : 0, 244409
AppSec [baseline] (32.516 ms) : 0, 32516
AppSec [candidate] (32.259 ms) : 0, 32259
Debugger [baseline] (6.467 ms) : 0, 6467
Debugger [candidate] (6.418 ms) : 0, 6418
Remote Config [baseline] (680.507 µs) : 0, 681
Remote Config [candidate] (673.815 µs) : 0, 674
Telemetry [baseline] (15.244 ms) : 0, 15244
Telemetry [candidate] (14.552 ms) : 0, 14552
Flare Poller [baseline] (5.709 ms) : 0, 5709
Flare Poller [candidate] (6.631 ms) : 0, 6631
section appsec
crashtracking [baseline] (1.467 ms) : 0, 1467
crashtracking [candidate] (1.469 ms) : 0, 1469
BytebuddyAgent [baseline] (726.12 ms) : 0, 726120
BytebuddyAgent [candidate] (731.359 ms) : 0, 731359
GlobalTracer [baseline] (235.66 ms) : 0, 235660
GlobalTracer [candidate] (237.541 ms) : 0, 237541
IAST [baseline] (24.989 ms) : 0, 24989
IAST [candidate] (25.175 ms) : 0, 25175
AppSec [baseline] (174.599 ms) : 0, 174599
AppSec [candidate] (175.157 ms) : 0, 175157
Debugger [baseline] (5.935 ms) : 0, 5935
Debugger [candidate] (5.98 ms) : 0, 5980
Remote Config [baseline] (628.102 µs) : 0, 628
Remote Config [candidate] (647.251 µs) : 0, 647
Telemetry [baseline] (8.476 ms) : 0, 8476
Telemetry [candidate] (8.522 ms) : 0, 8522
Flare Poller [baseline] (3.896 ms) : 0, 3896
Flare Poller [candidate] (3.904 ms) : 0, 3904
section iast
crashtracking [baseline] (1.473 ms) : 0, 1473
crashtracking [candidate] (1.473 ms) : 0, 1473
BytebuddyAgent [baseline] (828.856 ms) : 0, 828856
BytebuddyAgent [candidate] (830.968 ms) : 0, 830968
GlobalTracer [baseline] (234.656 ms) : 0, 234656
GlobalTracer [candidate] (235.005 ms) : 0, 235005
IAST [baseline] (35.399 ms) : 0, 35399
IAST [candidate] (31.712 ms) : 0, 31712
AppSec [baseline] (26.204 ms) : 0, 26204
AppSec [candidate] (29.558 ms) : 0, 29558
Debugger [baseline] (6.071 ms) : 0, 6071
Debugger [candidate] (6.122 ms) : 0, 6122
Remote Config [baseline] (584.008 µs) : 0, 584
Remote Config [candidate] (605.707 µs) : 0, 606
Telemetry [baseline] (8.283 ms) : 0, 8283
Telemetry [candidate] (8.348 ms) : 0, 8348
Flare Poller [baseline] (4.066 ms) : 0, 4066
Flare Poller [candidate] (4.097 ms) : 0, 4097
section profiling
crashtracking [baseline] (1.468 ms) : 0, 1468
crashtracking [candidate] (1.461 ms) : 0, 1461
BytebuddyAgent [baseline] (726.526 ms) : 0, 726526
BytebuddyAgent [candidate] (729.347 ms) : 0, 729347
GlobalTracer [baseline] (220.403 ms) : 0, 220403
GlobalTracer [candidate] (221.996 ms) : 0, 221996
AppSec [baseline] (32.187 ms) : 0, 32187
AppSec [candidate] (32.591 ms) : 0, 32591
Debugger [baseline] (12.98 ms) : 0, 12980
Debugger [candidate] (12.295 ms) : 0, 12295
Remote Config [baseline] (1.489 ms) : 0, 1489
Remote Config [candidate] (699.64 µs) : 0, 700
Telemetry [baseline] (8.901 ms) : 0, 8901
Telemetry [candidate] (10.66 ms) : 0, 10660
Flare Poller [baseline] (4.206 ms) : 0, 4206
Flare Poller [candidate] (4.181 ms) : 0, 4181
ProfilingAgent [baseline] (108.557 ms) : 0, 108557
ProfilingAgent [candidate] (110.276 ms) : 0, 110276
Profiling [baseline] (109.187 ms) : 0, 109187
Profiling [candidate] (110.955 ms) : 0, 110955
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.033 s) : 0, 1033284
Total [baseline] (8.649 s) : 0, 8649232
Agent [candidate] (1.037 s) : 0, 1036697
Total [candidate] (8.647 s) : 0, 8647479
section iast
Agent [baseline] (1.158 s) : 0, 1158214
Total [baseline] (9.352 s) : 0, 9352037
Agent [candidate] (1.161 s) : 0, 1160528
Total [candidate] (9.361 s) : 0, 9360573
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.033 s -
Agent iast 1.158 s 124.93 ms (12.1%)
Total tracing 8.649 s -
Total iast 9.352 s 702.805 ms (8.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.037 s -
Agent iast 1.161 s 123.831 ms (11.9%)
Total tracing 8.647 s -
Total iast 9.361 s 713.094 ms (8.2%)
gantt
    title insecure-bank - break down per module: candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.473 ms) : 0, 1473
crashtracking [candidate] (1.47 ms) : 0, 1470
BytebuddyAgent [baseline] (704.837 ms) : 0, 704837
BytebuddyAgent [candidate] (706.969 ms) : 0, 706969
GlobalTracer [baseline] (245.052 ms) : 0, 245052
GlobalTracer [candidate] (246.09 ms) : 0, 246090
AppSec [baseline] (32.454 ms) : 0, 32454
AppSec [candidate] (32.635 ms) : 0, 32635
Debugger [baseline] (6.467 ms) : 0, 6467
Debugger [candidate] (6.461 ms) : 0, 6461
Remote Config [baseline] (677.852 µs) : 0, 678
Remote Config [candidate] (681.402 µs) : 0, 681
Telemetry [baseline] (13.104 ms) : 0, 13104
Telemetry [candidate] (13.134 ms) : 0, 13134
Flare Poller [baseline] (8.05 ms) : 0, 8050
Flare Poller [candidate] (7.993 ms) : 0, 7993
section iast
crashtracking [baseline] (1.466 ms) : 0, 1466
crashtracking [candidate] (1.458 ms) : 0, 1458
BytebuddyAgent [baseline] (821.641 ms) : 0, 821641
BytebuddyAgent [candidate] (823.14 ms) : 0, 823140
GlobalTracer [baseline] (233.113 ms) : 0, 233113
GlobalTracer [candidate] (234.03 ms) : 0, 234030
IAST [baseline] (32.423 ms) : 0, 32423
IAST [candidate] (33.503 ms) : 0, 33503
AppSec [baseline] (28.957 ms) : 0, 28957
AppSec [candidate] (27.967 ms) : 0, 27967
Debugger [baseline] (6.156 ms) : 0, 6156
Debugger [candidate] (6.14 ms) : 0, 6140
Remote Config [baseline] (601.773 µs) : 0, 602
Remote Config [candidate] (601.252 µs) : 0, 601
Telemetry [baseline] (8.514 ms) : 0, 8514
Telemetry [candidate] (8.43 ms) : 0, 8430
Flare Poller [baseline] (4.12 ms) : 0, 4120
Flare Poller [candidate] (4.07 ms) : 0, 4070
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master alexeyk/thread-local-fix-IDEA-detected
git_commit_date 1761314866 1761319617
git_commit_sha 5370add 4e03d23
release_version 1.55.0-SNAPSHOT~5370add8f6 1.55.0-SNAPSHOT~4e03d23c61
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1761321306 1761321306
ci_job_id 1196551806 1196551806
ci_pipeline_id 80234151 80234151
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-9so4amzx 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-9so4amzx 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 1 performance improvements and 4 performance regressions! Performance is the same for 7 metrics, 12 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:insecure-bank:iast:high_load better
[-596.423µs; -227.135µs] or [-5.795%; -2.207%]
unstable
[-38.171op/s; +75.296op/s] or [-8.454%; +16.677%]
9.880ms 470.062op/s 10.292ms 451.500op/s
scenario:load:insecure-bank:iast_GLOBAL:high_load worse
[+492.925µs; +926.699µs] or [+4.557%; +8.566%]
unstable
[-75.884op/s; +23.384op/s] or [-17.658%; +5.441%]
11.528ms 403.500op/s 10.818ms 429.750op/s
scenario:load:petclinic:no_agent:high_load worse
[+1.440ms; +2.061ms] or [+4.048%; +5.795%]
unstable
[-14.871op/s; +2.571op/s] or [-11.310%; +1.955%]
37.313ms 125.338op/s 35.562ms 131.488op/s
scenario:load:petclinic:appsec:high_load worse
[+2.382ms; +3.309ms] or [+5.002%; +6.949%]
unstable
[-10.549op/s; +1.848op/s] or [-10.733%; +1.880%]
50.458ms 93.937op/s 47.612ms 98.287op/s
scenario:load:petclinic:tracing:high_load worse
[+1.712ms; +2.507ms] or [+4.004%; +5.864%]
unstable
[-10.890op/s; +3.306op/s] or [-9.954%; +3.022%]
44.867ms 105.620op/s 42.758ms 109.412op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.284 ms) : 4235, 4333
.   : milestone, 4284,
iast (10.292 ms) : 10116, 10467
.   : milestone, 10292,
iast_FULL (14.288 ms) : 14008, 14568
.   : milestone, 14288,
iast_GLOBAL (10.818 ms) : 10620, 11016
.   : milestone, 10818,
profiling (8.956 ms) : 8806, 9105
.   : milestone, 8956,
tracing (7.81 ms) : 7692, 7927
.   : milestone, 7810,
section candidate
no_agent (4.306 ms) : 4257, 4355
.   : milestone, 4306,
iast (9.88 ms) : 9712, 10048
.   : milestone, 9880,
iast_FULL (13.73 ms) : 13458, 14003
.   : milestone, 13730,
iast_GLOBAL (11.528 ms) : 11322, 11733
.   : milestone, 11528,
profiling (8.984 ms) : 8828, 9140
.   : milestone, 8984,
tracing (8.022 ms) : 7903, 8141
.   : milestone, 8022,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.284 ms [4.235 ms, 4.333 ms] -
iast 10.292 ms [10.116 ms, 10.467 ms] 6.007 ms (140.2%)
iast_FULL 14.288 ms [14.008 ms, 14.568 ms] 10.004 ms (233.5%)
iast_GLOBAL 10.818 ms [10.62 ms, 11.016 ms] 6.534 ms (152.5%)
profiling 8.956 ms [8.806 ms, 9.105 ms] 4.671 ms (109.0%)
tracing 7.81 ms [7.692 ms, 7.927 ms] 3.525 ms (82.3%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.306 ms [4.257 ms, 4.355 ms] -
iast 9.88 ms [9.712 ms, 10.048 ms] 5.574 ms (129.4%)
iast_FULL 13.73 ms [13.458 ms, 14.003 ms] 9.424 ms (218.9%)
iast_GLOBAL 11.528 ms [11.322 ms, 11.733 ms] 7.222 ms (167.7%)
profiling 8.984 ms [8.828 ms, 9.14 ms] 4.679 ms (108.7%)
tracing 8.022 ms [7.903 ms, 8.141 ms] 3.716 ms (86.3%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6
    dateFormat X
    axisFormat %s
section baseline
no_agent (35.562 ms) : 35284, 35841
.   : milestone, 35562,
appsec (47.612 ms) : 47199, 48026
.   : milestone, 47612,
code_origins (43.123 ms) : 42756, 43489
.   : milestone, 43123,
iast (43.548 ms) : 43168, 43928
.   : milestone, 43548,
profiling (48.54 ms) : 48064, 49016
.   : milestone, 48540,
tracing (42.758 ms) : 42414, 43101
.   : milestone, 42758,
section candidate
no_agent (37.313 ms) : 37014, 37611
.   : milestone, 37313,
appsec (50.458 ms) : 50011, 50905
.   : milestone, 50458,
code_origins (44.084 ms) : 43699, 44469
.   : milestone, 44084,
iast (44.071 ms) : 43699, 44442
.   : milestone, 44071,
profiling (49.344 ms) : 48880, 49808
.   : milestone, 49344,
tracing (44.867 ms) : 44474, 45261
.   : milestone, 44867,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 35.562 ms [35.284 ms, 35.841 ms] -
appsec 47.612 ms [47.199 ms, 48.026 ms] 12.05 ms (33.9%)
code_origins 43.123 ms [42.756 ms, 43.489 ms] 7.561 ms (21.3%)
iast 43.548 ms [43.168 ms, 43.928 ms] 7.985 ms (22.5%)
profiling 48.54 ms [48.064 ms, 49.016 ms] 12.978 ms (36.5%)
tracing 42.758 ms [42.414 ms, 43.101 ms] 7.195 ms (20.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.313 ms [37.014 ms, 37.611 ms] -
appsec 50.458 ms [50.011 ms, 50.905 ms] 13.145 ms (35.2%)
code_origins 44.084 ms [43.699 ms, 44.469 ms] 6.771 ms (18.1%)
iast 44.071 ms [43.699 ms, 44.442 ms] 6.758 ms (18.1%)
profiling 49.344 ms [48.88 ms, 49.808 ms] 12.032 ms (32.2%)
tracing 44.867 ms [44.474 ms, 45.261 ms] 7.555 ms (20.2%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master alexeyk/thread-local-fix-IDEA-detected
git_commit_date 1761314866 1761319617
git_commit_sha 5370add 4e03d23
release_version 1.55.0-SNAPSHOT~5370add8f6 1.55.0-SNAPSHOT~4e03d23c61
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1761321915 1761321915
ci_job_id 1196551807 1196551807
ci_pipeline_id 80234151 80234151
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-yedmszse 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-yedmszse 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

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

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:dacapo:tomcat:appsec better
[-1.400ms; -1.061ms] or [-38.023%; -28.806%]
2.452ms 3.683ms
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.847 s) : 14847000, 14847000
.   : milestone, 14847000,
appsec (14.759 s) : 14759000, 14759000
.   : milestone, 14759000,
iast (18.276 s) : 18276000, 18276000
.   : milestone, 18276000,
iast_GLOBAL (18.387 s) : 18387000, 18387000
.   : milestone, 18387000,
profiling (15.205 s) : 15205000, 15205000
.   : milestone, 15205000,
tracing (15.13 s) : 15130000, 15130000
.   : milestone, 15130000,
section candidate
no_agent (14.95 s) : 14950000, 14950000
.   : milestone, 14950000,
appsec (14.722 s) : 14722000, 14722000
.   : milestone, 14722000,
iast (18.197 s) : 18197000, 18197000
.   : milestone, 18197000,
iast_GLOBAL (17.886 s) : 17886000, 17886000
.   : milestone, 17886000,
profiling (15.86 s) : 15860000, 15860000
.   : milestone, 15860000,
tracing (15.261 s) : 15261000, 15261000
.   : milestone, 15261000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.847 s [14.847 s, 14.847 s] -
appsec 14.759 s [14.759 s, 14.759 s] -88.0 ms (-0.6%)
iast 18.276 s [18.276 s, 18.276 s] 3.429 s (23.1%)
iast_GLOBAL 18.387 s [18.387 s, 18.387 s] 3.54 s (23.8%)
profiling 15.205 s [15.205 s, 15.205 s] 358.0 ms (2.4%)
tracing 15.13 s [15.13 s, 15.13 s] 283.0 ms (1.9%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.95 s [14.95 s, 14.95 s] -
appsec 14.722 s [14.722 s, 14.722 s] -228.0 ms (-1.5%)
iast 18.197 s [18.197 s, 18.197 s] 3.247 s (21.7%)
iast_GLOBAL 17.886 s [17.886 s, 17.886 s] 2.936 s (19.6%)
profiling 15.86 s [15.86 s, 15.86 s] 910.0 ms (6.1%)
tracing 15.261 s [15.261 s, 15.261 s] 311.0 ms (2.1%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~4e03d23c61, baseline=1.55.0-SNAPSHOT~5370add8f6
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.476 ms) : 1464, 1487
.   : milestone, 1476,
appsec (3.683 ms) : 3465, 3900
.   : milestone, 3683,
iast (2.196 ms) : 2133, 2259
.   : milestone, 2196,
iast_GLOBAL (2.241 ms) : 2178, 2305
.   : milestone, 2241,
profiling (2.049 ms) : 1998, 2100
.   : milestone, 2049,
tracing (2.025 ms) : 1975, 2074
.   : milestone, 2025,
section candidate
no_agent (1.473 ms) : 1462, 1485
.   : milestone, 1473,
appsec (2.452 ms) : 2401, 2503
.   : milestone, 2452,
iast (2.207 ms) : 2144, 2270
.   : milestone, 2207,
iast_GLOBAL (2.239 ms) : 2176, 2303
.   : milestone, 2239,
profiling (2.066 ms) : 2013, 2118
.   : milestone, 2066,
tracing (2.018 ms) : 1969, 2067
.   : milestone, 2018,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.476 ms [1.464 ms, 1.487 ms] -
appsec 3.683 ms [3.465 ms, 3.9 ms] 2.207 ms (149.6%)
iast 2.196 ms [2.133 ms, 2.259 ms] 720.117 µs (48.8%)
iast_GLOBAL 2.241 ms [2.178 ms, 2.305 ms] 765.764 µs (51.9%)
profiling 2.049 ms [1.998 ms, 2.1 ms] 573.569 µs (38.9%)
tracing 2.025 ms [1.975 ms, 2.074 ms] 549.232 µs (37.2%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.473 ms [1.462 ms, 1.485 ms] -
appsec 2.452 ms [2.401 ms, 2.503 ms] 978.903 µs (66.4%)
iast 2.207 ms [2.144 ms, 2.27 ms] 733.612 µs (49.8%)
iast_GLOBAL 2.239 ms [2.176 ms, 2.303 ms] 766.028 µs (52.0%)
profiling 2.066 ms [2.013 ms, 2.118 ms] 592.559 µs (40.2%)
tracing 2.018 ms [1.969 ms, 2.067 ms] 545.187 µs (37.0%)

}
AgentScope scope = threadLocalScope.get();
threadLocalScope.set(null);
threadLocalScope.remove();
Copy link
Contributor

@mcculls mcculls Nov 3, 2025

Choose a reason for hiding this comment

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

IIRC the reason for calling set(null) here rather than remove was for performance reasons.

If we assume that the thread will activate another scope later on, it is better to leave the entry in the thread-local's map rather than continually grow and shrink the underlying map. TBH it would be even better to use a holder pattern here, and avoid any mutating of the thread-local once setup.

So please don't merge this for now - I'll put together a quick benchmark to demonstrate the difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @mcculls! Your explanation is totally make sense. If benchmark will show that set(null) is better I will change my PR to put a comment why we have set(null).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants