[Spread-users] problem re-using private names with 3.17.0

Daniel Rall dlr at finemaltcoding.com
Sun Oct 27 13:16:53 EST 2002


Jeremy Hylton <jeremy at zope.com> writes:

> We have some applications that re-use private names.  I tried running
> some tests with a 3.17.0+ build, i.e. a fresh CVS checkout.  Our test
> applications all fail because they can't use the same private name
> more than once.  I suspect this behavior is a bug introduced in
> 3.17.0.
> 
> I've attached a simple test program that is passed a private name as
> its argument.  It does an SP_connect(), SP_disconnect(), sleep(), and
> a second SP_connect() with the same name.  The second SP_connect()
> always fails with a REJECT_NOT_UNIQUE.  It seems that the only way I
> can convince spread to forget about a name is to restart the daemon.
> 
> I'd be happy to provide more clues, but I'm not sure what to look for.
> 
> Jeremy
> 
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> 
> #include "sp.h"
> 
> char name[9];
> 
> void testconnect()
> {
>     int err, mbox = 0;
>     char private[MAX_GROUP_NAME + 1];
> 
>     err = SP_connect("4803 at jeremy", name, 0, 1, &mbox, private);
>     if (err == ACCEPT_SESSION)
> 	fprintf(stderr, "connected as %s\n", private);
>     else {
> 	fprintf(stderr, "failed to connect: %d\n", err);
> 	return;
>     }
>     SP_disconnect(mbox);
> }
> 
> main(int argc, char *argv[])
> {
>     int f = open("/dev/urandom", O_RDONLY);
>     strncpy(name, argv[1], 8);
>     name[8] = 0;
>     testconnect();
>     sleep(10);
>     testconnect();
> }

Hey Jeremy.  I can't say that I see the preventing of the use of the
same private name by multiple clients as a "bug" (of course I could
easily be wrong here ;), but I can suggest a work around.  Pass a NULL
name to the Spread daemon when you call SP_connect() -- the daemon
will generate and assign your client's connection a private group.
-- 

Daniel Rall <dlr at finemaltcoding.com>




More information about the Spread-users mailing list