[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b2-32-g9ff9a4e

Service Account noreply at mpich.org
Mon May 11 11:33:05 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  9ff9a4e6f2cca18eba33bb1e384d5c71d8b66303 (commit)
       via  b3edcb539cee5705b14e59b48bd6e74623fdbd1f (commit)
      from  64b775637d138f297c87306901c0978b5e671b37 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/9ff9a4e6f2cca18eba33bb1e384d5c71d8b66303

commit 9ff9a4e6f2cca18eba33bb1e384d5c71d8b66303
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu May 7 13:53:39 2015 -0500

    avoid segfault when calling built-in error handler
    
    we were not correctly handling the case where the error handler
    MPI_ERRORS_ARE_FATAL was called.  credit Lisandro Dalcin with finidng
    the issue.
    
    Signed-off-by: Junchao Zhang <jczhang at mcs.anl.gov>

diff --git a/src/include/mpierror.h b/src/include/mpierror.h
index 78c8612..5a68de7 100644
--- a/src/include/mpierror.h
+++ b/src/include/mpierror.h
@@ -178,6 +178,12 @@ void MPIR_Err_get_string( int, char *, int, MPIR_Err_get_class_string_func_t );
 
 int MPIR_Err_set_msg( int code, const char *msg_string );
 
+/* This routine is called when there is a fatal error. Now public because file
+ * error handling is defined in a separate file from comm and win, but all
+ * three need to call it */
+void MPIR_Handle_fatal_error(struct MPID_Comm *comm_ptr,
+	const char fcname[], int errcode);
+
 #define MPIR_ERR_CLASS_MASK 0x0000007f
 #define MPIR_ERR_CLASS_SIZE 128
 #define MPIR_ERR_GET_CLASS(mpi_errno_) (mpi_errno_ & MPIR_ERR_CLASS_MASK)
diff --git a/src/mpi/errhan/errutil.c b/src/mpi/errhan/errutil.c
index fbe520f..ca3ff40 100644
--- a/src/mpi/errhan/errutil.c
+++ b/src/mpi/errhan/errutil.c
@@ -117,7 +117,6 @@ static int did_err_init = FALSE; /* helps us solve a bootstrapping problem */
    with a valid value.  */
 
 static int checkValidErrcode( int, const char [], int * );
-static void handleFatalError( MPID_Comm *, const char [], int );
 
 #if MPICH_ERROR_MSG_LEVEL >= MPICH_ERROR_MSG_ALL
 static int ErrGetInstanceString( int, char [], int );
@@ -249,7 +248,7 @@ int MPIR_Err_return_comm( MPID_Comm  *comm_ptr, const char fcname[],
     {
         /* for whatever reason, we aren't initialized (perhaps error 
 	   during MPI_Init) */
-        handleFatalError(MPIR_Process.comm_world, fcname, errcode);
+        MPIR_Handle_fatal_error(MPIR_Process.comm_world, fcname, errcode);
         return MPI_ERR_INTERN;
     }
     /* --END ERROR HANDLING-- */
@@ -275,7 +274,7 @@ int MPIR_Err_return_comm( MPID_Comm  *comm_ptr, const char fcname[],
     /* --BEGIN ERROR HANDLING-- */
     if (MPIR_Err_is_fatal(errcode) || comm_ptr == NULL) {
 	/* Calls MPID_Abort */
-	handleFatalError( comm_ptr, fcname, errcode );
+	MPIR_Handle_fatal_error( comm_ptr, fcname, errcode );
         /* never get here */
     }
     /* --END ERROR HANDLING-- */
@@ -292,7 +291,7 @@ int MPIR_Err_return_comm( MPID_Comm  *comm_ptr, const char fcname[],
     if (errhandler == NULL || errhandler->handle == MPI_ERRORS_ARE_FATAL) {
         MPIU_THREAD_CS_EXIT(MPI_OBJ, comm_ptr);
 	/* Calls MPID_Abort */
-	handleFatalError( comm_ptr, fcname, errcode );
+	MPIR_Handle_fatal_error( comm_ptr, fcname, errcode );
         /* never get here */
     }
     /* --END ERROR HANDLING-- */
@@ -365,7 +364,7 @@ int MPIR_Err_return_win( MPID_Win  *win_ptr, const char fcname[], int errcode )
 	win_ptr == NULL || win_ptr->errhandler == NULL || 
 	win_ptr->errhandler->handle == MPI_ERRORS_ARE_FATAL) {
 	/* Calls MPID_Abort */
-	handleFatalError( NULL, fcname, errcode );
+	MPIR_Handle_fatal_error( NULL, fcname, errcode );
     }
     /* --END ERROR HANDLING-- */
 
@@ -432,8 +431,7 @@ static void CombineSpecificCodes( int, int, int );
 static const char *get_class_msg( int );
 
 /* --BEGIN ERROR HANDLING-- */
-/* This routine is called when there is a fatal error */
-static void handleFatalError( MPID_Comm *comm_ptr, 
+void MPIR_Handle_fatal_error( MPID_Comm *comm_ptr,
 			      const char fcname[], int errcode )
 {
     /* Define length of the the maximum error message line (or string with 
diff --git a/src/mpi/errhan/file_call_errhandler.c b/src/mpi/errhan/file_call_errhandler.c
index 7856e0c..4ef7671 100644
--- a/src/mpi/errhan/file_call_errhandler.c
+++ b/src/mpi/errhan/file_call_errhandler.c
@@ -98,6 +98,9 @@ int MPI_File_call_errhandler(MPI_File fh, int errorcode)
 	goto fn_exit;
     }
 
+    if (e->handle == MPI_ERRORS_ARE_FATAL) {
+	MPIR_Handle_fatal_error(NULL, "MPI_File_call_errhandler", errorcode);
+    }
 
     switch (e->language) {
     case MPID_LANG_C:

http://git.mpich.org/mpich.git/commitdiff/b3edcb539cee5705b14e59b48bd6e74623fdbd1f

commit b3edcb539cee5705b14e59b48bd6e74623fdbd1f
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu May 7 13:28:57 2015 -0500

    proper return value for MPI_File_call_errhandler
    
    Lisandro Dalcin found we returned the wrong value from
    MPI_File_call_errhandler.  it should return MPI_SUCCESS unless something
    goes wrong with MPI_File_call_errhandler itself.
    
    Closes #2259
    
    Signed-off-by: Junchao Zhang <jczhang at mcs.anl.gov>

diff --git a/src/mpi/errhan/file_call_errhandler.c b/src/mpi/errhan/file_call_errhandler.c
index e132b24..7856e0c 100644
--- a/src/mpi/errhan/file_call_errhandler.c
+++ b/src/mpi/errhan/file_call_errhandler.c
@@ -95,7 +95,6 @@ int MPI_File_call_errhandler(MPI_File fh, int errorcode)
        not integers.  */
 
     if (e->handle == MPI_ERRORS_RETURN) {
-	mpi_errno = errorcode;
 	goto fn_exit;
     }
 
diff --git a/test/mpi/errhan/Makefile.am b/test/mpi/errhan/Makefile.am
index 2098592..866112f 100644
--- a/test/mpi/errhan/Makefile.am
+++ b/test/mpi/errhan/Makefile.am
@@ -20,6 +20,7 @@ noinst_PROGRAMS = \
     errfatal      \
     predef_eh     \
     errstring2    \
+    file_errhdl   \
     dynamic_errcode_predefined_errclass
 
 EXTRA_PROGRAMS = errcode errring errstring
diff --git a/test/mpi/errhan/file_errhdl.c b/test/mpi/errhan/file_errhdl.c
new file mode 100644
index 0000000..7b58c2d
--- /dev/null
+++ b/test/mpi/errhan/file_errhdl.c
@@ -0,0 +1,26 @@
+/* test case contributed by Lisandro Dalcin <dalcinl at gmail.com> */
+#include <mpi.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+  int ierr;
+  MPI_File fh;
+  MPI_Init(&argc, &argv);
+
+  MPI_File_open(MPI_COMM_WORLD,"/tmp/datafile",
+                MPI_MODE_CREATE|MPI_MODE_RDWR|MPI_MODE_DELETE_ON_CLOSE,
+                MPI_INFO_NULL,&fh);
+
+  MPI_File_set_errhandler(fh,MPI_ERRORS_RETURN);
+  ierr = MPI_File_call_errhandler(fh,MPI_ERR_FILE);
+  if (ierr != MPI_SUCCESS) {
+      fprintf(stderr, "ierr: %d, expected: %d\n", ierr, (int)MPI_SUCCESS);
+  } else {
+      printf(" No Errors\n");
+  }
+  MPI_File_close(&fh);
+
+  MPI_Finalize();
+  return 0;
+}
diff --git a/test/mpi/errhan/testlist b/test/mpi/errhan/testlist
index ebd60ff..47e3381 100644
--- a/test/mpi/errhan/testlist
+++ b/test/mpi/errhan/testlist
@@ -5,3 +5,4 @@ predef_eh 1
 predef_eh 2
 errstring2 1
 dynamic_errcode_predefined_errclass 1
+file_errhdl 1

-----------------------------------------------------------------------

Summary of changes:
 src/include/mpierror.h                |    6 ++++++
 src/mpi/errhan/errutil.c              |   12 +++++-------
 src/mpi/errhan/file_call_errhandler.c |    4 +++-
 test/mpi/errhan/Makefile.am           |    1 +
 test/mpi/errhan/file_errhdl.c         |   26 ++++++++++++++++++++++++++
 test/mpi/errhan/testlist              |    1 +
 6 files changed, 42 insertions(+), 8 deletions(-)
 create mode 100644 test/mpi/errhan/file_errhdl.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list