summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-03-13 21:40:31 +0100
committerGitHub <noreply@github.com>2018-03-13 21:40:31 +0100
commit00a44e83c9b1c37b94e2504a06c981535bb51623 (patch)
tree857b3f8eaa36a392e6e3f9132bb249c26502b05a
parent6738d7497baeef5c21d4cfa0686bab10b1194815 (diff)
downloadbugzilla-00a44e83c9b1c37b94e2504a06c981535bb51623.tar.gz
bugzilla-00a44e83c9b1c37b94e2504a06c981535bb51623.tar.xz
Bug 1441181 - Step 9 - use pdeathsig to prevent workers running without supervision
-rw-r--r--.circleci/config.yml2
-rw-r--r--Dockerfile3
-rwxr-xr-xMakefile.PL15
-rw-r--r--jobqueue-worker.pl9
4 files changed, 20 insertions, 9 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 7a2c62e82..7d9cfdfde 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -16,7 +16,7 @@ main_filters: &main_filters
defaults:
bmo_slim_image: &bmo_slim_image
- image: mozillabteam/bmo-slim:20180225.1
+ image: mozillabteam/bmo-slim:20180313.1
user: app
mysql_image: &mysql_image
diff --git a/Dockerfile b/Dockerfile
index ac101bb94..d367a80d4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,4 @@
-FROM mozillabteam/bmo-slim:20180225.1
-
+FROM mozillabteam/bmo-slim:20180313.1
ARG CI
ARG CIRCLE_SHA1
diff --git a/Makefile.PL b/Makefile.PL
index 34e4e2487..d7c359bf0 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -22,6 +22,7 @@ BEGIN {
use ExtUtils::MakeMaker 7.22;
use File::Basename;
use File::Spec;
+use English qw(-no_match_vars $OSNAME);
BEGIN {
if ( $ENV{BZ_SILENT_MAKEFILE} ) {
@@ -88,21 +89,25 @@ my %test_requires = (
my %recommends = ( Safe => '2.30' );
# Windows requires some additional modules.
-if ( $^O eq 'MSWin32' ) {
+if ( $OSNAME eq 'MSWin32' ) {
$requires{'Win32'} = '0.35';
$requires{'Win32::API'} = '0.55';
$requires{'DateTime::TimeZone::Local::Win32'} = '1.64';
}
-# for some reason, we need these on ubuntu.
-if ( $^O eq 'linux' && -f '/etc/debian_version' ) {
- my @extra = qw(
+if ( $OSNAME eq 'linux' ) {
+ # This isn't strictly needed, but it is nice to have.
+ # we use it to make sure jobqueue-workers exit when their parent exits.
+ my @extra = qw(Linux::Pdeathsig);
+
+ # for some reason, we need these on ubuntu.
+ push @extra, qw(
Linux::Pid
Test::Pod::Coverage
Pod::Coverage::TrustPod
Test::CPAN::Meta
Test::Pod
- );
+ ) if -f '/etc/debian_version';
$requires{$_} = 0 for @extra;
}
diff --git a/jobqueue-worker.pl b/jobqueue-worker.pl
index 6205e1bf4..b26aacdba 100644
--- a/jobqueue-worker.pl
+++ b/jobqueue-worker.pl
@@ -24,8 +24,9 @@ BEGIN {
use Bugzilla::JobQueue::Worker;
use Bugzilla::JobQueue;
use Bugzilla;
-use English qw(-no_match_vars $PROGRAM_NAME);
+use English qw(-no_match_vars $PROGRAM_NAME $OSNAME);
use Getopt::Long qw(:config gnu_getopt);
+use if $OSNAME eq 'linux', 'Linux::Pdeathsig', 'set_pdeathsig';
BEGIN { Bugzilla->extensions }
my $name = basename(__FILE__);
@@ -37,4 +38,10 @@ if ($name) {
$PROGRAM_NAME = $name;
## use critic
}
+
+if ($OSNAME eq 'linux') {
+ # get SIGTEMR (15) when parent exits.
+ set_pdeathsig(15);
+}
+
Bugzilla::JobQueue::Worker->run('work');