Newsgroups: comp.parallel.pvm
From: poirriez@lotus.ens.fr (Vincent Poirriez)
Subject: Re: last message lost
Organization: Ecole Normale Superieure, PARIS, France
Date: 7 Jun 1994 14:42:19 GMT
Message-ID: <2t210b$ld2@nef.ens.fr>

In article <2t1q6d$hi0@nef.ens.fr>,
Vincent Poirriez <poirriez@lotus.ens.fr> wrote:
>Hello evry body,
>
> perhaps someone can help, here is my problem:
>
>for information, I use pvm3.3 and previously it was pvm3.2.6 on sparc station running
>sunos4.1.3c
>
>I define a task which job is to send a message to it's parent.
>The message is built with pvm_pkbyte. It uses an array
>built by dynamic allocation (malloc).
>
>pvm_send is the last action of the task.
>
>The problem is the following:
> pvm_send always returns 0 but the message sometimes does not
>arrived.
>
> All run perfectly if I spawn the task with the Debug flag.
> All is also correct if I add sleep(5) after pvm_send.
>
>When I read in the release-notes that the last message no longer lost, 
>I was happy...
>
>As I tried to understand, I look at the buffer information just
>before the pvm_send.  It returns the correct size for the message
>(in version 3.2.6, the size was 0).
>
>thank you for any help.
>Vincent Poirriez


Here is an example:

The file bugsl.c :

#include"pvm3.h"
#include<stdio.h>
main()

{int i,info,tag,bufid,bytes,msgtag,tid;
 char * arr;
tid = pvm_parent();
printf("myparent: %d\n",tid);
info=pvm_recv(tid,-1);
info=pvm_upkint(&tag,1,1);
printf("tag: %d/n",tag);fflush(stdout);
arr = (char *)malloc(2500);
for (i=0;i<2300;i++) 
  {*arr='a';arr++;}
*arr=0;
arr+=-2300;
printf("arr: %s\n",arr);fflush (stdout);
bufid=pvm_initsend(PvmDataDefault);
info=pvm_pkbyte(arr,2300,1);
info=pvm_bufinfo(bufid,&bytes,&msgtag,&tid);
printf("length send: %d to: %d\n",bytes,tid);fflush(stdout);
info=pvm_send(pvm_parent(),tag);
printf("info: %d\n",info);fflush(stdout);
}

And the file bugmast.c:

#include<stdio.h>
#include"pvm3.h"
main()

{int info,bufid,tids[1],bytes,msgtag,tid,tag;
 char * arr;

tag=5;
info=pvm_spawn ("bugsl",0, 0, "" ,1, &tids[0]);
bufid=pvm_initsend(PvmDataDefault);
info=pvm_pkint(&tag,1,1);
info=pvm_send(tids[0],1);
arr = (char *)malloc(2500);
bufid=pvm_recv (tids[0], 5);
info=pvm_bufinfo (bufid,&bytes,&msgtag,&tid);
printf("length: %d from: %d\n",bytes,tid);
fflush(stdout);
}

