dev@glassfish.java.net

Re: Servlet writing of response is not terminated when client terminates the request

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 28 May 2008 13:34:47 +0200

Jeanfrancois Arcand wrote:
> Hi Paul,
>
> Paul Sandoz wrote:
>> Hi,
>>
>> A developer (CC'ed) found a problem with Jersey and responses being
>> written even if the client terminates the connection i.e. no exception
>> gets thrown from the OutputStream.write methods.
>>
>> I reproduced it by writing a simple servlet, see here for more details
>> [1]. If i go to the URL:
>>
>> http://localhost:8080/WebApplication13/TimeOutServlet
>>
>> then i quit the browser, the servlet still writes output, if i
>> undeploy it still writes output, i need to restart GF to stop the
>> process.
>
> Yes, since we are buffering the response (to avoid network operations),
> until the buffer get full the writer will not throw any exception. I'm
> not sure this is a bug in Grizzly....I need to look at the spec and see
> if the Servlet spec mandate the write operation to thrown an IOException
> when the client close the connection. I suspect it doesn't require it,
> but let me double check.
>

I am performing a test where i have kept the rogue servlet running and
it has currently written, textually, numbers 1 to 125,000,000 to the
output stream, and is still going strong. How big is that buffer :-)

The memory used by the GF process appears not to be increasing.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109