[mpich2-commits] r5625 - in mpich2/trunk/src/mpi/romio: adio/common mpi-io
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Thu Oct 29 16:57:00 CDT 2009
Author: goodell
Date: 2009-10-29 16:57:00 -0500 (Thu, 29 Oct 2009)
New Revision: 5625
Modified:
mpich2/trunk/src/mpi/romio/adio/common/ad_end.c
mpich2/trunk/src/mpi/romio/mpi-io/close.c
Log:
Reset the errhandler in MPI_File_close and ADIO_End.
Prior to this commit we leaked user-defined errhandlers because the file
closure was never communicated back to MPICH2 in order to release the
errhandler reference.
Reviewed by robl at .
Modified: mpich2/trunk/src/mpi/romio/adio/common/ad_end.c
===================================================================
--- mpich2/trunk/src/mpi/romio/adio/common/ad_end.c 2009-10-29 21:56:59 UTC (rev 5624)
+++ mpich2/trunk/src/mpi/romio/adio/common/ad_end.c 2009-10-29 21:57:00 UTC (rev 5625)
@@ -17,6 +17,10 @@
/* FPRINTF(stderr, "reached end\n"); */
+ /* if a default errhandler was set on MPI_FILE_NULL then we need to ensure
+ * that our reference to that errhandler is released */
+ PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN);
+
/* delete the flattened datatype list */
curr = ADIOI_Flatlist;
while (curr) {
Modified: mpich2/trunk/src/mpi/romio/mpi-io/close.c
===================================================================
--- mpich2/trunk/src/mpi/romio/mpi-io/close.c 2009-10-29 21:56:59 UTC (rev 5624)
+++ mpich2/trunk/src/mpi/romio/mpi-io/close.c 2009-10-29 21:57:00 UTC (rev 5625)
@@ -72,6 +72,14 @@
}
}
+ /* Because ROMIO expects the MPI library to provide error handler management
+ * routines but it doesn't ever participate in MPI_File_close, we have to
+ * somehow inform the MPI library that we no longer hold a reference to any
+ * user defined error handler. We do this by setting the errhandler at this
+ * point to MPI_ERRORS_RETURN. */
+ error_code = PMPI_File_set_errhandler(*mpi_fh, MPI_ERRORS_RETURN);
+ if (error_code != MPI_SUCCESS) goto fn_fail;
+
ADIO_Close(fh, &error_code);
MPIO_File_free(mpi_fh);
/* --BEGIN ERROR HANDLING-- */
More information about the mpich2-commits
mailing list