JDK-8055421 : (fs) bad error handling in java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7u67
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2014-08-19
  • Updated: 2016-06-13
  • Resolved: 2014-08-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 JDK 9
7u80Fixed 8u40Fixed 9 b29Fixed
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
Invoking sun.nio.fs.UnixDirectoryStream.closeImpl in certain situation yields "java.io.IOException: Unknown error 18446744073709551615".

This stems from the error in native function Java_sun_nio_fs_UnixNativeDispatcher_closedir:
RESTARTABLE(closedir(dirp), err);
if (errno == -1) {
  throwUnixException(env, errno);
}
should be rewritten as
RESTARTABLE(closedir(dirp), err);
if (err == -1) {
  throwUnixException(env, errno);
}
with err instead of errno.



REPRODUCIBILITY :
This bug can be reproduced always.


Comments
There is clearly a bug here but it would be useful to know if there are real cases where this native method is called with errno set. The restart or closedir also needs to be examined as normally it is not safe to restart close or closedir.
24-08-2014