-
Notifications
You must be signed in to change notification settings - Fork 292
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
Fix memory leak in Exception Replay #7885
Conversation
The weak map stateByThrowable keep the throwable as the key but this exception is also strong referenced by snapshots stored inside the ThrowableState in CapturedThrowable and in locals and extensions for @exception. Fixing by storing weak reference inside the CapturedThrowable and clearing the other ref for @exception at commit time
Debugger benchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 7 performance regressions! Performance is the same for 3 metrics, 5 unstable metrics.
See unchanged results
Request duration reports for reportsgantt
title reports - request duration [CI 0.99] : candidate=None, baseline=None
dateFormat X
axisFormat %s
section baseline
noprobe (299.209 µs) : 277, 321
. : milestone, 299,
basic (300.335 µs) : 292, 308
. : milestone, 300,
loop (10.733 ms) : 10664, 10803
. : milestone, 10733,
section candidate
noprobe (308.096 µs) : 265, 351
. : milestone, 308,
basic (341.852 µs) : 336, 348
. : milestone, 342,
loop (10.942 ms) : 10910, 10974
. : milestone, 10942,
|
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 53 metrics, 10 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.08 s) : 0, 1080398
Total [baseline] (10.342 s) : 0, 10341756
Agent [candidate] (1.081 s) : 0, 1080703
Total [candidate] (10.397 s) : 0, 10396725
section appsec
Agent [baseline] (1.214 s) : 0, 1213746
Total [baseline] (10.646 s) : 0, 10645828
Agent [candidate] (1.215 s) : 0, 1215135
Total [candidate] (10.691 s) : 0, 10691027
section iast
Agent [baseline] (1.223 s) : 0, 1223038
Total [baseline] (10.926 s) : 0, 10925908
Agent [candidate] (1.206 s) : 0, 1205934
Total [candidate] (10.986 s) : 0, 10986330
section profiling
Agent [baseline] (1.285 s) : 0, 1285382
Total [baseline] (10.77 s) : 0, 10770479
Agent [candidate] (1.278 s) : 0, 1277782
Total [candidate] (10.689 s) : 0, 10689416
gantt
title petclinic - break down per module: candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (687.479 ms) : 0, 687479
BytebuddyAgent [candidate] (686.824 ms) : 0, 686824
GlobalTracer [baseline] (315.147 ms) : 0, 315147
GlobalTracer [candidate] (315.661 ms) : 0, 315661
AppSec [baseline] (54.376 ms) : 0, 54376
AppSec [candidate] (54.233 ms) : 0, 54233
Remote Config [baseline] (662.789 µs) : 0, 663
Remote Config [candidate] (661.696 µs) : 0, 662
Telemetry [baseline] (9.099 ms) : 0, 9099
Telemetry [candidate] (9.687 ms) : 0, 9687
section appsec
BytebuddyAgent [baseline] (703.736 ms) : 0, 703736
BytebuddyAgent [candidate] (704.131 ms) : 0, 704131
GlobalTracer [baseline] (312.33 ms) : 0, 312330
GlobalTracer [candidate] (312.919 ms) : 0, 312919
AppSec [baseline] (166.048 ms) : 0, 166048
AppSec [candidate] (166.35 ms) : 0, 166350
IAST [baseline] (19.399 ms) : 0, 19399
IAST [candidate] (18.757 ms) : 0, 18757
Remote Config [baseline] (634.049 µs) : 0, 634
Remote Config [candidate] (632.167 µs) : 0, 632
Telemetry [baseline] (7.711 ms) : 0, 7711
Telemetry [candidate] (8.112 ms) : 0, 8112
section iast
BytebuddyAgent [baseline] (814.161 ms) : 0, 814161
BytebuddyAgent [candidate] (801.829 ms) : 0, 801829
GlobalTracer [baseline] (307.445 ms) : 0, 307445
GlobalTracer [candidate] (304.226 ms) : 0, 304226
AppSec [baseline] (56.05 ms) : 0, 56050
AppSec [candidate] (57.526 ms) : 0, 57526
IAST [baseline] (23.374 ms) : 0, 23374
IAST [candidate] (20.615 ms) : 0, 20615
Remote Config [baseline] (648.371 µs) : 0, 648
Remote Config [candidate] (614.932 µs) : 0, 615
Telemetry [baseline] (7.567 ms) : 0, 7567
Telemetry [candidate] (7.475 ms) : 0, 7475
section profiling
BytebuddyAgent [baseline] (685.616 ms) : 0, 685616
BytebuddyAgent [candidate] (680.901 ms) : 0, 680901
GlobalTracer [baseline] (400.347 ms) : 0, 400347
GlobalTracer [candidate] (398.322 ms) : 0, 398322
AppSec [baseline] (54.761 ms) : 0, 54761
AppSec [candidate] (54.431 ms) : 0, 54431
Remote Config [baseline] (682.948 µs) : 0, 683
Remote Config [candidate] (671.179 µs) : 0, 671
Telemetry [baseline] (13.984 ms) : 0, 13984
Telemetry [candidate] (13.368 ms) : 0, 13368
ProfilingAgent [baseline] (90.785 ms) : 0, 90785
ProfilingAgent [candidate] (91.181 ms) : 0, 91181
Profiling [baseline] (90.809 ms) : 0, 90809
Profiling [candidate] (91.204 ms) : 0, 91204
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.08 s) : 0, 1080241
Total [baseline] (8.557 s) : 0, 8557390
Agent [candidate] (1.087 s) : 0, 1087386
Total [candidate] (8.567 s) : 0, 8566875
section iast
Agent [baseline] (1.203 s) : 0, 1203345
Total [baseline] (9.109 s) : 0, 9109246
Agent [candidate] (1.203 s) : 0, 1202719
Total [candidate] (9.146 s) : 0, 9146197
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.204 s) : 0, 1204019
Total [baseline] (9.115 s) : 0, 9115062
Agent [candidate] (1.206 s) : 0, 1206228
Total [candidate] (9.109 s) : 0, 9108647
section iast_TELEMETRY_OFF
Agent [baseline] (1.211 s) : 0, 1211417
Total [baseline] (9.151 s) : 0, 9151201
Agent [candidate] (1.202 s) : 0, 1201968
Total [candidate] (9.095 s) : 0, 9095088
gantt
title insecure-bank - break down per module: candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section tracing
BytebuddyAgent [baseline] (686.849 ms) : 0, 686849
BytebuddyAgent [candidate] (691.523 ms) : 0, 691523
GlobalTracer [baseline] (314.915 ms) : 0, 314915
GlobalTracer [candidate] (316.996 ms) : 0, 316996
AppSec [baseline] (54.299 ms) : 0, 54299
AppSec [candidate] (54.033 ms) : 0, 54033
Remote Config [baseline] (661.642 µs) : 0, 662
Remote Config [candidate] (659.294 µs) : 0, 659
Telemetry [baseline] (9.905 ms) : 0, 9905
Telemetry [candidate] (10.427 ms) : 0, 10427
section iast
BytebuddyAgent [baseline] (800.285 ms) : 0, 800285
BytebuddyAgent [candidate] (800.108 ms) : 0, 800108
GlobalTracer [baseline] (303.38 ms) : 0, 303380
GlobalTracer [candidate] (302.816 ms) : 0, 302816
AppSec [baseline] (55.892 ms) : 0, 55892
AppSec [candidate] (56.147 ms) : 0, 56147
IAST [baseline] (22.15 ms) : 0, 22150
IAST [candidate] (22.015 ms) : 0, 22015
Remote Config [baseline] (607.811 µs) : 0, 608
Remote Config [candidate] (605.347 µs) : 0, 605
Telemetry [baseline] (7.422 ms) : 0, 7422
Telemetry [candidate] (7.428 ms) : 0, 7428
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (801.09 ms) : 0, 801090
BytebuddyAgent [candidate] (802.691 ms) : 0, 802691
GlobalTracer [baseline] (303.219 ms) : 0, 303219
GlobalTracer [candidate] (304.39 ms) : 0, 304390
AppSec [baseline] (56.647 ms) : 0, 56647
AppSec [candidate] (57.064 ms) : 0, 57064
IAST [baseline] (21.37 ms) : 0, 21370
IAST [candidate] (20.368 ms) : 0, 20368
Remote Config [baseline] (607.29 µs) : 0, 607
Remote Config [candidate] (604.315 µs) : 0, 604
Telemetry [baseline] (7.481 ms) : 0, 7481
Telemetry [candidate] (7.465 ms) : 0, 7465
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (805.804 ms) : 0, 805804
BytebuddyAgent [candidate] (798.593 ms) : 0, 798593
GlobalTracer [baseline] (305.892 ms) : 0, 305892
GlobalTracer [candidate] (304.331 ms) : 0, 304331
AppSec [baseline] (57.675 ms) : 0, 57675
AppSec [candidate] (56.874 ms) : 0, 56874
IAST [baseline] (20.273 ms) : 0, 20273
IAST [candidate] (20.652 ms) : 0, 20652
Remote Config [baseline] (606.405 µs) : 0, 606
Remote Config [candidate] (595.442 µs) : 0, 595
Telemetry [baseline] (7.423 ms) : 0, 7423
Telemetry [candidate] (7.297 ms) : 0, 7297
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 insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section baseline
no_agent (368.917 µs) : 348, 389
. : milestone, 369,
iast (477.717 µs) : 457, 499
. : milestone, 478,
iast_FULL (640.791 µs) : 619, 662
. : milestone, 641,
iast_GLOBAL (506.873 µs) : 485, 529
. : milestone, 507,
iast_HARDCODED_SECRET_DISABLED (482.925 µs) : 462, 504
. : milestone, 483,
iast_INACTIVE (452.961 µs) : 431, 475
. : milestone, 453,
iast_TELEMETRY_OFF (471.093 µs) : 450, 492
. : milestone, 471,
tracing (440.448 µs) : 420, 461
. : milestone, 440,
section candidate
no_agent (365.963 µs) : 346, 386
. : milestone, 366,
iast (485.576 µs) : 464, 507
. : milestone, 486,
iast_FULL (637.828 µs) : 616, 659
. : milestone, 638,
iast_GLOBAL (504.511 µs) : 483, 526
. : milestone, 505,
iast_HARDCODED_SECRET_DISABLED (480.853 µs) : 459, 502
. : milestone, 481,
iast_INACTIVE (444.503 µs) : 423, 466
. : milestone, 445,
iast_TELEMETRY_OFF (472.054 µs) : 451, 493
. : milestone, 472,
tracing (438.536 µs) : 418, 459
. : milestone, 439,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section baseline
no_agent (1.343 ms) : 1324, 1363
. : milestone, 1343,
appsec (1.714 ms) : 1689, 1739
. : milestone, 1714,
appsec_no_iast (1.707 ms) : 1682, 1731
. : milestone, 1707,
iast (1.467 ms) : 1445, 1490
. : milestone, 1467,
profiling (1.502 ms) : 1478, 1527
. : milestone, 1502,
tracing (1.483 ms) : 1459, 1507
. : milestone, 1483,
section candidate
no_agent (1.351 ms) : 1331, 1370
. : milestone, 1351,
appsec (1.716 ms) : 1692, 1740
. : milestone, 1716,
appsec_no_iast (1.706 ms) : 1681, 1731
. : milestone, 1706,
iast (1.466 ms) : 1444, 1489
. : milestone, 1466,
profiling (1.472 ms) : 1449, 1495
. : milestone, 1472,
tracing (1.462 ms) : 1439, 1486
. : milestone, 1462,
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 biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section baseline
no_agent (15.044 s) : 15044000, 15044000
. : milestone, 15044000,
appsec (15.026 s) : 15026000, 15026000
. : milestone, 15026000,
iast (18.347 s) : 18347000, 18347000
. : milestone, 18347000,
iast_GLOBAL (17.824 s) : 17824000, 17824000
. : milestone, 17824000,
profiling (15.273 s) : 15273000, 15273000
. : milestone, 15273000,
tracing (14.903 s) : 14903000, 14903000
. : milestone, 14903000,
section candidate
no_agent (14.964 s) : 14964000, 14964000
. : milestone, 14964000,
appsec (15.121 s) : 15121000, 15121000
. : milestone, 15121000,
iast (18.392 s) : 18392000, 18392000
. : milestone, 18392000,
iast_GLOBAL (18.502 s) : 18502000, 18502000
. : milestone, 18502000,
profiling (14.91 s) : 14910000, 14910000
. : milestone, 14910000,
tracing (15.199 s) : 15199000, 15199000
. : milestone, 15199000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.43.0-SNAPSHOT~9f3819f735, baseline=1.43.0-SNAPSHOT~281aa195dc
dateFormat X
axisFormat %s
section baseline
no_agent (1.46 ms) : 1448, 1471
. : milestone, 1460,
appsec (2.316 ms) : 2276, 2357
. : milestone, 2316,
iast (2.058 ms) : 2007, 2109
. : milestone, 2058,
iast_GLOBAL (2.104 ms) : 2052, 2156
. : milestone, 2104,
profiling (1.923 ms) : 1881, 1965
. : milestone, 1923,
tracing (1.916 ms) : 1875, 1956
. : milestone, 1916,
section candidate
no_agent (1.462 ms) : 1450, 1473
. : milestone, 1462,
appsec (2.332 ms) : 2291, 2374
. : milestone, 2332,
iast (2.07 ms) : 2018, 2123
. : milestone, 2070,
iast_GLOBAL (2.111 ms) : 2059, 2164
. : milestone, 2111,
profiling (1.946 ms) : 1904, 1988
. : milestone, 1946,
tracing (1.911 ms) : 1871, 1951
. : milestone, 1911,
|
@@ -107,6 +112,9 @@ public void commit( | |||
* - DebuggerContext.commit() | |||
*/ | |||
snapshot.recordStackTrace(4); | |||
// clear any strong ref to the exception before adding the snapshot to avoid leaking snapshots | |||
// inside the stateByThrowable map | |||
clearExceptionRefs(snapshot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe done in a try/finally to make extra sure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if exception happens before, snapshot won't be added to the state, so we are fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks mostly fine. WeakReferences make me nervous in general but it looks like you've covered your bases well enough.
The weak map stateByThrowable keep the throwable as the key but this exception is also strong referenced by snapshots stored inside the ThrowableState in CapturedThrowable and in locals and extensions for @exception. Fixing by storing weak reference inside the CapturedThrowable and clearing the other ref for @exception at commit time
The weak map stateByThrowable keep the throwable as the key but this exception is also strong referenced by snapshots stored inside the ThrowableState in CapturedThrowable and in locals and extensions for @exception. Fixing by storing weak reference inside the CapturedThrowable and clearing the other ref for @exception at commit time
The weak map stateByThrowable keep the throwable as the key but this exception is also strong referenced by snapshots stored inside the ThrowableState in CapturedThrowable and in locals and extensions for @exception. Fixing by storing weak reference inside the CapturedThrowable and clearing the other ref for @exception at commit time
What Does This Do
The weak map stateByThrowable keep the throwable as the key but this exception is also strong referenced by snapshots stored inside the ThrowableState in CapturedThrowable and in locals and extensions for @exception.
Fixing by storing weak reference inside the CapturedThrowable and clearing the other ref for @exception at commit time
Motivation
#7880
Additional Notes
Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: DEBUG-3102