Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4813dfe
docs(crashtracker): document remaining parity work
pawelchcki Jul 3, 2026
84eb217
feat(crashtracker): add signal-safe collector runtime
pawelchcki Jul 4, 2026
967c5e7
docs(crashtracker): add signal-safe collector improvement plan
pawelchcki Jul 5, 2026
67ed434
wip
pawelchcki Jul 5, 2026
8ceed85
wip
pawelchcki Jul 5, 2026
6ae6136
test(crashtracker): add signal-safe coverage files
pawelchcki Jul 5, 2026
dd99229
Merge remote-tracking branch 'origin/signal_safe_crashtracker' into s…
pawelchcki Jul 5, 2026
79f8b2a
docs(crashtracker): add signal-safe collector improvement plan
pawelchcki Jul 5, 2026
5da6727
fix(crashtracker): harden signal-safe collector
pawelchcki Jul 6, 2026
b59e440
fix(crashtracker): harden signal-safe report protocol
pawelchcki Jul 6, 2026
13e6912
docs(crashtracker): consolidate signal-safe improvement plan
pawelchcki Jul 6, 2026
79d29aa
feat(crashtracker): implement signal-safe collector
pawelchcki Jul 6, 2026
4f63bba
rm
pawelchcki Jul 6, 2026
3ae9e99
docs(crashtracker): add signal-safe collector cleanup plan
pawelchcki Jul 6, 2026
2174482
refactor(crashtracker): clean up signal-safe collector
pawelchcki Jul 6, 2026
eb22760
docs(crashtracker): add signal-safe simplification plan
pawelchcki Jul 6, 2026
c523de6
refactor(crashtracker): simplify signal-safe collector
pawelchcki Jul 6, 2026
111d965
refactor(crashtracker): derive signal-safe errors
pawelchcki Jul 6, 2026
bfaa12b
docs(crashtracker): remove signal-safe cleanup plan
pawelchcki Jul 6, 2026
8399029
docs(crashtracker): add signal-safe cleanup plan
pawelchcki Jul 6, 2026
82218c2
refactor(crashtracker): simplify signal-safe collector
pawelchcki Jul 6, 2026
f19e687
docs(crashtracker): remove cleanup plan
pawelchcki Jul 6, 2026
ff46c1c
Merge remote-tracking branch 'origin/main' into signal_safe_crashtracker
pawelchcki Jul 6, 2026
4de97b5
refactor(crashtracker): remove signal-safe stage tracking
pawelchcki Jul 6, 2026
a4c012f
refactor(crashtracker): simplify signal-safe collector cleanups
pawelchcki Jul 7, 2026
81b9879
refactor(crashtracker): simplify signal-safe collector cleanups
pawelchcki Jul 7, 2026
35528f4
refactor(crashtracker): make signal-safe collector struct-only
pawelchcki Jul 7, 2026
3fc78e0
refactor(crashtracker): simplify signal-safe collector hot paths
pawelchcki Jul 7, 2026
22dee7a
refactor(crashtracker): use rustix runtime for fork/exit, drop close_…
pawelchcki Jul 7, 2026
7f37773
refactor(crashtracker): harden signal-safe collector fork children
pawelchcki Jul 7, 2026
7dd1c9a
perf(crashtracker): buffer signal-safe report writes
pawelchcki Jul 7, 2026
9b46d0c
refactor(crashtracker): organize signal-safe collector
pawelchcki Jul 8, 2026
befc336
fix(crashtracker): stabilize signal-safe collector
pawelchcki Jul 8, 2026
bda1c1b
fix(crashtracker): walk frames via self-read in forked collector child
pawelchcki Jul 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/crashtracker-signal-safe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
# SPDX-License-Identifier: Apache-2.0

name: Crashtracker signal-safe

on:
pull_request:
paths:
- "libdd-crashtracker/**"
- "libdd-crashtracker-ffi/**"
- "libdd-profiling-ffi/**"
- "builder/**"
- "tools/check_signal_safe_symbols.sh"
- ".github/workflows/crashtracker-signal-safe.yml"
- "Cargo.toml"
- "Cargo.lock"
push:
branches:
- main

jobs:
signal-safe:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Install Rust toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
rustup component add clippy --toolchain stable
rustup target add aarch64-unknown-linux-gnu
- name: Install cargo nextest
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
with:
tool: nextest@0.9.96
- name: Check signal-safe collector
run: cargo check -p libdd-crashtracker --no-default-features --features collector_signal-safe
- name: Check aarch64 signal-safe collector
run: cargo check -p libdd-crashtracker --target aarch64-unknown-linux-gnu --no-default-features --features collector_signal-safe
- name: Clippy signal-safe collector
run: cargo +stable clippy -p libdd-crashtracker --no-default-features --features collector_signal-safe --all-targets -- -D warnings
- name: Test signal-safe collector
run: cargo nextest run -p libdd-crashtracker --no-default-features --features collector_signal-safe --no-fail-fast
- name: Test signal-safe receiver compatibility
run: cargo nextest run -p libdd-crashtracker --features "collector_signal-safe,receiver" --no-fail-fast
- name: Symbol guard
run: bash tools/check_signal_safe_symbols.sh

