-
Notifications
You must be signed in to change notification settings - Fork 320
Allow pre-Java 6 classes to be transformed in the debugger #9591
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
Conversation
|
🎯 Code Coverage 🔗 Commit SHA: b24605d | Docs | Was this helpful? Give us feedback! |
Debugger benchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 9 metrics, 6 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 (336.39 µs) : 273, 400
. : milestone, 336,
basic (281.053 µs) : 274, 288
. : milestone, 281,
loop (8.965 ms) : 8959, 8971
. : milestone, 8965,
section candidate
noprobe (319.149 µs) : 291, 348
. : milestone, 319,
basic (279.631 µs) : 273, 286
. : milestone, 280,
loop (8.959 ms) : 8954, 8964
. : milestone, 8959,
|
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 6 performance regressions! Performance is the same for 42 metrics, 11 unstable metrics.
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.005 s) : 0, 1004976
Total [baseline] (8.611 s) : 0, 8611468
Agent [candidate] (1.016 s) : 0, 1016297
Total [candidate] (8.624 s) : 0, 8624131
section iast
Agent [baseline] (1.14 s) : 0, 1139596
Total [baseline] (9.286 s) : 0, 9285591
Agent [candidate] (1.155 s) : 0, 1155491
Total [candidate] (9.33 s) : 0, 9330309
gantt
title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.488 ms) : 0, 1488
crashtracking [candidate] (1.461 ms) : 0, 1461
BytebuddyAgent [baseline] (687.73 ms) : 0, 687730
BytebuddyAgent [candidate] (685.616 ms) : 0, 685616
GlobalTracer [baseline] (247.519 ms) : 0, 247519
GlobalTracer [candidate] (256.77 ms) : 0, 256770
AppSec [baseline] (30.975 ms) : 0, 30975
AppSec [candidate] (31.44 ms) : 0, 31440
Debugger [baseline] (6.315 ms) : 0, 6315
Debugger [candidate] (6.317 ms) : 0, 6317
Remote Config [baseline] (683.345 µs) : 0, 683
Remote Config [candidate] (669.905 µs) : 0, 670
Telemetry [baseline] (9.047 ms) : 0, 9047
Telemetry [candidate] (13.181 ms) : 0, 13181
section iast
crashtracking [baseline] (1.464 ms) : 0, 1464
crashtracking [candidate] (1.464 ms) : 0, 1464
BytebuddyAgent [baseline] (805.983 ms) : 0, 805983
BytebuddyAgent [candidate] (809.843 ms) : 0, 809843
GlobalTracer [baseline] (236.328 ms) : 0, 236328
GlobalTracer [candidate] (248.843 ms) : 0, 248843
AppSec [baseline] (33.736 ms) : 0, 33736
AppSec [candidate] (27.353 ms) : 0, 27353
Debugger [baseline] (6.103 ms) : 0, 6103
Debugger [candidate] (6.232 ms) : 0, 6232
Remote Config [baseline] (589.166 µs) : 0, 589
Remote Config [candidate] (611.211 µs) : 0, 611
Telemetry [baseline] (8.253 ms) : 0, 8253
Telemetry [candidate] (8.384 ms) : 0, 8384
IAST [baseline] (26.06 ms) : 0, 26060
IAST [candidate] (31.893 ms) : 0, 31893
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.003 s) : 0, 1003331
Total [baseline] (10.648 s) : 0, 10647638
Agent [candidate] (1.025 s) : 0, 1025174
Total [candidate] (10.708 s) : 0, 10707997
section appsec
Agent [baseline] (1.191 s) : 0, 1191271
Total [baseline] (11.005 s) : 0, 11005389
Agent [candidate] (1.202 s) : 0, 1202207
Total [candidate] (10.885 s) : 0, 10885086
section iast
Agent [baseline] (1.144 s) : 0, 1144454
Total [baseline] (10.909 s) : 0, 10908637
Agent [candidate] (1.152 s) : 0, 1152496
Total [candidate] (11.051 s) : 0, 11050548
section profiling
Agent [baseline] (1.15 s) : 0, 1150444
Total [baseline] (11.061 s) : 0, 11061478
Agent [candidate] (1.167 s) : 0, 1167284
Total [candidate] (11.034 s) : 0, 11033932
gantt
title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.453 ms) : 0, 1453
crashtracking [candidate] (1.457 ms) : 0, 1457
BytebuddyAgent [baseline] (686.422 ms) : 0, 686422
BytebuddyAgent [candidate] (692.069 ms) : 0, 692069
GlobalTracer [baseline] (247.465 ms) : 0, 247465
GlobalTracer [candidate] (259.034 ms) : 0, 259034
AppSec [baseline] (30.967 ms) : 0, 30967
AppSec [candidate] (31.928 ms) : 0, 31928
Debugger [baseline] (6.286 ms) : 0, 6286
Debugger [candidate] (6.399 ms) : 0, 6399
Remote Config [baseline] (680.476 µs) : 0, 680
Remote Config [candidate] (687.131 µs) : 0, 687
Telemetry [baseline] (8.994 ms) : 0, 8994
Telemetry [candidate] (12.464 ms) : 0, 12464
section appsec
crashtracking [baseline] (1.464 ms) : 0, 1464
crashtracking [candidate] (1.448 ms) : 0, 1448
BytebuddyAgent [baseline] (715.249 ms) : 0, 715249
BytebuddyAgent [candidate] (715.312 ms) : 0, 715312
GlobalTracer [baseline] (240.602 ms) : 0, 240602
GlobalTracer [candidate] (250.894 ms) : 0, 250894
AppSec [baseline] (172.653 ms) : 0, 172653
AppSec [candidate] (172.189 ms) : 0, 172189
Debugger [baseline] (5.971 ms) : 0, 5971
Debugger [candidate] (6.12 ms) : 0, 6120
Remote Config [baseline] (673.119 µs) : 0, 673
Remote Config [candidate] (617.34 µs) : 0, 617
Telemetry [baseline] (8.36 ms) : 0, 8360
Telemetry [candidate] (9.158 ms) : 0, 9158
IAST [baseline] (25.11 ms) : 0, 25110
IAST [candidate] (25.312 ms) : 0, 25312
section iast
crashtracking [baseline] (1.454 ms) : 0, 1454
crashtracking [candidate] (1.45 ms) : 0, 1450
BytebuddyAgent [baseline] (808.601 ms) : 0, 808601
BytebuddyAgent [candidate] (808.459 ms) : 0, 808459
GlobalTracer [baseline] (238.131 ms) : 0, 238131
GlobalTracer [candidate] (247.424 ms) : 0, 247424
AppSec [baseline] (33.495 ms) : 0, 33495
AppSec [candidate] (28.201 ms) : 0, 28201
Debugger [baseline] (6.158 ms) : 0, 6158
Debugger [candidate] (6.181 ms) : 0, 6181
Remote Config [baseline] (609.829 µs) : 0, 610
Remote Config [candidate] (590.048 µs) : 0, 590
Telemetry [baseline] (8.328 ms) : 0, 8328
Telemetry [candidate] (8.299 ms) : 0, 8299
IAST [baseline] (26.47 ms) : 0, 26470
IAST [candidate] (30.952 ms) : 0, 30952
section profiling
ProfilingAgent [baseline] (101.07 ms) : 0, 101070
ProfilingAgent [candidate] (101.209 ms) : 0, 101209
crashtracking [baseline] (1.46 ms) : 0, 1460
crashtracking [candidate] (1.439 ms) : 0, 1439
BytebuddyAgent [baseline] (717.719 ms) : 0, 717719
BytebuddyAgent [candidate] (722.961 ms) : 0, 722961
GlobalTracer [baseline] (223.92 ms) : 0, 223920
GlobalTracer [candidate] (235.337 ms) : 0, 235337
AppSec [baseline] (31.356 ms) : 0, 31356
AppSec [candidate] (31.252 ms) : 0, 31252
Debugger [baseline] (7.211 ms) : 0, 7211
Debugger [candidate] (6.515 ms) : 0, 6515
Remote Config [baseline] (689.485 µs) : 0, 689
Remote Config [candidate] (736.759 µs) : 0, 737
Telemetry [baseline] (16.024 ms) : 0, 16024
Telemetry [candidate] (16.524 ms) : 0, 16524
Profiling [baseline] (101.67 ms) : 0, 101670
Profiling [candidate] (101.787 ms) : 0, 101787
LoadParameters
See matching parameters
SummaryFound 3 performance improvements and 3 performance regressions! Performance is the same for 6 metrics, 12 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section baseline
no_agent (35.597 ms) : 35312, 35882
. : milestone, 35597,
appsec (48.844 ms) : 48413, 49275
. : milestone, 48844,
code_origins (44.646 ms) : 44268, 45024
. : milestone, 44646,
iast (45.031 ms) : 44633, 45428
. : milestone, 45031,
profiling (47.789 ms) : 47323, 48254
. : milestone, 47789,
tracing (44.901 ms) : 44500, 45303
. : milestone, 44901,
section candidate
no_agent (37.224 ms) : 36929, 37519
. : milestone, 37224,
appsec (47.134 ms) : 46725, 47543
. : milestone, 47134,
code_origins (44.583 ms) : 44204, 44963
. : milestone, 44583,
iast (45.821 ms) : 45416, 46225
. : milestone, 45821,
profiling (48.517 ms) : 48052, 48981
. : milestone, 48517,
tracing (42.196 ms) : 41837, 42555
. : milestone, 42196,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section baseline
no_agent (4.401 ms) : 4349, 4453
. : milestone, 4401,
iast (10.451 ms) : 10272, 10631
. : milestone, 10451,
iast_FULL (13.956 ms) : 13670, 14242
. : milestone, 13956,
iast_GLOBAL (10.463 ms) : 10279, 10648
. : milestone, 10463,
profiling (8.676 ms) : 8541, 8811
. : milestone, 8676,
tracing (7.471 ms) : 7360, 7581
. : milestone, 7471,
section candidate
no_agent (4.352 ms) : 4303, 4401
. : milestone, 4352,
iast (9.64 ms) : 9480, 9800
. : milestone, 9640,
iast_FULL (13.892 ms) : 13615, 14168
. : milestone, 13892,
iast_GLOBAL (10.434 ms) : 10249, 10618
. : milestone, 10434,
profiling (9.362 ms) : 9213, 9512
. : milestone, 9362,
tracing (7.856 ms) : 7737, 7976
. : milestone, 7856,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 2 unstable metrics. Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section baseline
no_agent (14.917 s) : 14917000, 14917000
. : milestone, 14917000,
appsec (15.089 s) : 15089000, 15089000
. : milestone, 15089000,
iast (18.705 s) : 18705000, 18705000
. : milestone, 18705000,
iast_GLOBAL (18.249 s) : 18249000, 18249000
. : milestone, 18249000,
profiling (15.548 s) : 15548000, 15548000
. : milestone, 15548000,
tracing (15.085 s) : 15085000, 15085000
. : milestone, 15085000,
section candidate
no_agent (15.519 s) : 15519000, 15519000
. : milestone, 15519000,
appsec (15.193 s) : 15193000, 15193000
. : milestone, 15193000,
iast (18.783 s) : 18783000, 18783000
. : milestone, 18783000,
iast_GLOBAL (17.946 s) : 17946000, 17946000
. : milestone, 17946000,
profiling (15.529 s) : 15529000, 15529000
. : milestone, 15529000,
tracing (15.021 s) : 15021000, 15021000
. : milestone, 15021000,
Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~b24605d047, baseline=1.54.0-SNAPSHOT~0094a60a80
dateFormat X
axisFormat %s
section baseline
no_agent (1.472 ms) : 1461, 1484
. : milestone, 1472,
appsec (3.694 ms) : 3475, 3912
. : milestone, 3694,
iast (2.201 ms) : 2138, 2264
. : milestone, 2201,
iast_GLOBAL (2.251 ms) : 2187, 2314
. : milestone, 2251,
profiling (2.079 ms) : 2026, 2131
. : milestone, 2079,
tracing (2.03 ms) : 1981, 2079
. : milestone, 2030,
section candidate
no_agent (1.481 ms) : 1470, 1493
. : milestone, 1481,
appsec (3.705 ms) : 3485, 3924
. : milestone, 3705,
iast (2.2 ms) : 2137, 2262
. : milestone, 2200,
iast_GLOBAL (2.239 ms) : 2177, 2302
. : milestone, 2239,
profiling (2.46 ms) : 2307, 2614
. : milestone, 2460,
tracing (2.024 ms) : 1975, 2073
. : milestone, 2024,
|
Pre-Java 6 classes can contain JSR/RET instructions which are not
supported by ASM when the COMPUTE_FRAMES is used. This leads to
exceptions like this:
13:34:29.407 [Test worker] ERROR com.datadog.debugger.agent.DebuggerTransformer - Cannot write classfile for class: org.apache.felix.gogo.runtime.Pipe Exception:
java.lang.IllegalArgumentException: JSR/RET are not supported with computeFrames option
at org.objectweb.asm.Frame.execute(Frame.java:1028)
at org.objectweb.asm.MethodWriter.visitJumpInsn(MethodWriter.java:1147)
at org.objectweb.asm.tree.JumpInsnNode.accept(JumpInsnNode.java:79)
at org.objectweb.asm.tree.InsnList.accept(InsnList.java:144)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:749)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:647)
at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:468)
at com.datadog.debugger.agent.DebuggerTransformer.writeClassFile(DebuggerTransformer.java:492)
...
This uses ASM's JSRInlinerAdapter to rewrite the problematic JSR/RET
instructions as the class file is written.
6b87a68 to
b24605d
Compare
Allow pre-Java 6 classes to be transformed in the debugger
Pre-Java 6 classes can contain JSR/RET instructions which are not
supported by ASM when the COMPUTE_FRAMES is used. This leads to
exceptions like this:
13:34:29.407 [Test worker] ERROR com.datadog.debugger.agent.DebuggerTransformer - Cannot write classfile for class: org.apache.felix.gogo.runtime.Pipe Exception:
java.lang.IllegalArgumentException: JSR/RET are not supported with computeFrames option
at org.objectweb.asm.Frame.execute(Frame.java:1028)
at org.objectweb.asm.MethodWriter.visitJumpInsn(MethodWriter.java:1147)
at org.objectweb.asm.tree.JumpInsnNode.accept(JumpInsnNode.java:79)
at org.objectweb.asm.tree.InsnList.accept(InsnList.java:144)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:749)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:647)
at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:468)
at com.datadog.debugger.agent.DebuggerTransformer.writeClassFile(DebuggerTransformer.java:492)
...
This uses ASM's JSRInlinerAdapter to rewrite the problematic JSR/RET
instructions as the class file is written.
---------
Co-authored-by: DJ Gregor <[email protected]>
What Does This Do
This uses ASM's JSRInlinerAdapter in
DebuggerTransformer, allowing Dynamic Instrumentation probes to be successfully used in pre-Java 6 classes.Motivation
Pre-Java 6 classes can contain JSR/RET instructions which are not supported by ASM when the COMPUTE_FRAMES is used. This leads to exceptions like this when using Dynamic Instrumentation probes:
This occurs when two things are true:
COMPUTE_FRAMESis set in the ASMClassWriter, which it the case in DebuggerTransformer.finallyblock is compiled with an older compiler that emits JSR/RET instructions.In my case, I was trying to add Dynamic Instrumentation probes to an old IBM class and ran into this problem.
Additional Notes
JSRInlinerAdapteronly inlines when the JSR instruction is seenAlways using
JSRInlinerAdaptershould be safe here because it only modifies the method if it has a JSR instruction, in which case the class would have failed to be written without this fix. See this comment inJSRInlinerAdapter:Most other uses of
COMPUTE_FRAMESlook safe, one might need updatedI looked at the other uses of
COMPUTE_FRAMESin dd-trace-java and I think only one of them might be impacted in a similar way, IastSecurityControlTransformer. I'm not familiar with IAST, and I don't know this can be used on arbitrary classes or if its use is on specific classes controlled by the agent. If it is impacted in the former case, I'm happy to apply the same fix there, as well.I don't think these other uses are impacted:
Contributor Checklist
type:and (comp:orinst:) labels in addition to any usefull labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]