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

src: allow preventing debug signal handler start #46681

Merged
merged 2 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,10 @@ inline bool Environment::no_global_search_paths() const {
!options_->global_search_paths;
}

inline bool Environment::should_start_debug_signal_handler() const {
return (flags_ & EnvironmentFlags::kNoStartDebugSignalHandler) == 0;
}

inline bool Environment::no_browser_globals() const {
// configure --no-browser-globals
#ifdef NODE_NO_BROWSER_GLOBALS
Expand Down
1 change: 1 addition & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@ class Environment : public MemoryRetainer {
inline bool tracks_unmanaged_fds() const;
inline bool hide_console_windows() const;
inline bool no_global_search_paths() const;
inline bool should_start_debug_signal_handler() const;
inline bool no_browser_globals() const;
inline uint64_t thread_id() const;
inline worker::Worker* worker_context() const;
Expand Down
6 changes: 4 additions & 2 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,10 @@ bool Agent::Start(const std::string& path,
StartIoThreadAsyncCallback));
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
start_io_thread_async.data = this;
// Ignore failure, SIGUSR1 won't work, but that should not block node start.
StartDebugSignalHandler();
if (parent_env_->should_start_debug_signal_handler()) {
// Ignore failure, SIGUSR1 won't work, but that should not block node start.
StartDebugSignalHandler();
}

parent_env_->AddCleanupHook([](void* data) {
Environment* env = static_cast<Environment*>(data);
Expand Down
6 changes: 5 additions & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,11 @@ enum Flags : uint64_t {
// This control is needed by embedders who may not want to initialize the V8
// inspector in situations where one has already been created,
// e.g. Blink's in Chromium.
kNoCreateInspector = 1 << 9
kNoCreateInspector = 1 << 9,
// Controls where or not the InspectorAgent for this Environment should
// call StartDebugSignalHandler. This control is needed by embedders who may
// not want to allow other processes to start the V8 inspector.
kNoStartDebugSignalHandler = 1 << 10
};
} // namespace EnvironmentFlags

Expand Down
Loading