signal-safe-macos:
runs-on: macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Install Rust toolchain
run: |
rustup set profile minimal
rustup toolchain install stable
- name: Install cargo nextest
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
with:
tool: nextest@0.9.96
- name: Test signal-safe collector fallback paths
run: cargo nextest run -p libdd-crashtracker --no-default-features --features collector_signal-safe --no-fail-fast
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Iterate fastest with `cargo check -p <crate>` while editing; the full validation

### Per-crate test notes

- **crashtracker**: needs `--features libdd-crashtracker/generate-unit-test-files` for unit tests.
- **crashtracker**: needs `--features libdd-crashtracker/generate-unit-test-files` for its unit tests. For the signal-safe collector, validate with `cargo check -p libdd-crashtracker --no-default-features --features collector_signal-safe`, `cargo +stable clippy -p libdd-crashtracker --no-default-features --features collector_signal-safe --all-targets -- -D warnings`, `cargo nextest run -p libdd-crashtracker --no-default-features --features collector_signal-safe --no-fail-fast`, `cargo nextest run -p libdd-crashtracker --features "collector_signal-safe,receiver" --no-fail-fast`, and `bash tools/check_signal_safe_symbols.sh`.
- **http-client**: ships two alternative backend features (`reqwest-backend` is the default, `hyper-backend` is the alternative). Cargo does not enforce exclusivity, but each backend must be exercised independently when this crate is touched:
```bash
# Default (reqwest) backend — covered by the workspace test run
Expand Down
64 changes: 42 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ gloo-timers,https://github.com/rustwasm/gloo/tree/master/crates/timers,MIT OR Ap
h2,https://github.com/hyperium/h2,MIT,"Carl Lerche <me@carllerche.com>, Sean McArthur <sean@seanmonstar.com>"
half,https://github.com/starkat99/half-rs,MIT OR Apache-2.0,Kathryn Long <squeeself@gmail.com>
halfbrown,https://github.com/Licenser/halfbrown,Apache-2.0 OR MIT,Heinz N. Gies <heinz@licenser.net>
hash32,https://github.com/japaric/hash32,MIT OR Apache-2.0,Jorge Aparicio <jorge@japaric.io>
hashbrown,https://github.com/rust-lang/hashbrown,MIT OR Apache-2.0,Amanieu d'Antras <amanieu@gmail.com>
hdrhistogram,https://github.com/HdrHistogram/HdrHistogram_rust,MIT OR Apache-2.0,"Jon Gjengset <jon@thesquareplanet.com>, Marshall Pierce <marshall@mpierce.org>"
headers,https://github.com/hyperium/headers,MIT,Sean McArthur <sean@seanmonstar.com>
headers-core,https://github.com/hyperium/headers,MIT,Sean McArthur <sean@seanmonstar.com>
heapless,https://github.com/rust-embedded/heapless,MIT OR Apache-2.0,"Jorge Aparicio <jorge@japaric.io>, Per Lindgren <per.lindgren@ltu.se>, Emil Fresk <emil.fresk@gmail.com>"
heck,https://github.com/withoutboats/heck,MIT OR Apache-2.0,The heck Authors
heck,https://github.com/withoutboats/heck,MIT OR Apache-2.0,Without Boats <woboats@gmail.com>
hermit-abi,https://github.com/hermit-os/hermit-rs,MIT OR Apache-2.0,Stefan Lankes
Expand Down Expand Up @@ -255,7 +257,6 @@ nom,https://github.com/Geal/nom,MIT,contact@geoffroycouprie.com
ntapi,https://github.com/MSxDOS/ntapi,Apache-2.0 OR MIT,MSxDOS <melcodos@gmail.com>
nu-ansi-term,https://github.com/nushell/nu-ansi-term,MIT,"ogham@bsago.me, Ryan Scheel (Havvy) <ryan.havvy@gmail.com>, Josh Triplett <josh@joshtriplett.org>, The Nushell Project Developers"
num-conv,https://github.com/jhpratt/num-conv,MIT OR Apache-2.0,Jacob Pratt <jacob@jhpratt.dev>
num-derive,https://github.com/rust-num/num-derive,MIT OR Apache-2.0,The Rust Project Developers
num-traits,https://github.com/rust-num/num-traits,MIT OR Apache-2.0,The Rust Project Developers
objc2,https://github.com/madsmtm/objc2,MIT,Mads Marquart <mads@marquart.dk>
objc2-cloud-kit,https://github.com/madsmtm/objc2,Zlib OR Apache-2.0 OR MIT,The objc2-cloud-kit Authors
Expand Down Expand Up @@ -375,6 +376,7 @@ semver,https://github.com/dtolnay/semver,MIT OR Apache-2.0,David Tolnay <dtolnay
sendfd,https://github.com/standard-ai/sendfd,Apache-2.0 OR BSD-3-Clause,"Simonas Kazlauskas <simonas@standard.ai>, Bernardo Meurer <bernardo@standard.ai>, Léo Gaspard <leo@standard.ai>"
serde,https://github.com/serde-rs/serde,MIT OR Apache-2.0,"Erick Tryzelaar <erick.tryzelaar@gmail.com>, David Tolnay <dtolnay@gmail.com>"
serde-bool,https://github.com/x52dev/serde-utils,MIT OR Apache-2.0,Rob Ede <robjtede@icloud.com>
serde-json-core,https://github.com/rust-embedded-community/serde-json-core,MIT OR Apache-2.0,"Jorge Aparicio <jorge@japaric.io>, Ryan Summers <ryan.summers@vertigo-designs.com>, Robert Jördens <rj@quartiq.de>, Mathias Koch <mk@factbird.com>"
serde-transcode,https://github.com/sfackler/serde-transcode,MIT OR Apache-2.0,Steven Fackler <sfackler@palantir.com>
serde_bytes,https://github.com/serde-rs/bytes,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
serde_core,https://github.com/serde-rs/serde,MIT OR Apache-2.0,"Erick Tryzelaar <erick.tryzelaar@gmail.com>, David Tolnay <dtolnay@gmail.com>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,22 @@
}
},
"SiCodes": {
"description": "See https://man7.org/linux/man-pages/man2/sigaction.2.html MUST REMAIN IN SYNC WITH THE ENUM IN emit_sigcodes.c",
"description": "See https://man7.org/linux/man-pages/man2/sigaction.2.html",
"type": "string",
"enum": [
"BUS_ADRALN",
"BUS_ADRERR",
"BUS_MCEERR_AO",
"BUS_MCEERR_AR",
"BUS_OBJERR",
"FPE_FLTDIV",
"FPE_FLTINV",
"FPE_FLTOVF",
"FPE_FLTRES",
"FPE_FLTSUB",
"FPE_FLTUND",
"FPE_INTDIV",
"FPE_INTOVF",
"ILL_BADSTK",
"ILL_COPROC",
"ILL_ILLADR",
Expand Down
6 changes: 6 additions & 0 deletions examples/ffi/crashtracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,16 @@ int main(int argc, char **argv) {
// Test raising SEGV explicitly, to ensure chaining works
// properly in this case
raise(SIGSEGV);
#elif defined(__APPLE__) && defined(__aarch64__)
// Optimized arm64 macOS builds may lower the undefined null write below to
// a trap instruction, which terminates with SIGTRAP instead of SIGSEGV.
raise(SIGSEGV);
#endif

#if !defined(EXPLICIT_RAISE_SEGV) && !(defined(__APPLE__) && defined(__aarch64__))
char *bug = NULL;
*bug = 42;
#endif

// The crash handler should intercept the SIGSEGV, invoke the receiver,
// and write the crash report to output_dir before the process terminates.
Expand Down
13 changes: 7 additions & 6 deletions libdd-crashtracker-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ bench = false
required-features = ["collector_windows"]

[features]
default = ["cbindgen", "collector", "demangler", "receiver"]
default = ["std", "cbindgen", "collector", "demangler", "receiver"]
std = ["libdd-crashtracker/std"]
cbindgen = ["build_common/cbindgen"]
regex-lite = ["libdd-common-ffi/regex-lite"]
# Enables the in-process collection of crash-info
collector = []
collector_windows = []
demangler = ["dep:symbolic-demangle", "dep:symbolic-common"]
collector = ["std", "libdd-crashtracker/collector"]
collector_windows = ["std", "libdd-crashtracker/collector_windows"]
demangler = ["std", "dep:symbolic-demangle", "dep:symbolic-common"]
# Enables the use of this library to receiver crash-info from a suitable collector
receiver = []
receiver = ["std", "libdd-crashtracker/receiver"]

[target.'cfg(windows)'.features]
default = ["collector_windows"]
Expand All @@ -38,7 +39,7 @@ build_common = { path = "../build-common" }

[dependencies]
anyhow = "1.0"
libdd-crashtracker = { path = "../libdd-crashtracker" }
libdd-crashtracker = { path = "../libdd-crashtracker", default-features = false }
libdd-common = { path = "../libdd-common" }
libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false }
symbolic-demangle = { version = "12.8.0", default-features = false, features = ["rust", "cpp", "msvc"], optional = true }
Expand Down
4 changes: 4 additions & 0 deletions libdd-crashtracker-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@
mod collector;
#[cfg(all(windows, feature = "collector_windows"))]
mod collector_windows;
#[cfg(feature = "std")]
mod crash_info;
#[cfg(feature = "demangler")]
mod demangler;
#[cfg(all(unix, feature = "receiver"))]
mod receiver;
#[cfg(feature = "std")]
mod runtime_callback;
#[cfg(all(unix, feature = "collector"))]
pub use collector::*;
#[cfg(all(windows, feature = "collector_windows"))]
pub use collector_windows::api::ddog_crasht_init_windows;
#[cfg(feature = "std")]
pub use crash_info::*;
#[cfg(feature = "demangler")]
pub use demangler::*;
#[cfg(all(unix, feature = "receiver"))]
pub use receiver::*;
#[cfg(feature = "std")]
pub use runtime_callback::*;
Loading
Loading