tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Preißer <>
Subject RE: AJP-APR failures on Tomcat 7.0.16 with ISAPI Redirector 1.2.32
Date Tue, 23 Aug 2011 20:02:33 GMT
> -----Original Message-----
> From: Christopher Schultz []
> Sent: Tuesday, July 26, 2011 6:15 PM
> To: Tomcat Users List
> Subject: Re: AJP-APR failures on Tomcat 7.0.16 with ISAPI Redirector
> 1.2.32
> Konstantin,
> Such a class would definitely be useful to post on the Wiki.

Hi Christopher,

Some days ago I made an entry in the Tomcat Wiki with such a OutputStream decorator class:

I see that you changed the flush() method in the decorator class to pass flush() calls to
the underlying stream as long as the stream is set to be "active".

The reason that I didn't make this call-through was because it seems that flush() is the only
method called by the ImageIO (when the Image Writer is garbage collected), and by preventing
any pass-through of flush(), no errors can occur.

When flush() of the decorator class passes its call to the original stream as long as it's
active, there may be a race condition between the request processing thread of the Servlet
and the GC thread which collects the Image Writer, which possibly (but highly unlikely) could
cause a flush() call (from GC thread) on the already closed stream, even if the "isActive"
flag is volatile (please correct me if I'm wrong - I'm not a expert in how GC is working).

Also, it seems that ImageIO is calling flush() a few times while writing an image, and I wanted
to avoid the unnecessary flush() calls. ;-)


Konstantin Preißer 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message