Skip to content

Conversation

mcculls
Copy link
Contributor

@mcculls mcculls commented Sep 8, 2025

What Does This Do

When swapping context stacks, restore full stack on original thread. For other threads restore a temporary shallow copy of the stack, using parent and active scopes captured when the original context stack was swapped out.

Motivation

Avoids potential issue if the same ScopeContext ends up being restored on different threads. We only need to restore the parent and active scopes when the context is temporarily swapped onto another thread. The full stack can continue to be restored onto the original thread. By capturing minimal information at the time the stack gets swapped out we avoid any potential thread-safety issues without incurring a performance penalty.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@mcculls mcculls added type: bug Bug report and fix inst: kotlin Kotlin instrumentation labels Sep 8, 2025
@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Sep 8, 2025

🎯 Code Coverage
Patch Coverage: 54.55%
Total Coverage: 62.89% (+2.73%)

View detailed report

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

@pr-commenter
Copy link

pr-commenter bot commented Sep 8, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/only-restore-swapped-scope-stack-once
git_commit_date 1757699936 1757857635
git_commit_sha f02c1d1 526162b
release_version 1.54.0-SNAPSHOT~f02c1d14c0 1.54.0-SNAPSHOT~526162b544
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1757859460 1757859460
ci_job_id 1128067402 1128067402
ci_pipeline_id 76415451 76415451
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-d7srkmyi 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-d7srkmyi 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 1 performance improvements and 0 performance regressions! Performance is the same for 50 metrics, 8 unstable metrics.

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:startup:petclinic:appsec:Remote Config better
[-64.859µs; -19.199µs] or [-9.782%; -2.896%]
621.019µs 663.048µs
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.066 s) : 0, 1065983
Total [baseline] (10.692 s) : 0, 10692230
Agent [candidate] (1.058 s) : 0, 1058365
Total [candidate] (10.716 s) : 0, 10715997
section appsec
Agent [baseline] (1.245 s) : 0, 1245275
Total [baseline] (10.963 s) : 0, 10962619
Agent [candidate] (1.233 s) : 0, 1233347
Total [candidate] (10.96 s) : 0, 10959846
section iast
Agent [baseline] (1.193 s) : 0, 1193313
Total [baseline] (10.991 s) : 0, 10991326
Agent [candidate] (1.196 s) : 0, 1196047
Total [candidate] (10.977 s) : 0, 10977173
section profiling
Agent [baseline] (1.208 s) : 0, 1208092
Total [baseline] (10.957 s) : 0, 10956709
Agent [candidate] (1.207 s) : 0, 1207441
Total [candidate] (10.93 s) : 0, 10929811
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.066 s -
Agent appsec 1.245 s 179.292 ms (16.8%)
Agent iast 1.193 s 127.331 ms (11.9%)
Agent profiling 1.208 s 142.109 ms (13.3%)
Total tracing 10.692 s -
Total appsec 10.963 s 270.389 ms (2.5%)
Total iast 10.991 s 299.096 ms (2.8%)
Total profiling 10.957 s 264.479 ms (2.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent appsec 1.233 s 174.982 ms (16.5%)
Agent iast 1.196 s 137.682 ms (13.0%)
Agent profiling 1.207 s 149.076 ms (14.1%)
Total tracing 10.716 s -
Total appsec 10.96 s 243.849 ms (2.3%)
Total iast 10.977 s 261.176 ms (2.4%)
Total profiling 10.93 s 213.814 ms (2.0%)
gantt
    title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.46 ms) : 0, 1460
