Skip to content

Commit

Permalink
Re-signal when caught
Browse files Browse the repository at this point in the history
Summary:
This makes it so systemd properly determines that the process died due
to a signal and avoids unclean exits.

Reviewed By: brianc118

Differential Revision: D51814324

fbshipit-source-id: 9c136a9d1b31e384ebddff4589f936886a06ec9a
  • Loading branch information
Dan Schatzberg authored and facebook-github-bot committed Dec 4, 2023
1 parent d4ee80c commit cadaa83
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/oomd/Oomd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ int Oomd::run(const sigset_t* mask) {
perror("sigtimedwait");
exit(EXIT_FAILURE);
} else if (rc != -1) {
OLOG << "Received signal " << rc << ". Exiting!";
return 128 + rc;
// Synchronously log to stderr so there's no buffering
std::cerr << "Received signal " << rc << ". Exiting!";
pthread_sigmask(SIG_UNBLOCK, mask, nullptr);
pthread_kill(pthread_self(), rc);
return -1;
}

if (fs_drop_in_service_) {
Expand Down

0 comments on commit cadaa83

Please sign in to comment.