Newsgroups: comp.parallel.pvm
Path: ukc!uknet!EU.net!Germany.EU.net!netmbx.de!zib-berlin.de!informatik.tu-muenchen.de!unknown!erlebach
From: erlebach@Informatik.TU-Muenchen.DE (Thomas Erlebach)
Subject: Lost messages using PvmRouteDirect
Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
Organization: Technische Universitaet Muenchen, Germany
Date: Tue, 18 Jan 1994 17:24:45 GMT
Message-ID: <erlebach.758913885@unknown>
Lines: 86


Hi,

we are using pvm3.2 (patch level 4) on HP workstations (Series 9000/720)
as well as on Sun SPARCstations (running SunOS 4.1.3).

Trying to use direct task-to-task-communication by performing
"pvm_setopt(PvmRoute, PvmRouteDirect)" in my pvm-tasks I
encountered the following problem: Messages sent by a task
right before its termination get lost and the receiver's
pvm_recv()-call gets delayed forever.

For demonstration of this problem I have written a little program
that spawns one child task, sends a message to the child, sleeps for
three seconds, receives a message from the child, and terminates.
The program, when started as a child, receives a message from its
parent, sends a message to its parent, and terminates.

Using communication via the pvm daemons the program works. But when I
use direct task-to-task-communication (by performing the pvm_setopt()-
call I mentioned above) the child's message to the parent gets lost.
The child terminates while the parent is still sleeping. When the
parent reaches the pvm_recv()-call, it gets delayed forever.

The program is quite short and so I have included it at the end of this
message.

The reason for the problem seems to be: When a process terminates,
all of its messages which are still "on the way" are discarded. In
my opinion pvm should avoid this (probably in the pvm_exit()-
routine).

I'd very much appreciate any information concerning this problem. Has
anybody else had this problem? Am I doing something wrong? Is there a
way to avoid this problem?

Thanks,

Thomas Erlebach (erlebach@informatik.tu-muenchen.de)

--------- begin bug.c ------------------------------------------------------

#include <sys/types.h>
#include "pvm3.h"

main()
{
    int mytid;                  /* my task id */
    int parent;                 /* parent's task id */
    int child;			/* child's task id */
    int i;

    /* enroll in pvm */
    mytid = pvm_mytid();
    if (mytid<0) exit();

    pvm_setopt(PvmAutoErr, 1);
    pvm_setopt(PvmRoute, PvmRouteDirect);

    /* find out if I am parent or child */
    parent = pvm_parent();
    if( parent < 0 )       /* then I am the parent */
    {
       /* start up one copy of myself */
       pvm_spawn("bug", (char**)0, 0, "", 1, &child);

       pvm_initsend( PvmDataDefault );
       pvm_send( child, 5 );
       printf("parent sleeps\n");
       sleep(3);
       printf("parent calls pvm_recv\n");
       pvm_recv( child, 6);
       printf("parent exits\n");
    }
    else    /* I am the child */
    {
       pvm_recv( parent, 5);
       pvm_initsend( PvmDataDefault );
       pvm_send( parent, 6 );
    }

     /* program finished exit pvm */
     pvm_exit();
     exit(1);
}
--------- end bug.c --------------------------------------------------------