crashtracking [candidate] (1.453 ms) : 0, 1453
BytebuddyAgent [baseline] (735.919 ms) : 0, 735919
BytebuddyAgent [candidate] (730.703 ms) : 0, 730703
GlobalTracer [baseline] (253.336 ms) : 0, 253336
GlobalTracer [candidate] (251.757 ms) : 0, 251757
AppSec [baseline] (30.728 ms) : 0, 30728
AppSec [candidate] (30.65 ms) : 0, 30650
Debugger [baseline] (6.447 ms) : 0, 6447
Debugger [candidate] (6.356 ms) : 0, 6356
Remote Config [baseline] (720.282 µs) : 0, 720
Remote Config [candidate] (688.503 µs) : 0, 689
Telemetry [baseline] (16.23 ms) : 0, 16230
Telemetry [candidate] (15.64 ms) : 0, 15640
section appsec
crashtracking [baseline] (1.473 ms) : 0, 1473
crashtracking [candidate] (1.456 ms) : 0, 1456
BytebuddyAgent [baseline] (762.643 ms) : 0, 762643
BytebuddyAgent [candidate] (755.207 ms) : 0, 755207
GlobalTracer [baseline] (248.075 ms) : 0, 248075
GlobalTracer [candidate] (245.11 ms) : 0, 245110
IAST [baseline] (24.0 ms) : 0, 24000
IAST [candidate] (23.799 ms) : 0, 23799
AppSec [baseline] (172.347 ms) : 0, 172347
AppSec [candidate] (171.473 ms) : 0, 171473
Debugger [baseline] (6.149 ms) : 0, 6149
Debugger [candidate] (6.001 ms) : 0, 6001
Remote Config [baseline] (663.048 µs) : 0, 663
Remote Config [candidate] (621.019 µs) : 0, 621
Telemetry [baseline] (8.556 ms) : 0, 8556
Telemetry [candidate] (8.371 ms) : 0, 8371
section iast
crashtracking [baseline] (1.481 ms) : 0, 1481
crashtracking [candidate] (1.469 ms) : 0, 1469
BytebuddyAgent [baseline] (853.873 ms) : 0, 853873
BytebuddyAgent [candidate] (857.516 ms) : 0, 857516
GlobalTracer [baseline] (247.135 ms) : 0, 247135
GlobalTracer [candidate] (247.122 ms) : 0, 247122
IAST [baseline] (27.464 ms) : 0, 27464
IAST [candidate] (29.528 ms) : 0, 29528
AppSec [baseline] (27.453 ms) : 0, 27453
AppSec [candidate] (24.593 ms) : 0, 24593
Debugger [baseline] (6.024 ms) : 0, 6024
Debugger [candidate] (6.066 ms) : 0, 6066
Remote Config [baseline] (593.947 µs) : 0, 594
Remote Config [candidate] (595.361 µs) : 0, 595
Telemetry [baseline] (8.095 ms) : 0, 8095
Telemetry [candidate] (8.031 ms) : 0, 8031
section profiling
crashtracking [baseline] (1.422 ms) : 0, 1422
crashtracking [candidate] (1.443 ms) : 0, 1443
BytebuddyAgent [baseline] (760.91 ms) : 0, 760910
BytebuddyAgent [candidate] (760.344 ms) : 0, 760344
GlobalTracer [baseline] (232.686 ms) : 0, 232686
GlobalTracer [candidate] (232.852 ms) : 0, 232852
AppSec [baseline] (30.264 ms) : 0, 30264
AppSec [candidate] (31.029 ms) : 0, 31029
Debugger [baseline] (10.493 ms) : 0, 10493
Debugger [candidate] (7.395 ms) : 0, 7395
Remote Config [baseline] (729.788 µs) : 0, 730
Remote Config [candidate] (704.577 µs) : 0, 705
Telemetry [baseline] (12.517 ms) : 0, 12517
Telemetry [candidate] (14.938 ms) : 0, 14938
ProfilingAgent [baseline] (108.007 ms) : 0, 108007
ProfilingAgent [candidate] (107.856 ms) : 0, 107856
Profiling [baseline] (108.66 ms) : 0, 108660
Profiling [candidate] (108.507 ms) : 0, 108507
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.066 s) : 0, 1065921
Total [baseline] (8.635 s) : 0, 8634549
Agent [candidate] (1.062 s) : 0, 1061958
Total [candidate] (8.643 s) : 0, 8642658
section iast
Agent [baseline] (1.189 s) : 0, 1188955
Total [baseline] (9.322 s) : 0, 9321763
Agent [candidate] (1.19 s) : 0, 1190299
Total [candidate] (9.315 s) : 0, 9314935
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.066 s -
Agent iast 1.189 s 123.033 ms (11.5%)
Total tracing 8.635 s -
Total iast 9.322 s 687.214 ms (8.0%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.062 s -
Agent iast 1.19 s 128.341 ms (12.1%)
Total tracing 8.643 s -
Total iast 9.315 s 672.277 ms (7.8%)
gantt
    title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.476 ms) : 0, 1476
