From e023ad625fbfa97ed0cfcd05861f626e55b4b262 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 29 Mar 2008 03:32:44 -0500 Subject: [svn-r14783] In Red storm, the process may hang when it was writing data and got interrupted by ALARM. Eliminate all printf() calls during signal handling. Also _exit() sometimes hangs the Red Storm processes. Replaced it with SIGTERM. Moved trecover away from TEST_PROG since it always exits with non-zero status since it is ended by SIGTERM now. Tested: Kagiso and Red Storm. --- tools/h5recover/Makefile.am | 5 +++-- tools/h5recover/Makefile.in | 6 +++--- tools/h5recover/trecover_crasher.c | 13 +++++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/h5recover/Makefile.am b/tools/h5recover/Makefile.am index 36f47a3..1b304d7 100644 --- a/tools/h5recover/Makefile.am +++ b/tools/h5recover/Makefile.am @@ -24,7 +24,7 @@ include $(top_srcdir)/config/commence.am INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts -TEST_PROG=trecover +TEST_PROG= TEST_SCRIPT=testh5recover.sh check_PROGRAMS=$(TEST_PROG) @@ -37,7 +37,8 @@ trecover_SOURCES=trecover_main.c trecover_writer.c trecover_crasher.c # Our main target, the h5recover tool. # For now, it is a dummy program in order to provide a real executable # for the Red Storm platform. -bin_PROGRAMS=h5recover +# Added trecover here since we don't want it in TEST_PROG as it gets SIGTERM by default. +bin_PROGRAMS=h5recover trecover # All the programs depend on the hdf5 and h5tools libraries LDADD=$(LIBH5TOOLS) $(LIBHDF5) diff --git a/tools/h5recover/Makefile.in b/tools/h5recover/Makefile.in index 0122095..b649489 100644 --- a/tools/h5recover/Makefile.in +++ b/tools/h5recover/Makefile.in @@ -53,7 +53,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/testh5recover.sh.in $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am check_PROGRAMS = $(am__EXEEXT_1) -bin_PROGRAMS = h5recover$(EXEEXT) +bin_PROGRAMS = h5recover$(EXEEXT) trecover$(EXEEXT) TESTS = $(check_PROGRAMS) $(check_SCRIPTS) subdir = tools/h5recover ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -65,7 +65,7 @@ CONFIG_HEADER = $(top_builddir)/src/H5config.h CONFIG_CLEAN_FILES = testh5recover.sh am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -am__EXEEXT_1 = trecover$(EXEEXT) +am__EXEEXT_1 = PROGRAMS = $(bin_PROGRAMS) h5recover_SOURCES = h5recover.c h5recover_OBJECTS = h5recover.$(OBJEXT) @@ -328,7 +328,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.out *.err INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # Test programs and scripts -TEST_PROG = trecover +TEST_PROG = TEST_SCRIPT = testh5recover.sh check_SCRIPTS = $(TEST_SCRIPT) SCRIPT_DEPEND = trecover$(EXEEXT) diff --git a/tools/h5recover/trecover_crasher.c b/tools/h5recover/trecover_crasher.c index 4e558d5..adcb33e 100644 --- a/tools/h5recover/trecover_crasher.c +++ b/tools/h5recover/trecover_crasher.c @@ -30,12 +30,15 @@ void crasher(int crash_mode, CrasherParam_t *crash_param) { - float fraction, integral; - struct itimerval old, new; + float fraction, integral; + struct itimerval old, new; + pid_t mypid; switch (crash_mode) { case SyncCrash: - _exit(0); + /* need to use SIGTERM since _exit(0) may hang in Red Storm. */ + mypid = getpid(); + kill(mypid, SIGTERM); /* Terminate myself */ break; case AsyncCrash: /* Setup a wakeup call in the future */ @@ -54,9 +57,11 @@ crasher(int crash_mode, CrasherParam_t *crash_param) } +/* Red Storm may hang if the signal handlin routine does I/O, even just printf() calls. + * Be aware if you want to add printf calls. + */ void wakeup(int signum) { - printf("wakeup, call sync crash\n"); /* call crasher with sync mode */ crasher(SyncCrash, 0); } -- cgit v0.12