Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6191254
Votes 0
Synopsis File.exists() returns false if timeout error accessing soft-mounted nfs file
Category java:classes_io
Reported Against
Release Fixed
State 11-Closed, duplicate of 4313887, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 05-NOV-2004
Description
A DESCRIPTION OF THE REQUEST :
This bug is probably related to 5003595, which deals with stale NFS file handles.

In this case, I have a problem where I have an nfs mounted file system mounted with the 'soft' option, which allows for file accesses to abort prematurely with a timeout error.   This is intermittent, depending on the load of the network and the remote server, etc.

In this case, File.exists() returns false, even if the remote file actually exists.  It would be nice if instead File.exists() could throw an IOException.
This would have to be added to the api definition for this funciton.

I have been able to verify this behavior, by correlating occurrences of the
false negative result from File.exists() with timeout errors reported to
the /var/log/messages console log file for the system.



JUSTIFICATION :
  To make the api easier to use.  It is simply intuitive that if the method returns successfully, without an exception, then it does indeed have the correct result.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If for any reason the call encounters an NFS timeout error, it should through an IOException.
ACTUAL -
The method returns false, whenever there is an underlying NFS timeout error.

CUSTOMER SUBMITTED WORKAROUND :
The workaround is to routinely retry all calls of File.exists() multiple times, to make sure that a false result is really false.  This work around only works in cases where the condition is likely to be spurious, and that
a retry is likely therefore to succeed.  This is clearly not a completely
reliable work around.
  xxxxx@xxxxx   2004-11-05 06:15:24 GMT
Work Around
N/A
Evaluation
Most likely the stat(2) used to check the file is failing with a NFS stale handle error. Unfortunately, it is not possible to retrofit the exists method to throw an IOException as suggested. However, as part of a new file system API we can address problems like this by invoking the equivalent method in the new API. In this case changing the code from:
	f.exists() 

	f.toPath().checkAccess();
will throw the expected I/O error.
Posted Date : 2009-02-16 14:38:00.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang