You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/RFCs/0008-custom-unwinder.md
+12-18Lines changed: 12 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,15 @@
1
-
# RFC 0006: Crashtracker unwinding (Version 0.1).
1
+
# RFC 0008: Crashtracker unwinding (Version 0.1).
2
2
3
3
## Context
4
4
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.
7
7
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).
14
9
15
10
## Solution proposed
16
11
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.
18
13
19
14
### Unwinding libraries
20
15
@@ -23,19 +18,18 @@ When swapping for a different library we should consider maintenance, internal k
23
18
24
19
### Packaging of libunwind
25
20
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.
28
22
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.
31
25
32
26
We should statically link libunwind and make symbols invisible to our users.
33
27
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).
34
28
35
29
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.
39
33
40
34
### Deployment
41
35
@@ -45,7 +39,7 @@ If this is a success, we can roll out progressively the change.
45
39
### Out of scope
46
40
47
41
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.
49
43
50
44
Shipping libunwund so that .NET folks can reuse it.
0 commit comments