Hi Thorsten, since you have problems filing bugs on JBS, I filed the
following bug on your behalf.
https://bugs.openjdk.java.net/browse/JDK-8234363
I have not investigated the issue in detail yet. How often do you see
ERROR_NO_MORE_FILES happening? Have you checked if your process
(apache?) has too many open files such that FindFirstFileW is not able
to open the directory to get a file listing?
If that is indeed the case, I am not sure what's the best way of
handling it. If resource (file descriptors) are running out, perhaps the
current behavior of throwing an exception in
WinNTFileSystem.canonicalize0() would be better than just ignoring it
and return an incorrect result. But I'll defer to the folks on the
core-libs team.
Thanks
- Ioi
On 11/14/19 11:46 AM, Thorsten Schöning wrote:
Hi all,
while the details can be read on SO[1][2], the bottom line is that I
have a setup in which Windows sets the error code ERROR_NO_MORE_FILES
during calls to FindFirstFileW sometimes. In theory that shouldn't
happen, but it simply does once in a while and make my Java daemon run
into exceptions, because that error code isn't expected.
The following lists all expected error codes from the function
"lastErrorReportable", which is used during canonicalizing paths:
if ((errval == ERROR_FILE_NOT_FOUND)
|| (errval == ERROR_DIRECTORY)
|| (errval == ERROR_PATH_NOT_FOUND)
|| (errval == ERROR_BAD_NETPATH)
|| (errval == ERROR_BAD_NET_NAME)
|| (errval == ERROR_ACCESS_DENIED)
|| (errval == ERROR_NETWORK_UNREACHABLE)
|| (errval == ERROR_NETWORK_ACCESS_DENIED)) {
return 0;
}
https://github.com/openjdk/jdk/blob/master/src/java.base/windows/native/libjava/canonicalize_md.c#L131
Obviously ERROR_NO_MORE_FILES is missing, but its pretty interesting
as well that Java supports other error codes already. Regarding the
docs, FindFirstFileW should only return ERROR_FILE_NOT_FOUND, but most
likely people ran into other error codes already Windows used in
various circumstances. All of those totally make sense.
So, how about adding ERROR_NO_MORE_FILES there as well?
As can be read in my SO-questions, I didn't recognized any other real
technical problem like permissions issues, timeouts in the network or
stuff. Its only that Windows sometimes decides to use that error code
for some unknown reason. Adding it would only be one line of text and
increase compatibility with setups like mine. I guess problems like
these were the reason to add other error codes in the past as well.
Thanks!
[1]:
https://stackoverflow.com/questions/58825588/does-java-need-to-support-error-no-more-files-when-canonicalizing-paths-on-windo
[2]:
https://stackoverflow.com/questions/58825963/when-does-findfirstfilew-set-last-error-to-be-error-no-more-files-instead-of-err?noredirect=1&lq=1
Mit freundlichen Grüßen,
Thorsten Schöning