crashtracking [candidate] (1.445 ms) : 0, 1445
BytebuddyAgent [baseline] (736.097 ms) : 0, 736097
BytebuddyAgent [candidate] (732.688 ms) : 0, 732688
GlobalTracer [baseline] (252.902 ms) : 0, 252902
GlobalTracer [candidate] (252.511 ms) : 0, 252511
AppSec [baseline] (30.738 ms) : 0, 30738
AppSec [candidate] (30.642 ms) : 0, 30642
Debugger [baseline] (6.416 ms) : 0, 6416
Debugger [candidate] (6.385 ms) : 0, 6385
Remote Config [baseline] (701.353 µs) : 0, 701
Remote Config [candidate] (686.788 µs) : 0, 687
Telemetry [baseline] (16.558 ms) : 0, 16558
Telemetry [candidate] (16.573 ms) : 0, 16573
section iast
crashtracking [baseline] (1.459 ms) : 0, 1459
crashtracking [candidate] (1.447 ms) : 0, 1447
BytebuddyAgent [baseline] (852.147 ms) : 0, 852147
BytebuddyAgent [candidate] (852.807 ms) : 0, 852807
GlobalTracer [baseline] (246.533 ms) : 0, 246533
GlobalTracer [candidate] (244.131 ms) : 0, 244131
AppSec [baseline] (24.463 ms) : 0, 24463
AppSec [candidate] (25.624 ms) : 0, 25624
Debugger [baseline] (6.016 ms) : 0, 6016
Debugger [candidate] (6.075 ms) : 0, 6075
Remote Config [baseline] (591.405 µs) : 0, 591
Remote Config [candidate] (591.657 µs) : 0, 592
Telemetry [baseline] (8.153 ms) : 0, 8153
Telemetry [candidate] (8.207 ms) : 0, 8207
IAST [baseline] (28.68 ms) : 0, 28680
IAST [candidate] (30.496 ms) : 0, 30496
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/only-restore-swapped-scope-stack-once
git_commit_date 1757699936 1757857635
git_commit_sha f02c1d1 526162b
release_version 1.54.0-SNAPSHOT~f02c1d14c0 1.54.0-SNAPSHOT~526162b544
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1757859122 1757859122
ci_job_id 1128067403 1128067403
ci_pipeline_id 76415451 76415451
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-mg3o0xw1 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-mg3o0xw1 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 0 performance improvements and 1 performance regressions! Performance is the same for 11 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:petclinic:profiling:high_load worse
[+2.018ms; +3.013ms] or [+4.171%; +6.228%]
unstable
[-10.825op/s; +3.590op/s] or [-11.326%; +3.756%]
50.901ms 91.963op/s 48.385ms 95.580op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.344 ms) : 4295, 4393
.   : milestone, 4344,
iast (9.568 ms) : 9409, 9728
.   : milestone, 9568,
iast_FULL (14.472 ms) : 14181, 14764
.   : milestone, 14472,
iast_GLOBAL (10.337 ms) : 10156, 10518
.   : milestone, 10337,
profiling (9.04 ms) : 8898, 9181
.   : milestone, 9040,
tracing (7.612 ms) : 7506, 7718
.   : milestone, 7612,
section candidate
no_agent (4.315 ms) : 4266, 4364
.   : milestone, 4315,
iast (9.878 ms) : 9705, 10050
.   : milestone, 9878,
iast_FULL (14.085 ms) : 13804, 14366
.   : milestone, 14085,
iast_GLOBAL (10.432 ms) : 10235, 10629
.   : milestone, 10432,
profiling (8.889 ms) : 8753, 9026
.   : milestone, 8889,
tracing (7.394 ms) : 7282, 7506
.   : milestone, 7394,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.344 ms [4.295 ms, 4.393 ms] -
iast 9.568 ms [9.409 ms, 9.728 ms] 5.225 ms (120.3%)
iast_FULL 14.472 ms [14.181 ms, 14.764 ms] 10.129 ms (233.2%)
iast_GLOBAL 10.337 ms [10.156 ms, 10.518 ms] 5.993 ms (138.0%)
profiling 9.04 ms [8.898 ms, 9.181 ms] 4.696 ms (108.1%)
tracing 7.612 ms [7.506 ms, 7.718 ms] 3.268 ms (75.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.315 ms [4.266 ms, 4.364 ms] -
iast 9.878 ms [9.705 ms, 10.05 ms] 5.563 ms (128.9%)
iast_FULL 14.085 ms [13.804 ms, 14.366 ms] 9.77 ms (226.4%)
iast_GLOBAL 10.432 ms [10.235 ms, 10.629 ms] 6.117 ms (141.8%)
profiling 8.889 ms [8.753 ms, 9.026 ms] 4.575 ms (106.0%)
tracing 7.394 ms [7.282 ms, 7.506 ms] 3.079 ms (71.4%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0
    dateFormat X
    axisFormat %s
section baseline
no_agent (37.737 ms) : 37442, 38032
.   : milestone, 37737,
appsec (46.411 ms) : 46006, 46816
.   : milestone, 46411,
code_origins (45.907 ms) : 45514, 46300
.   : milestone, 45907,
iast (44.638 ms) : 44250, 45026
.   : milestone, 44638,
profiling (48.385 ms) : 47935, 48835
.   : milestone, 48385,
tracing (44.307 ms) : 43934, 44680
.   : milestone, 44307,
section candidate
no_agent (37.001 ms) : 36705, 37298
.   : milestone, 37001,
appsec (46.858 ms) : 46456, 47259
.   : milestone, 46858,
code_origins (46.861 ms) : 46453, 47268
.   : milestone, 46861,
iast (45.312 ms) : 44907, 45716
.   : milestone, 45312,
profiling (50.901 ms) : 50426, 51376
.   : milestone, 50901,
tracing (43.596 ms) : 43212, 43980
.   : milestone, 43596,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.737 ms [37.442 ms, 38.032 ms] -
appsec 46.411 ms [46.006 ms, 46.816 ms] 8.674 ms (23.0%)
code_origins 45.907 ms [45.514 ms, 46.3 ms] 8.17 ms (21.6%)
iast 44.638 ms [44.25 ms, 45.026 ms] 6.901 ms (18.3%)
profiling 48.385 ms [47.935 ms, 48.835 ms] 10.648 ms (28.2%)
tracing 44.307 ms [43.934 ms, 44.68 ms] 6.57 ms (17.4%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.001 ms [36.705 ms, 37.298 ms] -
appsec 46.858 ms [46.456 ms, 47.259 ms] 9.856 ms (26.6%)
code_origins 46.861 ms [46.453 ms, 47.268 ms] 9.859 ms (26.6%)
iast 45.312 ms [44.907 ms, 45.716 ms] 8.31 ms (22.5%)
profiling 50.901 ms [50.426 ms, 51.376 ms] 13.899 ms (37.6%)
tracing 43.596 ms [43.212 ms, 43.98 ms] 6.594 ms (17.8%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/only-restore-swapped-scope-stack-once
git_commit_date 1757699936 1757857635
git_commit_sha f02c1d1 526162b
release_version 1.54.0-SNAPSHOT~f02c1d14c0 1.54.0-SNAPSHOT~526162b544
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1757859639 1757859639
ci_job_id 1128067404 1128067404
ci_pipeline_id 76415451 76415451
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-j23hj8mx 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-j23hj8mx 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 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.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.945 s) : 14945000, 14945000
.   : milestone, 14945000,
appsec (14.881 s) : 14881000, 14881000
.   : milestone, 14881000,
iast (18.522 s) : 18522000, 18522000
.   : milestone, 18522000,
iast_GLOBAL (17.765 s) : 17765000, 17765000
.   : milestone, 17765000,
profiling (15.492 s) : 15492000, 15492000
.   : milestone, 15492000,
tracing (14.804 s) : 14804000, 14804000
.   : milestone, 14804000,
section candidate
no_agent (15.466 s) : 15466000, 15466000
.   : milestone, 15466000,
appsec (14.814 s) : 14814000, 14814000
.   : milestone, 14814000,
iast (18.529 s) : 18529000, 18529000
.   : milestone, 18529000,
iast_GLOBAL (18.188 s) : 18188000, 18188000
.   : milestone, 18188000,
profiling (15.97 s) : 15970000, 15970000
.   : milestone, 15970000,
tracing (14.875 s) : 14875000, 14875000
.   : milestone, 14875000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.945 s [14.945 s, 14.945 s] -
appsec 14.881 s [14.881 s, 14.881 s] -64.0 ms (-0.4%)
iast 18.522 s [18.522 s, 18.522 s] 3.577 s (23.9%)
iast_GLOBAL 17.765 s [17.765 s, 17.765 s] 2.82 s (18.9%)
profiling 15.492 s [15.492 s, 15.492 s] 547.0 ms (3.7%)
tracing 14.804 s [14.804 s, 14.804 s] -141.0 ms (-0.9%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.466 s [15.466 s, 15.466 s] -
appsec 14.814 s [14.814 s, 14.814 s] -652.0 ms (-4.2%)
iast 18.529 s [18.529 s, 18.529 s] 3.063 s (19.8%)
iast_GLOBAL 18.188 s [18.188 s, 18.188 s] 2.722 s (17.6%)
profiling 15.97 s [15.97 s, 15.97 s] 504.0 ms (3.3%)
tracing 14.875 s [14.875 s, 14.875 s] -591.0 ms (-3.8%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~526162b544, baseline=1.54.0-SNAPSHOT~f02c1d14c0
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.485 ms) : 1473, 1497
.   : milestone, 1485,
appsec (2.466 ms) : 2415, 2516
.   : milestone, 2466,
iast (2.21 ms) : 2148, 2273
.   : milestone, 2210,
iast_GLOBAL (2.256 ms) : 2193, 2319
.   : milestone, 2256,
profiling (2.077 ms) : 2025, 2130
.   : milestone, 2077,
tracing (2.031 ms) : 1982, 2080
.   : milestone, 2031,
section candidate
no_agent (1.487 ms) : 1475, 1498
.   : milestone, 1487,
appsec (2.507 ms) : 2454, 2559
.   : milestone, 2507,
iast (2.212 ms) : 2150, 2275
.   : milestone, 2212,
iast_GLOBAL (2.26 ms) : 2197, 2323
.   : milestone, 2260,
profiling (2.049 ms) : 1998, 2099
.   : milestone, 2049,
tracing (2.025 ms) : 1976, 2073
.   : milestone, 2025,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.485 ms [1.473 ms, 1.497 ms] -
appsec 2.466 ms [2.415 ms, 2.516 ms] 980.72 µs (66.0%)
iast 2.21 ms [2.148 ms, 2.273 ms] 725.464 µs (48.9%)
iast_GLOBAL 2.256 ms [2.193 ms, 2.319 ms] 771.208 µs (51.9%)
profiling 2.077 ms [2.025 ms, 2.13 ms] 592.463 µs (39.9%)
tracing 2.031 ms [1.982 ms, 2.08 ms] 546.011 µs (36.8%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.487 ms [1.475 ms, 1.498 ms] -
appsec 2.507 ms [2.454 ms, 2.559 ms] 1.02 ms (68.6%)
iast 2.212 ms [2.15 ms, 2.275 ms] 725.378 µs (48.8%)
iast_GLOBAL 2.26 ms [2.197 ms, 2.323 ms] 773.132 µs (52.0%)
profiling 2.049 ms [1.998 ms, 2.099 ms] 561.867 µs (37.8%)
tracing 2.025 ms [1.976 ms, 2.073 ms] 537.745 µs (36.2%)

For other threads restore shallow copy, using parent and active
scopes captured when the original context stack was swapped out.
@mcculls mcculls force-pushed the mcculls/only-restore-swapped-scope-stack-once branch from 4bc2b1e to 526162b Compare September 14, 2025 13:48
@mcculls mcculls changed the title Only restore original scope stack once Improve thread-safety of ScopeContext.restore when swapping Kotlin coroutine contexts Sep 14, 2025
@mcculls mcculls marked this pull request as ready for review September 14, 2025 15:11
@mcculls mcculls requested a review from a team as a code owner September 14, 2025 15:11
@mcculls mcculls requested a review from amarziali September 14, 2025 16:02
@mcculls mcculls merged commit 81cdab0 into master Sep 15, 2025
507 checks passed
@mcculls mcculls deleted the mcculls/only-restore-swapped-scope-stack-once branch September 15, 2025 08:14
@github-actions github-actions bot added this to the 1.54.0 milestone Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: kotlin Kotlin instrumentation type: bug Bug report and fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants