Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracing: fix static destruction order issue #24123

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/tracing/node_trace_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class NodeTraceWriter : public AsyncTraceWriter {
int highest_request_id_completed_ = 0;
int total_traces_ = 0;
int file_num_ = 0;
const std::string& log_file_pattern_;
std::string log_file_pattern_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
I've also hit that bug in 6c24c3b

std::ostringstream stream_;
std::unique_ptr<TraceWriter> json_trace_writer_;
bool exited_ = false;
Expand Down
14 changes: 11 additions & 3 deletions test/parallel/test-tracing-no-crash.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ function CheckNoSignalAndErrorCodeOne(code, signal) {
assert.strictEqual(code, 1);
}

const child = spawn(process.execPath,
['--trace-event-categories', 'madeup', '-e',
'throw new Error()'], { stdio: 'inherit' });
const child = spawn(process.execPath, [
'--trace-event-categories', 'madeup', '-e', 'throw new Error()'
], { stdio: [ 'inherit', 'inherit', 'pipe' ] });
child.on('exit', common.mustCall(CheckNoSignalAndErrorCodeOne));

let stderr;
child.stderr.setEncoding('utf8');
child.stderr.on('data', (chunk) => stderr += chunk);
child.stderr.on('end', common.mustCall(() => {
assert(stderr.includes('throw new Error()'), stderr);
assert(!stderr.includes('Could not open trace file'), stderr);
}));