dev@grizzly.java.net

Re: java.io.IOException: write beyond end of stream

From: rama <rama.rama_at_tiscali.it>
Date: Fri, 16 Apr 2010 18:19:56 +0200

Nope, no error is displayed on browser.
Also, after this exception, the WS isn't able to serve page -sorry probably haven't specified that, but the error isn't just a line, the issue is that GWS at the moment isn't usable unless i set compression off-
, so probably remove the log won't really fix the problem :)


Thanks!


> Hi Rama,
>
> when quickly refreshing the browser, do you see any error there, like browser shows 500 or 404 result or corrupted html page?
> I think this Exception might be caused by fact, that browser closes client connection, when server sends the data there. So GZip filter throws the exception. The possible fix - is just to reduce the logging level of this exception.
>
> Thanks.
>
> WBR,
> Alexey.
>
> On Apr 15, 2010, at 16:57 , rama.rama_at_tiscali.it wrote:
>
>> Hi there,
>>
>> got an exception doing that
>>
>> 1) running a gws (as .java on
>> this mail)
>> 2) refresh quickly at http://127.0.0.1:6666/ using firefox
>> for 10-12 time
>> 3) KABOOM :)
>> 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 test.
>> wsTest$myAdapter.doWrite(wsTest.java:55)
>> at test.wsTest$myAdapter.
>> service(wsTest.java:38)
>> at com.sun.grizzly.tcp.http11.GrizzlyAdapter.
>> service(GrizzlyAdapter.java:166)
>> at com.sun.grizzly.tcp.http11.
>> GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:180)
>> at com.sun.
>> grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
>> at
>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:
>> 791)
>> at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.
>> java:693)
>> at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.
>> java:954)
>> at com.sun.grizzly.http.DefaultProtocolFilter.execute
>> (DefaultProtocolFilter.java:170)
>> at com.sun.grizzly.
>> DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:
>> 135)
>> at com.sun.grizzly.DefaultProtocolChain.execute
>> (DefaultProtocolChain.java:102)
>> at com.sun.grizzly.
>> DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
>> at com.sun.
>> grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
>> at
>> com.sun.grizzly.ProtocolChainContextTask.doCall
>> (ProtocolChainContextTask.java:53)
>> at com.sun.grizzly.
>> SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
>> at com.
>> sun.grizzly.ContextTask.run(ContextTask.java:69)
>> at com.sun.grizzly.
>> util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
>> at
>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.
>> java:309)
>> at java.lang.Thread.run(Thread.java:619)
>>
>> probably the GZIP
>> cause this problem (where probably -> for sure).
>> This only happen when
>> buffer to write is bigger than some min amount (??) probably there is a
>> limit for the compression
>>
>> Best regards! :)
>>
>>
>> ---------------------------------------------------------------------------------------------------
>>
>> package test;
>>
>>
>> import com.eg.euler.Util;
>> import com.eg.euler.ipc.http.
>> newHttp.grizzly.GrizzlyResAdapter;
>> import com.eg.euler.jsp.JspParser;
>>
>> import com.sun.grizzly.http.embed.GrizzlyWebServer;
>> import com.sun.
>> grizzly.tcp.http11.GrizzlyAdapter;
>> import com.sun.grizzly.tcp.http11.
>> GrizzlyRequest;
>> import com.sun.grizzly.tcp.http11.GrizzlyResponse;
>>
>> import com.sun.grizzly.util.DefaultThreadPool;
>> import com.sun.grizzly.
>> util.buf.ByteChunk;
>>
>> import java.io.*;
>>
>> public class wsTest {
>>
>> public static void main(String args[]) throws Throwable {
>>
>> GrizzlyWebServer gws;
>> DefaultThreadPool.
>> DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT = 1000*60*5;
>>
>> gws = new
>> GrizzlyWebServer(6666,"",false);
>>
>> gws.getSelectorThread().
>> setDisplayConfiguration(true);
>> gws.getSelectorThread().
>> setCompression("on");
>> gws.addGrizzlyAdapter(new myAdapter(),new
>> String[]{"/"});
>> gws.start();
>> }
>>
>> private static class
>> myAdapter extends GrizzlyAdapter {
>> @Override
>> public
>> void service(GrizzlyRequest grizzlyRequest, GrizzlyResponse
>> grizzlyResponse) {
>> try {
>> String bb = "a";
>>
>> for (int i = 0;i<15;i++)
>> bb=bb+bb+"
>> \n";
>> grizzlyResponse.setContentType("text/html");
>>
>> grizzlyResponse.setStatus(500);
>> doWrite
>> (grizzlyResponse,bb,"UTF-8");
>> } catch (Throwable e)
>>
>> {
>>
>> }
>> }
>>
>> private void doWrite
>> (GrizzlyResponse httpResp,String msg,String encode) throws IOException
>>
>> {
>> try
>> {
>> byte b[] = msg.
>> getBytes(encode);
>> ByteChunk chunk = new ByteChunk();
>>
>> int len = b.length;
>> chunk.setBytes(b,0,
>> len);
>> httpResp.setCharacterEncoding(encode);
>>
>> httpResp.setContentLength(len);
>>
>> httpResp.getResponse().doWrite(chunk);
>> }
>> catch
>> (Throwable e)
>> {
>> e.printStackTrace();
>>
>> }
>> }
>> }
>> }
>>
>>
>>
>> Presentaci un amico! Invita i tuoi amici a scoprire i servizi Tiscali: per ogni amico che attiverà un servizio Tiscali, potrai avere 30 euro di sconto e lo stesso sconto di 30 euro verrà poi offerto al tuo amico.
>>
>> Scopri come! http://abbonati.tiscali.it/presentaci_un_amico/?WT.mc_id=01fw
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>