[Spread-users] "connection clsoed" problem

Brian Moseley bcm at maz.org
Tue Sep 21 22:25:25 EDT 2004

Ryan Caudy wrote:

> Spread certainly does support multiple connections from a single
> process.  A quick check for your problem suggests a possible root
> cause in the Java Library's implementation.  Basically,
> InputStream.read(byte[] b) isn't guaranteed to read the full length of
> b, and so a more correct version of the library would loop on reading
> (as it does in several other situations).  I see one more instance of
> this problem in the code.  I'll create a patch that fixes both, when I
> have some time to do so.

that makes sense. thanks for the look.

> Is the second message that you multicast sent by the same
> thread/connection?  That exception should *only* be thrown during an
> attempt to connect, so I feel like there must be some detail of the
> scenario I'm missing.  Can you explain further?

you're right. i did a little more digging and found that multiple 
different threads are attempting to open connections. not at all the 
problem that i originally described.

1) thread A opens a connection and multicasts a message.
2) thread B attempts to open a connection and fails.

what's interesting is that this seems to happen only if thread A doesn't 
close its connection, or (as reported by my QA lab) if multiple threads 
attempt to open connections at the same time.

under light load, if i cause each thread to close its connection after 
multicasting, then the problem never occurs. with enough load to cause 4 
threads to execute more or less simultaneously, then only the first 
thread's connection succeeds.

my workaround is to maintain a single open connection shared by all 
threads, but i'm concerned that this will degrade my webapp's 
performance - i need to send ~1000 msgs per second - forcing me to scale 
horizontally more quickly than i'd expected.

More information about the Spread-users mailing list