From 74cbf1f1b759f9e15167eab456c80e3353905d42 Mon Sep 17 00:00:00 2001 From: "Christopher J. Morrone" <morrone2@llnl.gov> Date: Wed, 30 Nov 2005 20:03:35 +0000 Subject: [PATCH] Fix tes6.12 by unblocking signals in tasks processes that were globally blocked in slurmstepd. Also fix bug in the test itself. --- src/slurmd/slurmstepd/Makefile.am | 2 +- src/slurmd/slurmstepd/mgr.c | 4 ++++ src/slurmd/slurmstepd/slurmstepd.c | 8 ++++---- src/slurmd/slurmstepd/slurmstepd.h | 33 ++++++++++++++++++++++++++++++ testsuite/expect/test6.12 | 14 ++++++++----- 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 src/slurmd/slurmstepd/slurmstepd.h diff --git a/src/slurmd/slurmstepd/Makefile.am b/src/slurmd/slurmstepd/Makefile.am index 5640e2bcadc..5cd2fc90233 100644 --- a/src/slurmd/slurmstepd/Makefile.am +++ b/src/slurmd/slurmstepd/Makefile.am @@ -16,7 +16,7 @@ slurmstepd_LDADD = \ slurmstepd_SOURCES = \ - slurmstepd.c \ + slurmstepd.c slurmstepd.h \ mgr.c mgr.h \ task.c task.h \ slurmstepd_job.c slurmstepd_job.h \ diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c index 2fdfa51b1af..cb2494df747 100644 --- a/src/slurmd/slurmstepd/mgr.c +++ b/src/slurmd/slurmstepd/mgr.c @@ -71,6 +71,7 @@ #include "src/slurmd/common/setproctitle.h" #include "src/slurmd/common/proctrack.h" #include "src/slurmd/common/task_plugin.h" +#include "src/slurmd/slurmstepd/slurmstepd.h" #include "src/slurmd/slurmstepd/mgr.h" #include "src/slurmd/slurmstepd/task.h" #include "src/slurmd/slurmstepd/io.h" @@ -593,6 +594,7 @@ _fork_all_tasks(slurmd_job_t *job) return SLURM_ERROR; } else if (pid == 0) { /* child */ int j; + #ifdef HAVE_AIX (void) mkcrid(0); #endif @@ -608,6 +610,8 @@ _fork_all_tasks(slurmd_job_t *job) log_fini(); + xsignal_unblock(slurmstepd_blocked_signals); + exec_task(job, i, readfds[i]); } diff --git a/src/slurmd/slurmstepd/slurmstepd.c b/src/slurmd/slurmstepd/slurmstepd.c index 95ef5cde49b..1e9e1fe9d30 100644 --- a/src/slurmd/slurmstepd/slurmstepd.c +++ b/src/slurmd/slurmstepd/slurmstepd.c @@ -39,6 +39,7 @@ #include "src/slurmd/slurmd/slurmd.h" #include "src/slurmd/common/slurmstepd_init.h" #include "src/slurmd/common/stepd_api.h" +#include "src/slurmd/slurmstepd/slurmstepd.h" #include "src/slurmd/slurmstepd/mgr.h" #include "src/slurmd/slurmstepd/slurmstepd_job.h" @@ -50,9 +51,8 @@ static slurmd_job_t *_step_setup(slurm_addr *cli, slurm_addr *self, slurm_msg_t *msg); static void _step_cleanup(slurmd_job_t *job, slurm_msg_t *msg, int rc); - -static int block_signals[] = { - SIGPIPE, SIGHUP, 0 +int slurmstepd_blocked_signals[] = { + SIGPIPE, 0 }; int @@ -64,7 +64,7 @@ main (int argc, char *argv[]) slurmd_job_t *job; int rc; - xsignal_block(block_signals); + xsignal_block(slurmstepd_blocked_signals); conf = xmalloc(sizeof(*conf)); conf->argv = &argv; conf->argc = &argc; diff --git a/src/slurmd/slurmstepd/slurmstepd.h b/src/slurmd/slurmstepd/slurmstepd.h new file mode 100644 index 00000000000..29547c94c7c --- /dev/null +++ b/src/slurmd/slurmstepd/slurmstepd.h @@ -0,0 +1,33 @@ +/*****************************************************************************\ + * src/slurmd/slurmstepd/slurmstepd.h - slurmstepd general header file + * $Id: slurmstepd.h 6543 2005-11-05 00:00:55Z morrone $ + ***************************************************************************** + * Copyright (C) 2005 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Christopher J. Morrone <morrone2@llnl.gov>. + * UCRL-CODE-2002-040. + * + * This file is part of SLURM, a resource management program. + * For details, see <http://www.llnl.gov/linux/slurm/>. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +\*****************************************************************************/ + +#ifndef _SLURMSTEPD_H +#define _SLURMSTEPD_H + +extern int slurmstepd_blocked_signals[]; + +#endif /* !_SLURMSTEPD_H */ diff --git a/testsuite/expect/test6.12 b/testsuite/expect/test6.12 index 05613e31ca0..6376d20754a 100755 --- a/testsuite/expect/test6.12 +++ b/testsuite/expect/test6.12 @@ -152,8 +152,10 @@ exec $scancel --quiet $job_id # Build and run second test script # exec $bin_rm -f $file_in $file_out $file_err -exec echo "#!$bin_bash" >$file_in -exec echo "$bin_sleep 500" >>$file_in +set file [open $file_in "w"] +puts $file "#!$bin_bash" +puts $file "$bin_sleep 500" +close $file exec $bin_chmod 700 $file_in set job_id 0 @@ -233,9 +235,11 @@ if {$exit_code != 0} { # set job_id 0 exec $bin_rm -f $file_in $file_out $file_err -exec echo "#!$bin_bash" >$file_in -exec echo "$srun $bin_sleep 500 &" >>$file_in -#exec echo "wait" >>$file_in +set file [open $file_in "w"] +puts $file "#!$bin_bash" +puts $file "$srun $bin_sleep 500" +#puts $file "wait" +close $file exec $bin_chmod 700 $file_in spawn $srun --batch --output=$file_out --error=$file_err -t2 $file_in -- GitLab