Skip to content

Commit a101a9b

Browse files
committed
crashtracking - libunwind
Switch the default to OFF
1 parent 6f68505 commit a101a9b

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

crashtracker/build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn main() {
2424
if target.contains("musl") {
2525
// possibly lzma compressed symbol tables. Do we really need it ?
2626
println!("cargo:rustc-link-lib=static=lzma");
27-
println!("cargo:rustc-link-lib=static=unwind-{}", link_lib_arch);
2827
println!("cargo:rustc-link-lib=static=unwind");
2928
}
3029
else {

crashtracker/src/shared/configuration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ impl StackTraceUnwinding {
3535
.to_lowercase()
3636
.as_str()
3737
{
38-
"backtrace" => StackTraceUnwinding::Backtrace,
39-
_ => StackTraceUnwinding::Libunwind, // Default to libunwind
38+
"libunwind" => StackTraceUnwinding::Libunwind,
39+
_ => StackTraceUnwinding::Backtrace, // default to backtrace
4040
}
4141
}
4242
}

docs/RFCs/0008-custom-unwinder.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
# RFC 0006: Crashtracker unwinding (Version 0.1).
1+
# RFC 0008: Crashtracker unwinding (Version 0.1).
22

33
## Context
44

5-
In the scope of [incident 34148](https://dd.enterprise.slack.com/archives/C088R4S25M5), we have incomplete unwinding on musl. As a first priority we should be able to build a version for PHP that allows unwinding on musl.
6-
I recommend [this issue](https://github.com/rust-lang/backtrace-rs/issues/698) for more context on the issue.
5+
In the scope of [incident 34148](https://dd.enterprise.slack.com/archives/C088R4S25M5), we have incomplete unwinding on musl. Our top priority is to enable a build of dd-trace-php that allows unwinds crashes on musl.
6+
I recommend [this issue](https://github.com/rust-lang/backtrace-rs/issues/698) for more context on the underlying unwinding issue.
77

8-
This is only an issue for the languages that do not have a runtime specific unwinding tool.
9-
- Ruby
10-
- .NET
11-
- Python
12-
13-
Other languages have their unwinding mechanisms.
8+
This is only an issue for the languages that do not have a built-in unwinding (like Java).
149

1510
## Solution proposed
1611

17-
Unwinding from the context of the signal handler allows us to get the stacktrace beyond the signal handler. The issue above details some of the experiments I have performed.
12+
Unwinding starting from the context of the signal handler allows us to get the stacktrace beyond the signal handler. The issue above details some of the experiments I have performed.
1813

1914
### Unwinding libraries
2015

@@ -23,19 +18,18 @@ When swapping for a different library we should consider maintenance, internal k
2318

2419
### Packaging of libunwind
2520

26-
As this is a C library, we can not use the C header.
27-
We need to declare the functions we use in libdatadog for the different architectures. This requires some adjustements as the functions have names are architecture specific.
21+
As this is a C library used from Rust, we need to declare the functions we use in libdatadog for the different architectures. This requires some adjustements as the functions have architecture specific names.
2822

29-
We can rely on bindgen to generate the bindings. However as this adds complexity to the builds I favoured declaring the minimal set of functions.
30-
The libunwind-sys crate did not work correctly though it would be a great starting point.
23+
We can rely on bindgen to generate the bindings. However as this adds complexity to the builds I favoured declaring the minimal set of functions required for the unwinding.
24+
The libunwind-sys crate did not work correctly when I tried adding it to libdatadog though it is a good source to generate relevant bindings.
3125

3226
We should statically link libunwind and make symbols invisible to our users.
3327
The link of libunwind requires `libgcc_s.so.1`. This does not change anythinng as we already needed this dependency (as we are using backtrace mechanisms).
3428

3529
Size impacts looking at libdatadog_profiling.so
36-
- 9 Megs
37-
- +1.3 Meg
38-
TODO: check when compiling with PHP if this is acceptable.
30+
- +1.3 Meg on the shared library (9 Megs total)
31+
32+
TODO: measures are ongoing with the PHP binary.
3933

4034
### Deployment
4135

@@ -45,7 +39,7 @@ If this is a success, we can roll out progressively the change.
4539
### Out of scope
4640

4741
Signal safety is not discussed.
48-
The current implementation is not signal safe. We have more work to improve this.
42+
The current implementation is not signal safe. The long term direction is to move the unwinding out of the process.
4943

5044
Shipping libunwund so that .NET folks can reuse it.
5145
This should come in a second phase.

0 commit comments

Comments
 (0)