Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Parent terminates when child crashes/terminates (without finalizing)
From: Suraj Prabhakaran (suraj.prabhakaran_at_[hidden])
Date: 2010-12-17 07:13:22


I am observing a behavior where when the parent spawns a child and when
the child terminates abruptly (for example with exit() before
MPI_Finalize() ), the parent also terminates even after both the child
and parent have explicitly called a MPI_disconnect. This turns out to be
a disadvantage. A sample program is as follows:


int main (int argc, char *argv[])
    MPI_Init(&argc, &argv);
    MPI_Comm child_comm;
    MPI_Comm_spawn("./child", MPI_ARGV_NULL, 1, MPI_INFO_NULL, 0,
    printf("spawned a child\n");
    printf("Disconnected from the child\n");
    return 0;


int main (int argc, char *argv[])
    MPI_Init(&argc, &argv);
    MPI_Comm parent, parent1;
    if(parent == MPI_COMM_NULL)
    printf("Child: Disconnected from the parent, Exiting\n\n");


    if(parent1 != MPI_COMM_NULL)
    printf("Child: yes, i got my parent again\n");

    exit(1); //abrupt end

    return 0;

In the above simple example, the second printf will not be displayed
clearly indicating that the child is really disconnected from the
parent. However, at exit() of the child, the parent terminates too.
Perhaps there is a way to avoid this kind of auto cleanup?

Suraj Prabhakaran