[Spread-users] Re: NegativeArraySizeException under load

toby cabot tcabot at revasystems.com
Fri Mar 18 09:27:37 EST 2005

toby cabot wrote:
> We're seeing problems with the Java driver when we send a reasonable
> (greater than a couple hundred messages per second) load of messages
> across Spread.  <snip>
> java.lang.NegativeArraySizeException
(also OutOfMemoryExceptions)

One of my TCP-savvy colleagues chased down a workaround for this 
problem.  The problems is caused by overruns in the TCP receive buffer, 
so a workaround is to increase the receive buffer size.  In our case 
128k seems to work, but higher loads might require larger buffer sizes. 
  Interestingly, there's a method called setBufferSizes() that has code 
to increase the buffer size, but for some reason that code is commented out.

> // Set the send and receive buffer sizes.
> /////////////////////////////////////////
> private void setBufferSizes() throws SpreadException
> {
> /* NOT SUPPORTED IN 1.1			
> 	try
> 	{
> 	catch(SocketException e)
> 	{
> 		throw new SpreadException("set/getSend/ReceiveBufferSize(): " + e);
> 	}
> }

I'm not sure why it's commented out (maybe it's got other side effects) 
but something like it should be put back as the driver can't cope with 
non-trivial loads without it.

Any thoughts on the idea of adding some framing to the server-client 
messages so that the driver can tell when an overrun has happened and 
recover from it?


More information about the Spread-users mailing list