RFR [8055421]: (fs) bad error handling in java.base/unix/native/libnio/fs/UnixNativeDispatcher.c

Alan Bateman Alan.Bateman at oracle.com
Mon Aug 25 11:25:27 UTC 2014

On 24/08/2014 21:54, Ivan Gerasimov wrote:
> Thank you Alan for the input!
> I've updated the webrev as you suggested:
> http://cr.openjdk.java.net/~igerasim/8055421/2/webrev/
> With the wrapper for close we currently ignore any error that might 
> have happened.
> Don't we want to revise it with this change?
> For example, note the caution on the Linux man page:
> Not  checking  the  return  value of close() is a common but 
> nevertheless serious programming error.  It is quite possible that 
> errors on a previous write(2) operation are first reported at the 
> final close().  Not checking the return value when closing the file 
> may lead to silent loss of data.
The webrev looks good and I agree that we should deal with close 
separately (as that will necessitate touching a number of areas). 
Martin's suggestion to put add a comment to UnixNativeDispatcher.fclose 
that it ignores EINTR and doesn't fflush would be useful.

I found this article useful and the issue of close vs. EINTR discussion 
has been going for years:


More information about the nio-dev mailing list