dev@glassfish.java.net

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

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Wed, 28 May 2008 16:49:53 +0200

>
Hi Paul,

it's not Grizzly issue, as Grizzly fairly throws BrokenPipeException,
and seems PrintWriter implementation just eats it.
I've run the similar Servlet, but used response.getOutputStream()
instead of PrintWriter - and it works fine.

Thanks.

WBR,
Alexey.


> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>