Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] SIGPIPE handling?
From: Jesse Ziser (ziser_at_[hidden])
Date: 2010-11-24 19:08:35


Hello,

I've noticed that OpenMPI does not seem to detect when something
downstream of it fails. Specifically, I think it does not handle
SIGPIPE or pass it down to its young, but it still prints an error
message every time it occurs.

For example, running a command like this:

   mpirun -np 1 ./mpi-cat </dev/zero | dd bs=1 count=1 >/dev/null

(where mpi-cat is just a simple program that initializes MPI and then
copies its input to its output) hangs after the dd quits, and produces
an eternity of repetitions of this error message:

   [[35845,0],0] reports a SIGPIPE error on fd 13

I am unsure whether this is the intended behavior, but it certainly
seems unfortunate from my persepective. Is there any way to make it
exit nicely, preferably with a single error, whenever what it's trying
to write to doesn't exist anymore? I think I could even submit a patch
to make it quit on SIGPIPE, if it is agreed that that makes sense.

Here's the source for my mpi-cat example:

   #include <stdio.h>

   #include <mpi.h>

   int main (int iArgC, char *apArgV [])
   {
       int iRank;

       MPI_Init (&iArgC, &apArgV);

       MPI_Comm_rank (MPI_COMM_WORLD, &iRank);

       if (iRank == 0)
       {
           while(1)
               if(putchar(getchar()) < 0)
                   break;
       }

       MPI_Finalize ();

       return (0);
   }

Thank you,

Jesse Ziser
Applied Research Laboratories:
The University of Texas at Austin