Hi,
To avoid that error you need to check function below
private void append(byte[] data)
I think you should add one condition to prevent over buffer size: data.length>storage.remaining()
==> It looks like this:
if (storage.position() + data.length >= storage.capacity() ||
data.length>storage.remaining()) {
ByteBuffer tmp = ByteBuffer.allocate(storage.limit() + data.length *
2);
byte[] tmpData = new byte[storage.position()];
storage.flip();
storage.get(tmpData);
tmp.put(tmpData);
storage = tmp;
logger.warn("Increase storage size. Current size is {}",
storage.array().length);
}
But I think this is just a temporary solution. We need the size of buffer will not be increased.
This is really problem that haunt me.
Not need to setup a proxy, you just send from client to server with high through output ( over 1000 messages per second per connection, each message ~800bytes),you will see this error and other terrible errors like: cannot send any more, lost messages....
We need to pay attention to maximum messages per second, per connection....
Above is my opinion, could you please give more ideas about this, this is very important.
Thank you