RFR : (fs) bad error handling in java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
Alan.Bateman at oracle.com
Mon Aug 25 13:17:49 UTC 2014
On 25/08/2014 14:13, Ivan Gerasimov wrote:
> Here's the comment I've added to UnixNativeDispatcher.fclose:
> /* NOTE: fclose() wrapper is only used with read-only streams.
> * If it ever is used with write streams, it might be better to add
> * RESTARTABLE(fflush(fp)) before closing, to make sure the stream
> * is completely written even if fclose() failed.
This seems okay but I can't tell if you are adding this to the .java or
> One conclusion from this article is that it's not generally safe to
> retry close() upon a failure, as we can accidentally close some other
> file been just opened by another thread. So, shouldn't we at least
> remove RESTARTABLE macro around close(fd)?
I will send you a patch shortly on this as it involves changes in a
number of areas (and the use of fsync). So I think it's okay to ignore
close for now as we will replace it soon.
More information about the nio-dev