- Notifications
You must be signed in to change notification settings - Fork 315
Service discovery - remove dependency on memfd_create #9913
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
base: master
Are you sure you want to change the base?
Conversation
| 🎯 Code Coverage 🔗 Commit SHA: 1bd59c4 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 54 metrics, 11 unstable metrics. Startup time reports for insecure-bankgantt title insecure-bank - global startup overhead: candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section tracing Agent [baseline] (1.05 s) : 0, 1050227 Total [baseline] (8.639 s) : 0, 8638514 Agent [candidate] (1.05 s) : 0, 1049539 Total [candidate] (8.635 s) : 0, 8634789 section iast Agent [baseline] (1.178 s) : 0, 1177760 Total [baseline] (9.263 s) : 0, 9262794 Agent [candidate] (1.18 s) : 0, 1180284 Total [candidate] (9.261 s) : 0, 9260519
gantt title insecure-bank - break down per module: candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section tracing crashtracking [baseline] (1.457 ms) : 0, 1457 crashtracking [candidate] (1.46 ms) : 0, 1460 BytebuddyAgent [baseline] (707.045 ms) : 0, 707045 BytebuddyAgent [candidate] (706.942 ms) : 0, 706942 GlobalTracer [baseline] (246.202 ms) : 0, 246202 GlobalTracer [candidate] (246.602 ms) : 0, 246602 AppSec [baseline] (32.435 ms) : 0, 32435 AppSec [candidate] (32.373 ms) : 0, 32373 Debugger [baseline] (6.456 ms) : 0, 6456 Debugger [candidate] (6.367 ms) : 0, 6367 Remote Config [baseline] (730.397 µs) : 0, 730 Remote Config [candidate] (724.806 µs) : 0, 725 Telemetry [baseline] (16.067 ms) : 0, 16067 Telemetry [candidate] (13.735 ms) : 0, 13735 Flare Poller [baseline] (5.043 ms) : 0, 5043 Flare Poller [candidate] (6.597 ms) : 0, 6597 section iast crashtracking [baseline] (1.451 ms) : 0, 1451 crashtracking [candidate] (1.451 ms) : 0, 1451 BytebuddyAgent [baseline] (827.38 ms) : 0, 827380 BytebuddyAgent [candidate] (829.321 ms) : 0, 829321 GlobalTracer [baseline] (233.916 ms) : 0, 233916 GlobalTracer [candidate] (234.845 ms) : 0, 234845 AppSec [baseline] (27.004 ms) : 0, 27004 AppSec [candidate] (28.615 ms) : 0, 28615 Debugger [baseline] (5.982 ms) : 0, 5982 Debugger [candidate] (6.01 ms) : 0, 6010 Remote Config [baseline] (596.849 µs) : 0, 597 Remote Config [candidate] (599.018 µs) : 0, 599 Telemetry [baseline] (8.316 ms) : 0, 8316 Telemetry [candidate] (8.394 ms) : 0, 8394 Flare Poller [baseline] (4.133 ms) : 0, 4133 Flare Poller [candidate] (4.175 ms) : 0, 4175 IAST [baseline] (34.245 ms) : 0, 34245 IAST [candidate] (32.187 ms) : 0, 32187 Startup time reports for petclinicgantt title petclinic - global startup overhead: candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section tracing Agent [baseline] (1.048 s) : 0, 1047573 Total [baseline] (10.681 s) : 0, 10680975 Agent [candidate] (1.051 s) : 0, 1050634 Total [candidate] (10.773 s) : 0, 10773074 section appsec Agent [baseline] (1.221 s) : 0, 1220834 Total [baseline] (10.824 s) : 0, 10824135 Agent [candidate] (1.221 s) : 0, 1221091 Total [candidate] (10.844 s) : 0, 10844346 section iast Agent [baseline] (1.2 s) : 0, 1200394 Total [baseline] (11.128 s) : 0, 11128000 Agent [candidate] (1.178 s) : 0, 1177791 Total [candidate] (11.096 s) : 0, 11095845 section profiling Agent [baseline] (1.2 s) : 0, 1199658 Total [baseline] (10.888 s) : 0, 10887637 Agent [candidate] (1.194 s) : 0, 1194134 Total [candidate] (10.926 s) : 0, 10926453
gantt title petclinic - break down per module: candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section tracing crashtracking [baseline] (1.455 ms) : 0, 1455 crashtracking [candidate] (1.467 ms) : 0, 1467 BytebuddyAgent [baseline] (705.141 ms) : 0, 705141 BytebuddyAgent [candidate] (707.048 ms) : 0, 707048 GlobalTracer [baseline] (245.75 ms) : 0, 245750 GlobalTracer [candidate] (246.524 ms) : 0, 246524 AppSec [baseline] (32.597 ms) : 0, 32597 AppSec [candidate] (32.52 ms) : 0, 32520 Debugger [baseline] (6.407 ms) : 0, 6407 Debugger [candidate] (6.437 ms) : 0, 6437 Remote Config [baseline] (719.588 µs) : 0, 720 Remote Config [candidate] (706.407 µs) : 0, 706 Telemetry [baseline] (15.642 ms) : 0, 15642 Telemetry [candidate] (13.789 ms) : 0, 13789 Flare Poller [baseline] (5.133 ms) : 0, 5133 Flare Poller [candidate] (7.442 ms) : 0, 7442 section appsec crashtracking [baseline] (1.462 ms) : 0, 1462 crashtracking [candidate] (1.451 ms) : 0, 1451 BytebuddyAgent [baseline] (728.806 ms) : 0, 728806 BytebuddyAgent [candidate] (728.25 ms) : 0, 728250 GlobalTracer [baseline] (237.17 ms) : 0, 237170 GlobalTracer [candidate] (237.261 ms) : 0, 237261 AppSec [baseline] (174.641 ms) : 0, 174641 AppSec [candidate] (175.17 ms) : 0, 175170 Debugger [baseline] (5.964 ms) : 0, 5964 Debugger [candidate] (6.016 ms) : 0, 6016 Remote Config [baseline] (646.602 µs) : 0, 647 Remote Config [candidate] (652.762 µs) : 0, 653 Telemetry [baseline] (8.459 ms) : 0, 8459 Telemetry [candidate] (8.62 ms) : 0, 8620 Flare Poller [baseline] (3.975 ms) : 0, 3975 Flare Poller [candidate] (4.002 ms) : 0, 4002 IAST [baseline] (24.782 ms) : 0, 24782 IAST [candidate] (24.745 ms) : 0, 24745 section iast crashtracking [baseline] (1.487 ms) : 0, 1487 crashtracking [candidate] (1.453 ms) : 0, 1453 BytebuddyAgent [baseline] (844.649 ms) : 0, 844649 BytebuddyAgent [candidate] (827.124 ms) : 0, 827124 GlobalTracer [baseline] (238.136 ms) : 0, 238136 GlobalTracer [candidate] (234.729 ms) : 0, 234729 AppSec [baseline] (28.822 ms) : 0, 28822 AppSec [candidate] (27.748 ms) : 0, 27748 Debugger [baseline] (6.065 ms) : 0, 6065 Debugger [candidate] (5.94 ms) : 0, 5940 Remote Config [baseline] (611.478 µs) : 0, 611 Remote Config [candidate] (594.704 µs) : 0, 595 Telemetry [baseline] (8.521 ms) : 0, 8521 Telemetry [candidate] (8.289 ms) : 0, 8289 Flare Poller [baseline] (4.134 ms) : 0, 4134 Flare Poller [candidate] (4.089 ms) : 0, 4089 IAST [baseline] (32.757 ms) : 0, 32757 IAST [candidate] (33.141 ms) : 0, 33141 section profiling ProfilingAgent [baseline] (110.692 ms) : 0, 110692 ProfilingAgent [candidate] (110.537 ms) : 0, 110537 crashtracking [baseline] (1.447 ms) : 0, 1447 crashtracking [candidate] (1.447 ms) : 0, 1447 BytebuddyAgent [baseline] (734.133 ms) : 0, 734133 BytebuddyAgent [candidate] (730.611 ms) : 0, 730611 GlobalTracer [baseline] (222.929 ms) : 0, 222929 GlobalTracer [candidate] (222.173 ms) : 0, 222173 AppSec [baseline] (32.4 ms) : 0, 32400 AppSec [candidate] (32.024 ms) : 0, 32024 Debugger [baseline] (9.113 ms) : 0, 9113 Debugger [candidate] (9.574 ms) : 0, 9574 Remote Config [baseline] (709.84 µs) : 0, 710 Remote Config [candidate] (671.897 µs) : 0, 672 Telemetry [baseline] (13.864 ms) : 0, 13864 Telemetry [candidate] (13.072 ms) : 0, 13072 Flare Poller [baseline] (4.157 ms) : 0, 4157 Flare Poller [candidate] (4.095 ms) : 0, 4095 Profiling [baseline] (111.359 ms) : 0, 111359 Profiling [candidate] (111.204 ms) : 0, 111204 LoadParameters
See matching parameters
SummaryFound 0 performance improvements and 3 performance regressions! Performance is the same for 9 metrics, 12 unstable metrics.
Request duration reports for petclinicgantt title petclinic - request duration [CI 0.99] : candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section baseline no_agent (18.435 ms) : 18246, 18624 . : milestone, 18435, appsec (18.662 ms) : 18468, 18856 . : milestone, 18662, code_origins (17.562 ms) : 17389, 17735 . : milestone, 17562, iast (17.688 ms) : 17510, 17866 . : milestone, 17688, profiling (18.717 ms) : 18530, 18905 . : milestone, 18717, tracing (17.377 ms) : 17206, 17547 . : milestone, 17377, section candidate no_agent (18.081 ms) : 17899, 18263 . : milestone, 18081, appsec (19.972 ms) : 19766, 20178 . : milestone, 19972, code_origins (17.692 ms) : 17517, 17866 . : milestone, 17692, iast (18.782 ms) : 18595, 18969 . : milestone, 18782, profiling (18.245 ms) : 18062, 18428 . : milestone, 18245, tracing (17.562 ms) : 17388, 17736 . : milestone, 17562,
Request duration reports for insecure-bankgantt title insecure-bank - request duration [CI 0.99] : candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section baseline no_agent (1.194 ms) : 1182, 1206 . : milestone, 1194, iast (3.099 ms) : 3060, 3137 . : milestone, 3099, iast_FULL (5.82 ms) : 5762, 5878 . : milestone, 5820, iast_GLOBAL (3.561 ms) : 3509, 3612 . : milestone, 3561, profiling (2.038 ms) : 2020, 2056 . : milestone, 2038, tracing (1.767 ms) : 1753, 1781 . : milestone, 1767, section candidate no_agent (1.218 ms) : 1206, 1231 . : milestone, 1218, iast (3.189 ms) : 3152, 3226 . : milestone, 3189, iast_FULL (5.923 ms) : 5864, 5983 . : milestone, 5923, iast_GLOBAL (3.559 ms) : 3500, 3618 . : milestone, 3559, profiling (2.136 ms) : 2117, 2155 . : milestone, 2136, tracing (1.792 ms) : 1778, 1806 . : milestone, 1792,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt title tomcat - execution time [CI 0.99] : candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section baseline no_agent (1.48 ms) : 1469, 1492 . : milestone, 1480, appsec (3.692 ms) : 3474, 3910 . : milestone, 3692, iast (2.212 ms) : 2148, 2275 . : milestone, 2212, iast_GLOBAL (2.254 ms) : 2190, 2318 . : milestone, 2254, profiling (2.091 ms) : 2038, 2143 . : milestone, 2091, tracing (2.04 ms) : 1990, 2089 . : milestone, 2040, section candidate no_agent (1.482 ms) : 1470, 1493 . : milestone, 1482, appsec (3.576 ms) : 3368, 3784 . : milestone, 3576, iast (2.219 ms) : 2156, 2283 . : milestone, 2219, iast_GLOBAL (2.262 ms) : 2198, 2325 . : milestone, 2262, profiling (2.083 ms) : 2030, 2136 . : milestone, 2083, tracing (2.028 ms) : 1979, 2077 . : milestone, 2028,
Execution time for biojavagantt title biojava - execution time [CI 0.99] : candidate=1.56.0-SNAPSHOT~1bd59c4f94, baseline=1.56.0-SNAPSHOT~f132c86c16 dateFormat X axisFormat %s section baseline no_agent (15.035 s) : 15035000, 15035000 . : milestone, 15035000, appsec (14.663 s) : 14663000, 14663000 . : milestone, 14663000, iast (18.618 s) : 18618000, 18618000 . : milestone, 18618000, iast_GLOBAL (18.002 s) : 18002000, 18002000 . : milestone, 18002000, profiling (15.216 s) : 15216000, 15216000 . : milestone, 15216000, tracing (14.797 s) : 14797000, 14797000 . : milestone, 14797000, section candidate no_agent (15.391 s) : 15391000, 15391000 . : milestone, 15391000, appsec (15.376 s) : 15376000, 15376000 . : milestone, 15376000, iast (18.198 s) : 18198000, 18198000 . : milestone, 18198000, iast_GLOBAL (17.976 s) : 17976000, 17976000 . : milestone, 17976000, profiling (15.246 s) : 15246000, 15246000 . : milestone, 15246000, tracing (14.762 s) : 14762000, 14762000 . : milestone, 14762000,
|
| Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
| String arch = System.getProperty("os.arch"); | ||
| int memfdSyscall = getMemfdSyscall(arch); | ||
| if (memfdSyscall <= 0) { | ||
| log.debug("service discovery not supported for arch={}", arch); |
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.
are you interested in sending those to the telemetry? Otherwise you won't know unless the customer activates the debug logging and send a flares. In this case you have a SEND_TELEMETRY marker
| private static int getMemfdSyscall(String arch) { | ||
| switch (arch.toLowerCase()) { | ||
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/x86_64/bits/syscall.h.in#L320 | ||
| case "x86_64": |
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.
You could consolidate this by allowing the case statements to fallthrough.
case "x86_64":
case "x64":
case "amd64":
return 319;
Just a suggestion, I don't feel strongly about it.
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.
nice
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.
looking at these "magic numbers" makes every bone in my body shake, but because I can't think of a better idea that doesnt require a C shim 😅 or preprocessing of the source code 🫣 I'll stay quiet and say this lgtm 😜
natitsechanski left a comment
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.
lgtm 🤷 😅
| case "x86_64": | ||
| case "x64": | ||
| case "amd64": | ||
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/x86_64/bits/syscall.h.in#L320 |
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.
suggestion: I would prefer the link to the linux kernel, either:
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/x86_64/bits/syscall.h.in#L320 | ||
| return 319; | ||
| case "x386": | ||
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/i386/bits/syscall.h.in#L356 |
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.
suggestion: same as above.
Also, does makes sense to have a x86 case ?
| final LibC libc = Native.load("c", LibC.class); | ||
| | ||
| int memFd = libc.memfd_create(fileName, MFD_CLOEXEC | MFD_ALLOW_SEALING); | ||
| String arch = System.getProperty("os.arch"); |
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.
suggestion: Use OperatingSystem.architecture(), and the enum values in getMemfdSyscall's switch.
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.
nice, missed that enum, will move to it later today
| case "aarch64": | ||
| case "arm64": | ||
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/aarch64/bits/syscall.h.in#L264 | ||
| return 279; | ||
| case "arm": | ||
| case "arm32": | ||
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/arm/bits/syscall.h.in#L343 | ||
| return 385; | ||
| case "ppc64": | ||
| // https://elixir.bootlin.com/musl/v1.2.5/source/arch/powerpc64/bits/syscall.h.in#L350 | ||
| return 360; |
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.
suggestion:
- arm: https://github.com/torvalds/linux/blob/e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c/arch/arm/tools/syscall.tbl#L403
- arm32: https://github.com/torvalds/linux/blob/e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c/arch/arm64/tools/syscall_32.tbl#L400
- aarch64 (located in a generic file) : https://github.com/torvalds/linux/blob/e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c/scripts/syscall.tbl#L329
- powerpc: https://github.com/torvalds/linux/blob/e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c/arch/powerpc/kernel/syscalls/syscall.tbl#L464
What Does This Do
memfd_create was introduced in glibc 2.27, meaning that on distros before and including centos7, debian8, amazonlinux2 the JNA logic triggers an exception while searching for the symbol. The exception is caught on purpose by the try-catch but it is still collected in the crash tracking initiative.
Removing it by calling directly the syscall
Motivation
Additional Notes
Contributor Checklist
type:and (comp:orinst:) labels in addition to any useful labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]