dev@glassfish.java.net

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

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 27 May 2008 15:48:19 -0400

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.

Thanks

-- Jeanfrancois



>
> Paul.
>
> [1] https://jersey.dev.java.net/issues/show_bug.cgi?id=71
>