Hello Frédéric,
On 9/26/06, Frédéric Brégier <[EMAIL PROTECTED]> wrote:
I would like to propose two patches.
For ObjectSerializationDecoder, except if I badly understood the code,
I don't know why the limit is at 1 MB by default, instead
of Integer.MAX_VALUE ie 2GB.
So if it is ok, I propose to change
private int maxObjectSize = 1048576; // 1MB
to
private int maxObjectSize = Integer.MAX_VALUE; // 2GB
It is to block a malicious client that sends too big object to cause the
server memory underrun. Of course, servers are not malicious. :D
For CompressionFilter, again except if I badly understood the code,
I saw that perhaps the in buffer is not released.
In messagedReceived :
Change :
ByteBuffer inBuffer = ( ByteBuffer ) message;
ByteBuffer outBuffer = inflater.inflate( inBuffer );
nextFilter.messageReceived( session, outBuffer );
into
ByteBuffer inBuffer = ( ByteBuffer ) message;
ByteBuffer outBuffer = inflater.inflate( inBuffer );
inBuffer.release();
nextFilter.messageReceived( session, outBuffer );
In filterWrite :
Change :
ByteBuffer inBuffer = ( ByteBuffer ) writeRequest.getMessage();
ByteBuffer outBuf = deflater.deflate( inBuffer );
nextFilter.filterWrite( session, new WriteRequest( outBuf,
writeRequest
.getFuture() ) );
into
ByteBuffer inBuffer = ( ByteBuffer ) writeRequest.getMessage();
ByteBuffer outBuf = deflater.deflate( inBuffer );
inBuffer.release();
nextFilter.filterWrite( session, new WriteRequest( outBuf,
writeRequest
.getFuture() ) );
I used both patch for a while without any problem until now.
Looks very fine to me. Vinod is the main contributor of the compression
filter, so he might have something to say though. If there's no comment, I
will apply this patch to 1.0.
Thanks,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6