chore(crashtracking): use RAII remote ptrace API - #2416
Conversation
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 609d070 | Docs | View more details | Give us feedback! |
BenchmarksComparisonBenchmark execution time: 2026-08-25 18:00:36 Comparing candidate commit 609d070 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics.
|
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz | 609d070 | 1787680214 | gyuheon0h/remote-ptrace-raii |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| receiver_entry_point/report/2644 | execution_time | 3.542ms | 3.581ms ± 0.030ms | 3.572ms ± 0.011ms | 3.587ms | 3.655ms | 3.682ms | 3.710ms | 3.88% | 1.930 | 3.632 | 0.84% | 0.002ms | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| receiver_entry_point/report/2644 | execution_time | [3.577ms; 3.585ms] or [-0.117%; +0.117%] | None | None | None |
Baseline
Baseline benchmark details
Group 1
| cpu_model | git_commit_sha | git_commit_date | git_branch |
|---|---|---|---|
| Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz | 1766e7e | 1787678449 | main |
| scenario | metric | min | mean ± sd | median ± mad | p75 | p95 | p99 | max | peak_to_median_ratio | skewness | kurtosis | cv | sem | runs | sample_size |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| receiver_entry_point/report/2644 | execution_time | 3.527ms | 3.575ms ± 0.030ms | 3.565ms ± 0.013ms | 3.584ms | 3.649ms | 3.659ms | 3.664ms | 2.79% | 1.296 | 1.051 | 0.85% | 0.002ms | 1 | 200 |
| scenario | metric | 95% CI mean | Shapiro-Wilk pvalue | Ljung-Box pvalue (lag=1) | Dip test pvalue |
|---|---|---|---|---|---|
| receiver_entry_point/report/2644 | execution_time | [3.571ms; 3.579ms] or [-0.118%; +0.118%] | None | None | None |
64dc1c2 to
609d070
Compare
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
69f0d97
into
main
…ker, libdd-data-pipeline, li... (#2482) # Release proposal for libdd-capabilities-impl, libdd-crashtracker, libdd-data-pipeline, libdd-ddsketch, libdd-ffe, libdd-http-client, libdd-ipc, libdd-library-config, libdd-live-debugger, libdd-otel-thread-ctx, libdd-remote-config, libdd-shared-runtime, libdd-telemetry, libdd-trace-utils, libdd-tracer-flare and their dependencies This PR contains version bumps based on public API changes and commits since last release. ###⚠️ Crates left out of this proposal affected by its major bumps These publishable workspace crates are not part of this release but their dependency requirement was rewritten on this branch while their published version still requires the old major. If they are a dependency on your deployment not including them in the release could result in duplicate packages or symbol incompatibility. - `libdd-common` `5.2.0` → `6.0.0` affects: `libdd-profiling`, `libdd-sampling` - `libdd-trace-utils` `11.0.0` → `12.0.0` affects: `libdd-sampling` ## libdd-capabilities **Next version:** `3.0.1` **Semver bump:** `patch` **Tag:** `libdd-capabilities-v3.0.1` ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - feat: do not entirely disable connection pooling for periodic connections (#2440) ## libdd-common **Next version:** `6.0.0` **Semver bump:** `major` **Tag:** `libdd-common-v6.0.0` ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - feat: do not entirely disable connection pooling for periodic connections (#2440) - feat(data-pipeline)!: add agentless stats export (#2309) - feat(data-pipeline): add runtime-independent agentless sending (#2389) - feat(common)!: add HTTPS_PROXY support for hyper_backend (#2421) ## libdd-ipc-macros **Next version:** `1.0.1` **Semver bump:** `patch` **Tag:** `libdd-ipc-macros-v1.0.1` ### Commits - feat(sidecar)!: support appsec helper-rust integration with sidecar (#2310) ## libdd-otel-thread-ctx **Next version:** `1.1.0` **Semver bump:** `minor` **Tag:** `libdd-otel-thread-ctx-v1.1.0` ### Commits - feat(otel-thread-ctx): add update-and-attach operation (#2443) ## libdd-tinybytes **Next version:** `1.1.3` **Semver bump:** `patch` **Tag:** `libdd-tinybytes-v1.1.3` ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) ## libdd-capabilities-impl **Next version:** `5.0.0` **Semver bump:** `major` **Tag:** `libdd-capabilities-impl-v5.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.1.1 → ^6.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - feat: do not entirely disable connection pooling for periodic connections (#2440) - feat(data-pipeline): add runtime-independent agentless sending (#2389) ## libdd-http-client **Next version:** `2.0.0` **Semver bump:** `major` **Tag:** `libdd-http-client-v2.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.1.1 → ^6.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - feat(data-pipeline): add runtime-independent agentless sending (#2389) - feat(common)!: add HTTPS_PROXY support for hyper_backend (#2421) ## libdd-remote-config **Next version:** `5.0.0` **Semver bump:** `major` **Tag:** `libdd-remote-config-v5.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 ### Commits - fix(remote-config): refresh fetcher identity (#2469) - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - fix(remote-config): reuse injected sleep capability (#2429) ## libdd-shared-runtime **Next version:** `4.0.0` **Semver bump:** `major` **Tag:** `libdd-shared-runtime-v4.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 ### Commits - fix(shared-runtime): allow disabling worker fork restart (#2464) ## libdd-trace-utils **Next version:** `12.0.0` **Semver bump:** `major` **Tag:** `libdd-trace-utils-v12.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 ### Commits - feat(trace-utils): add v1-native JSON log encoder brick (#2371) - feat(trace-utils): add v1-native agentless JSON encoder brick (#2370) - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - fix(trace-stats): read OTel HTTP names for the status and method dimensions (#2323) - feat(data-pipeline): emit native trace export telemetry (#2338) - feat(data-pipeline)!: add agentless stats export (#2309) - fix(trace-utils): use vec map dedup when serializing (#2422) - feat(data-pipeline): add runtime-independent agentless sending (#2389) - fix(compression): align zstd behavior across targets (#2400) - feat(trace-utils)!: add from owned to SpanText (#2403) ## libdd-ffe **Next version:** `2.0.0` **Semver bump:** `major` **Tag:** `libdd-ffe-v2.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.1.1 → ^6.0.0 - `libdd-remote-config`: ^3.0.0 → ^4.1.0 - `libdd-trace-protobuf`: ^4.0.1 → ^5.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - feat(ffe): support arbitrary semver core parts (#2413) - feat(ffe)!: send the split serial id on exposure events [EX-3425] (#2402) - feat(ffe): expose observeFullEvaluationData config-level FFI getter (#2373) - fix(ffe): report rejected flags as parse errors (#2339) - test: skip/shorten slow miri jobs (#2331) ## libdd-dogstatsd-client **Next version:** `6.0.0` **Semver bump:** `major` **Tag:** `libdd-dogstatsd-client-v6.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) ## libdd-telemetry **Next version:** `8.0.0` **Semver bump:** `major` **Tag:** `libdd-telemetry-v8.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - refactor(telemetry): avoid doing two separate http requests in stop telemetry (#2435) ## libdd-trace-obfuscation **Next version:** `8.0.0` **Semver bump:** `major` **Tag:** `libdd-trace-obfuscation-v8.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 - `libdd-trace-utils`: ^11.0.0 → ^12.0.0 ### Commits - fix(trace-obfuscation): scan all span meta for credit-card obfuscation (#2472) - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - feat(data-pipeline)!: Obfuscate v04 spans in agentless context (#2418) ## libdd-tracer-flare **Next version:** `3.0.0` **Semver bump:** `major` **Tag:** `libdd-tracer-flare-v3.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 - `libdd-trace-utils`: ^11.0.0 → ^12.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) ## libdd-crashtracker **Next version:** `3.0.0` **Semver bump:** `major` **Tag:** `libdd-crashtracker-v3.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - fix(crashtracking): filter out frames above faulting frame (#2428) - feat(sidecar)!: support appsec helper-rust integration with sidecar (#2310) - chore(crashtracking): use RAII remote ptrace API (#2416) - chore(crashtracking): bump libdd-libunwind-sys to v1.0.3 (#2414) ## libdd-data-pipeline-core **Next version:** `1.0.0` **Semver bump:** `major` **Tag:** `libdd-data-pipeline-core-v1.0.0` **Warning:** this is an initial release. Please verify that the version and commits included are correct. ## libdd-trace-stats **Next version:** `9.0.0` **Semver bump:** `major` **Tag:** `libdd-trace-stats-v9.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 - `libdd-trace-obfuscation`: ^7.0.0 → ^8.0.0 - `libdd-trace-utils`: ^11.0.0 → ^12.0.0 ### Commits - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - fix(trace-stats): read OTel HTTP names for the status and method dimensions (#2323) - feat(data-pipeline)!: add agentless stats export (#2309) - feat(trace-utils)!: add from owned to SpanText (#2403) ## libdd-data-pipeline **Next version:** `10.0.0` **Semver bump:** `major` **Tag:** `libdd-data-pipeline-v10.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 - `libdd-trace-obfuscation`: ^7.0.0 → ^8.0.0 - `libdd-trace-stats`: ^8.0.0 → ^9.0.0 - `libdd-trace-utils`: ^11.0.0 → ^12.0.0 ### Commits - feat(trace-utils): add v1-native JSON log encoder brick (#2371) - chore: prepare crate for publishing (#2466) - refactor: migrate HTTP & networking deps to workspace level (phase 4bis) (#2350) - fix(trace-stats): read OTel HTTP names for the status and method dimensions (#2323) - fix(data-pipeline): pass obfuscation config to OTLP stats (#2444) - feat(data-pipeline): emit native trace export telemetry (#2338) - feat(data-pipeline): add fork-safe OTLP gRPC trace transport (#2273) - feat(data-pipeline)!: add agentless stats export (#2309) - feat(data-pipeline)!: Obfuscate v04 spans in agentless context (#2418) - feat(data-pipeline): add runtime-independent agentless sending (#2389) - feat(trace-utils)!: add from owned to SpanText (#2403) ## libdd-ipc **Next version:** `2.0.0` **Semver bump:** `major` **Tag:** `libdd-ipc-v2.0.0` ###⚠️ major bump forced due to: - `libdd-common`: ^5.2.0 → ^6.0.0 - `libdd-trace-stats`: ^8.0.0 → ^9.0.0 ### Commits - fix(ipc): drop the signal feature from libdd-ipc (#2431) ## libdd-live-debugger **Next version:** `1.0.0` **Semver bump:** `major` **Tag:** `libdd-live-debugger-v1.0.0` **Warning:** this is an initial release. Please verify that the version and commits included are correct. [EX-3425]: https://datadoghq.atlassian.net/browse/EX-3425?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: hoolioh <107922352+hoolioh@users.noreply.github.com>
## TL;DR Adds three **opt-in** receiver options (all **off by default**) so a collector that can't unwind in-process can still get the **causal native stack**, meaning a CFI unwind that starts at the faulting instruction. Existing users see **no change**: the defaults are skipped when the config is serialized, so config is byte-identical. The first user is dd-trace-c, whose signal-safe C collector only sends a frame-pointer fallback plus the saved `UCONTEXT` registers. ## New `CrashtrackerConfiguration` options - **`unwind_from_ucontext`** (needs `collect_all_threads`): - Before the remote libunwind walk, the stopped crashing thread's general registers are temporarily replaced with the saved `ucontext`. They're restored before detaching. - The result becomes `error.stack`, replacing the collector's fallback. - If loading the registers fails, it **falls back to the normal unwind** rather than losing the thread's stack. - **`trim_signal_delivery_frames`:** for `si_code <= 0`, drops the leading libc frames (`libc.so.6`, `libpthread.so.0`, `libc-*`, `ld-musl-*`) from `error.stack` and from the crashed thread's entry in `threads`. - A stack that is entirely libc is kept. - **`name_unresolved_frames`:** frames that symbolization couldn't name get the function name `module+0xoffset`. All three have getters and builder methods and use `#[serde(default, skip_serializing_if = "Not::not")]`. The FFI config struct is **unchanged**, so there's no C ABI change. ## Tests - Config: the new options default to off, aren't serialized when off, and round-trip through serde. - `finish_native_stacks` does nothing unless opted in (ignored under Miri, because `CrashInfo::test_instance` spawns a process). - The trimming keeps a stack that is entirely libc. - Linux arm64: clippy `-D warnings` is clean and the lib tests pass. - Linux x86_64: clippy is clean. The test binary couldn't be linked in the local musl image, so CI is the first x86_64 test run. ## Notes - Merged with `origin/main`. It builds on #2416 (`&UnwAddrSpace`) and #2428 (crash-site trimming). With register seeding on, #2428's trimming normally has nothing to remove. - `semver: minor`, because there's new public API.

PROF-15821
What does this PR do?
Uses RAII wrapper
UnwAddrSpace::new()to create address space with the ptrace accessors, andUptInfo::new(tid)to create the per thread trace unwinding stateThere is no need to manually manage the memory with this.
I did not use
RemoteUnwindResources. It pairs one address space with one_UPT_create, so using it per thread would build a fresh address space for each thread and throw away libunwind's cached DWARF info between threads.This will be worked on in a follow up.
Motivation
We have an RAII api. We should use it.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.