[Spread-users] Connecting to spread from Apache/mod_perl2

John Lane Schultz jschultz at spreadconcepts.com
Fri Jun 23 11:51:28 EDT 2006

Daniel Risacher wrote:
> Does anyone have any experiences to share interfacing Apache-based applications (using mod_perl2, in my case) to Spread?
> Initially, I tried just connecting to spread from the mod_perl response handler, posting something, listening for a reponse (with timeout) and disconnecting.  This was distinctly unsatisfying because the disconnect doesn't seem to happen.  The next web request fails because it can't reconnect - the spread private name is already in use.  To remedy this problem, I'm now generating a random private name for each web request.  
> This causes me to wonder: What happens to all the old names/connections?  Am I leaking somewhere?  I don't know, but I'd like to.  Is there some more reasonable thing to do like pooling connections a-la DBI?  Does anyone else have a better approach?
> - Dan

I have no direct experience using the Perl Spread API but in the C version you can specify a NULL login name and that will automatically generate a unique name for your connection.  

There is currently some strangeness (bug?) in Spread handling dead client connections.  It will often keep them around for a significant period of time and then suddenly "realize" that a whole bunch are dead and finally clean them up.  The best thing you can do is call SP_disconnect and let Spread do its thing.  At some point we hope to track Spread's behavior down and see if we can make it handle client disconnections better / quicker.

John Lane Schultz
Spread Concepts LLC
Phn: 443 838 2200
Fax: 301 560 8875

More information about the Spread-users mailing list