[PATCH] JDK-8054565: FilterOutputStream.close may throw IOException if called twice and underlying flush or close fails

Nathan Clement nathan.a.clement at hotmail.com
Fri Dec 5 02:55:41 UTC 2014


Hi Bernd,

> > My problem is definitely not related to multi-threaded use.  The test
> > shows basically the same code that we have in production that
> > experienced the problem.
> 
> Of course it can be triggered single threaded. But this does not mean
> you should not fix it for concurrent use as well (for the reasons
> mentioned).

I agree with the other commenters that since FilterOutputStream is not thread safe, there isn't any need to fix the bug for multi-threaded use.

> > I don't see that this change is any more risky than the change that
> > introduced this bug.  I'm more than happy to have the bug fixed in a
> > different way - this is just the first solution that occurred to me.
> 
> Well, the change which introduced the bug (and others in this area) are
> risky and did break things. I just want to make sure you are aware of
> it. I feel that its not worth fixing, but its not my call.
> 
> However your problem is easily solved in an overwritten close() method.
> I bet you will not wait for this to hit a production ready Java, anyway.

I think that this bug definitely does need to be fixed in the JDK since that's where it was introduced.  We experience the bug when using the BufferedOutputStream, which extends FilterOutputStream.  It is impractical for us to use an overridden close() method as this would involve changing all our code to use this new class rather than BufferedOutputStream.

The fix we have implemented in production is to build a small jar containing only the fixed FilterOutputStream and include this in the bootclasspath: "-Xbootclasspath/p:%APP_HOME%\lib\jdkfix.jar".  I will remove that temporary fix once the bug is fixed in the JDK.

Regards,

Nathan

> Date: Fri, 5 Dec 2014 02:02:45 +0100
> From: ecki at zusammenkunft.net
> To: core-libs-dev at openjdk.java.net
> Subject: Re: [PATCH] JDK-8054565: FilterOutputStream.close may throw	IOException if called twice and underlying flush or close fails
> 
> Am Fri, 5 Dec 2014 11:49:26 +1100
> schrieb Nathan Clement <nathan.a.clement at hotmail.com>:
> 
> > Hi,
> > 
> > My problem is definitely not related to multi-threaded use.  The test
> > shows basically the same code that we have in production that
> > experienced the problem.
> 
> Of course it can be triggered single threaded. But this does not mean
> you should not fix it for concurrent use as well (for the reasons
> mentioned).
> 
> > I don't see that this change is any more risky than the change that
> > introduced this bug.  I'm more than happy to have the bug fixed in a
> > different way - this is just the first solution that occurred to me.
> 
> Well, the change which introduced the bug (and others in this area) are
> risky and did break things. I just want to make sure you are aware of
> it. I feel that its not worth fixing, but its not my call.
> 
> However your problem is easily solved in an overwritten close() method.
> I bet you will not wait for this to hit a production ready Java, anyway.
> 
> Gruss
> Bernd
 		 	   		  


More information about the core-libs-dev mailing list