Hi Konstantin, Hi Chris, On Wed, Sep 11, 2013 at 1:43 PM, Christopher Schultz < ch...@christopherschultz.net> wrote:
> > > BTW, beware of known issue, mentioned in the FAQ, > > http://wiki.apache.org/tomcat/FAQ/KnownIssues#ImageIOIssues > > +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 <http://wiki.apache.org/tomcat/OutputStream>objects to save resources, so it could be that when flush() is called from the ImageIO, the particular OutputStream<http://wiki.apache.org/tomcat/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 http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html : ------ public void flush() throws IOException <http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html> "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. Thanks, -Shanti