Skip to content

Commit

Permalink
src: only block SIGUSR1 when HAVE_INSPECTOR
Browse files Browse the repository at this point in the history
I'm currently seeing a timeout error for test-signal-handler.js on
macosx when using the following configuration:

./configure --debug --without-ssl && make -j8 test

--without-ssl implies that there will be no inspector but the signal
SIGUSR1 is blocked in PlatformInit just the same. But in this case
never unblocked which is causing the signal to never be delivered to
the handlers in test-signal-handler.js and it loops until it times out.

Not sure if this is the best way of fixing this but hopefully more eyes
on this will help.

PR-URL: nodejs#12266
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
danbev committed Apr 10, 2017
1 parent 1807080 commit 65a6e05
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4074,10 +4074,12 @@ static void DebugEnd(const FunctionCallbackInfo<Value>& args) {

inline void PlatformInit() {
#ifdef __POSIX__
#if HAVE_INSPECTOR
sigset_t sigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGUSR1);
const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
#endif // HAVE_INSPECTOR

// Make sure file descriptors 0-2 are valid before we start logging anything.
for (int fd = STDIN_FILENO; fd <= STDERR_FILENO; fd += 1) {
Expand All @@ -4092,7 +4094,9 @@ inline void PlatformInit() {
ABORT();
}

#if HAVE_INSPECTOR
CHECK_EQ(err, 0);
#endif // HAVE_INSPECTOR

#ifndef NODE_SHARED_MODE
// Restore signal dispositions, the parent process may have changed them.
Expand Down

0 comments on commit 65a6e05

Please sign in to comment.