Newsgroups: comp.parallel.pvm
From: lowekamp@cs.cmu.edu (Bruce Lowekamp)
Subject: bug in pvm 3.3.8
Organization: School of Computer Science, Carnegie Mellon
Date: 22 Aug 1995 22:41:34 GMT
Message-ID: <41dmeu$t19@cantaloupe.srv.cs.cmu.edu>


Has anyone else seen a problem like this with pvm 3.3.8?

Whenever you receive a message and immediately make the receive buffer
your send buffer, errors (usually segmentation faults) occur.  I have
the following sample code that triggers this:

----------------
#include <stdio.h>
#include <pvm3.h>

main()
{
  int cc;

  if(pvm_parent() == PvmNoParent) {
    int child;

    cc=pvm_spawn("testfoo", NULL, PvmTaskDebug, NULL, 1, &child);
    fprintf (stderr, "spawned %i\n", cc);
    cc=pvm_initsend(PvmDataDefault);
    fprintf (stderr, "inited %i\n", cc);
    cc=pvm_pkint(&child,1,1);
    fprintf (stderr, "packed %i\n", cc);
    cc=pvm_send(child, 1);
    fprintf(stderr, "sent %i\n", cc);
    sleep(5);
  }
  else
    {
      cc=pvm_recv(-1, 1);
      fprintf (stderr, "received %i\n", cc);
      cc = pvm_getrbuf();
      fprintf(stderr, "getrbuf %i\n", cc);
      cc=pvm_setsbuf(cc);
      fprintf (stderr, "setsbuf %i\n", cc);
      sleep(4);
    }
}
----------------

When compiled and run using pvm3.3.8 on an alpha running version 2.0
of the os, the following output occurs:

parent:
spawned 1
inited 5
packed 0
sent 0

-----------
child:
received 5
getrbuf 5

Program received signal SIGSEGV, Segmentation fault.
0x12000c6a0 in enc_xdr_init () at ../lpvmpack.c:780
../lpvmpack.c:780: No such file or directory.
------------

A little tracing reveals that in enc_xdt_init, the xdrmem_create
function call references several elements of the structure pointed to
by fp, which is assigned to an address only if a certain condition is
true.  The above example causes that condition to be false, which
leaves the value of fp equivalent to whatever garbage was on the stack
before.

I haven't noticed a bug report of this problem before.  This if
condition is new in 3.3.8.  Does anyone have a patch?

Bruce





-- 
Bruce Lowekamp				lowekamp@cs.cmu.edu
Carnegie Mellon Computer Science	(412)268-7673
http://www.cs.cmu.edu/~lowekamp/home.html

