Skip to content

Commit 1d8446f

Browse files
bengljessicagamio
authored andcommitted
fix(crashtracking): resolve frames out-of-process on Linux (#9237)
The Linux/non-Linux resolve mode selection compared `os.platform`, the function reference, against the string 'linux'. That comparison is always false, so Linux always fell through to 'EnabledWithInprocessSymbols' instead of the intended 'EnabledWithSymbolsInReceiver'. Out-of-process symbolication is the only supported path on Linux (per the adjacent comment and the crashtracking team's original guidance), so in-process symbolication during a live crash could leave the crash report unwritten. Call `platform()` so the real platform is evaluated. Add a unit test asserting resolve_frames matches the running platform, which fails against the old code on Linux.
1 parent 7e4082d commit 1d8446f

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

packages/dd-trace/src/crashtracking/crashtracker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const { EOL } = require('node:os')
3+
const { EOL, platform } = require('node:os')
44

55
// Load binding first to not import other modules if it throws
66
const libdatadog = require('@datadog/libdatadog')
@@ -71,7 +71,7 @@ class Crashtracker {
7171

7272
// Out-of-process symbolication currently works on
7373
// Linux only, does not work on Mac.
74-
const resolveMode = require('os').platform === 'linux'
74+
const resolveMode = platform() === 'linux'
7575
? 'EnabledWithSymbolsInReceiver'
7676
: 'EnabledWithInprocessSymbols'
7777

packages/dd-trace/test/crashtracking/crashtracker.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ describeNotWindows('crashtracker', () => {
8989
sinon.assert.calledOnce(binding.init)
9090
})
9191

92+
it('should resolve frames out-of-process on Linux and in-process elsewhere', () => {
93+
crashtracker.start(config)
94+
95+
const initConfig = binding.init.firstCall.args[0]
96+
const expected = os.platform() === 'linux'
97+
? 'EnabledWithSymbolsInReceiver'
98+
: 'EnabledWithInprocessSymbols'
99+
100+
assert.strictEqual(initConfig.resolve_frames, expected)
101+
})
102+
92103
it('should handle unix sockets', () => {
93104
config.url = new URL('unix:///var/datadog/apm/test.socket')
94105

0 commit comments

Comments
 (0)