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

report: add missing locks for report_on_fatalerror accessors #32535

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/node_report_module.cc
Expand Up @@ -16,6 +16,7 @@

namespace report {
using node::Environment;
using node::Mutex;
using node::Utf8Value;
using v8::Boolean;
using v8::Context;
Expand Down Expand Up @@ -129,12 +130,14 @@ static void SetSignal(const FunctionCallbackInfo<Value>& info) {
}

static void ShouldReportOnFatalError(const FunctionCallbackInfo<Value>& info) {
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
Copy link
Member

Choose a reason for hiding this comment

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

will defining report_on_fatalerror as std::atomic<bool> be a better approach?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gireeshpunathil You could do that, but I doubt that it’s worth the extra complexity.

info.GetReturnValue().Set(
node::per_process::cli_options->report_on_fatalerror);
}

static void SetReportOnFatalError(const FunctionCallbackInfo<Value>& info) {
CHECK(info[0]->IsBoolean());
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
node::per_process::cli_options->report_on_fatalerror = info[0]->IsTrue();
}

Expand Down