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 <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
danbev committed Apr 11, 2017
1 parent 327144f commit 4d6d68c
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 @@ -4105,10 +4105,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 @@ -4123,7 +4125,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 4d6d68c

Please sign in to comment.