tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shanti Suresh <>
Subject Re: Registering Plugins, e.g. javax.imageio...
Date Wed, 11 Sep 2013 19:03:29 GMT
Hi Konstantin, Hi Chris,

On Wed, Sep 11, 2013 at 1:43 PM, Christopher Schultz <> wrote:

> > BTW, beware of known issue, mentioned in the FAQ,
> >
> +1
Could you please explain this bug better?  So from the nice writeup in the
Wiki link above, I understand that the OutputStream object may be
re-assigned by Tomcat to another servlet.  So what does this statement mean:
"Tomcat recycles OutputStream
<>objects to save resources,
so it could be that when flush() is called from
the ImageIO, the particular
OutputStream<>object already
belongs to another Response, which can produce the above
errors, when the Servlet tries to get a Session for example, or can
generally lead to broken responses."

So my understanding of "flush()" is that any remaining bytes are written to
the OutputStream. From :

public void flush()
           throws IOException

"Flushes this output stream and forces any buffered output bytes to be
written out."

But nowhere is it mentioned that "flush()" closes the OutputStream.  So I
am confused how a new Servlet cannot get a session object for a recycled
OutputStream when all that's going on is that the remaining bytes are
written out.  Is the "close()" method the culprit?

I appreciate the explanation.



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message