Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: [OMPI devel] Barrier() after Finalize() when a file handle is leaked.
From: Lisandro Dalcin (dalcinl_at_[hidden])
Date: 2010-09-15 11:28:31

I've tested this with (--enable-debug --enable-picky
--enable-mem-debug) 1.4.2 and 1.5rc6. Despite being debug builds, a
mpi4py user got the same with (likely release) builds in both Ubuntu
and OS X.

$ cat open.c
#include <mpi.h>
int main(int argc, char *argv[]) {
  MPI_File f;
  MPI_Init(&argc, &argv);
  MPI_File_open(MPI_COMM_WORLD, "test.plt", MPI_MODE_RDONLY, MPI_INFO_NULL, &f);
  /* MPI_File_close(&f); */
  return 0;

$ mpicc open.c

$ ./a.out
*** The MPI_Barrier() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[trantor:15145] Abort after MPI_FINALIZE completed successfully; not
able to guarantee that all other processes were killed!

So if you open a file but never close it, a MPI_Barrier() gets called
after MPI_Finalize(). Could that come from a finalizer ROMIO callback?
However, I do not get this failure with MPICH2, and Open MPI seems to
behave just fine regarding MPI_Finalized(), the code below work as

#include <mpi.h>
#include <stdio.h>

static int atexitmpi(MPI_Comm comm, int k, void *v, void *xs) {
  int flag;
  printf("atexitmpi: finalized=%d\n", flag);

int main(int argc, char *argv[]) {
  int keyval = MPI_KEYVAL_INVALID;
  MPI_Init(&argc, &argv);
  MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, atexitmpi, &keyval, 0);
  MPI_Comm_set_attr(MPI_COMM_SELF, keyval, 0);
  return 0;

Lisandro Dalcin
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169