users@glassfish.java.net

Re: JSON Compression from JAX-RS in Glassfish

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 8 Dec 2010 10:03:20 +0100

Hi Ronak,

I have not. Can you confirm this the case when only using JSON?

One thing you might be able to do is enable Jersey's GZIP content
encoding filter [1] instead of GFs to see if similar intermittent
problems occur. That might help isolate the issue.

It might be that the GZIP Grizzly support is prematurely reseting or
finishing the deflator.

Paul.

[1] http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/container/filter/GZIPContentEncodingFilter.html

On Dec 7, 2010, at 3:38 PM, Ronak Patel wrote:

> Hi all,
>
> Has anyone ever tried to gzip compress the json being generated by
> JAX-RS Jersey through Glassfish V3?
>
> I'm seeing intermittent stack traces like these:
>
> Caused by: org.apache.catalina.connector.ClientAbortException:
> java.io.IOException: write beyond end of stream
> at
> org
> .apache
> .catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:425)
> at
> com.sun.grizzly.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
> at
> org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:
> 373)
> at
> org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:
> 351)
> at
> org
> .apache
> .catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:
> 176)
> at com.sun.jersey.spi.container.servlet.WebComponent
> $Writer.flush(WebComponent.java:318)
> at com.sun.jersey.spi.container.ContainerResponse
> $CommittingOutputStream.flush(ContainerResponse.java:145)
> at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:278)
> at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
> at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:
> 212)
> at
> org
> .codehaus
> .jackson.impl.WriterBasedGenerator.flush(WriterBasedGenerator.java:
> 640)
> at
> com
> .sun
> .jersey
> .json
> .impl
> .writer
> .JacksonRootStrippingGenerator
> .flush(JacksonRootStrippingGenerator.java:236)
> at
> com
> .sun
> .jersey
> .json
> .impl
> .writer
> .JacksonStringMergingGenerator
> .flush(JacksonStringMergingGenerator.java:240)
> at
> com
> .sun
> .jersey
> .json.impl.writer.Stax2JacksonWriter.flush(Stax2JacksonWriter.java:
> 350)
> ... 51 more
> Caused by: java.io.IOException: write beyond end of stream
> at
> java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:
> 104)
> at
> java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
> at
> com
> .sun
> .grizzly
> .tcp.http11.filters.GzipOutputFilter.doWrite(GzipOutputFilter.java:
> 125)
> at
> com
> .sun
> .grizzly
> .tcp.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:
> 640)
> at com.sun.grizzly.tcp.Response.doWrite(Response.java:676)
> at
> org
> .apache
> .catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:420)
> ... 64 more
>
> Does anyone have any suggestions to try?
>
> Ronak Patel
>
>