[Spread-users] Spread and fork ()

John Schultz jschultz at spreadconcepts.com
Tue Nov 23 12:05:36 EST 2004


Currently, Spread doesn't really support the fork() process model.

Within the client library, Spread uses the mailbox fd as a handle to 
identify internal connection state.  This means you can't just close() a 
Spread mailbox.  You have to SP_close() it or the library will get 
confused about its internal connection state.

But, SP_close() also sends a signal back to the Spread daemon, which 
causes it to close the connection on its end, which isn't what you 
usually want in a fork/close model.  There is an unexposed function in 
the library called SP_kill that simply closes the fd and cleans up the 
internal connection state, but its use is not "officially" supported.

Finally, Spread uses pthread mutexes to synchronize use of its internal 
connection state(s).  But, Spread does not install fork handlers using 
pthread_atfork() to reset all the mutexes properly.  So, in a forked 
child mutexes may be held by non-existent threads in the new process.

So, the fork/close model isn't really supported in Spread currently.

-- 
John Lane Schultz
Spread Concepts LLC
Phn: 443 838 2200

J C Lawrence wrote:

> On Tue, 23 Nov 2004 00:22:27 -0500
> Ryan Caudy <rcaudy at gmail.com> wrote:
> 
> 
>>So, to me, it's hard to see an application where you would really
>>benefit from sharing one mbox in multiple processes.  I'd be
>>interested to know about your application.
> 
> 
> The application is a distributed RPC system where the nodes executing a
> given RPC are anonymous to the caller.  I use a common control channel
> for all the execution processes (there may be multiple processes per
> node), as well as the population of callers/initiators.  However none of
> that requires or benefits from a single mbox being shared between
> processes.
> 
> --
> J C Lawrence
> ---------(*)                Satan, oscillate my metallic sonatas.
> claw at kanga.nu               He lived as a devil, eh?
> http://www.kanga.nu/~claw/  Evil is a name of a foeman, as I live.
> 
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
> 





More information about the Spread-users mailing list