7191467: (fs) WatchService periodically fails to queue ENTRY_DELETE event for short lived file [sol11]

Alan Bateman Alan.Bateman at oracle.com
Wed Aug 15 04:20:14 PDT 2012


MayFlies is one of the tests for the WatchService, it's a stress test 
that ensures that there are corresponding ENTRY_DELETE events for each 
ENTRY_CREATE event when the files are very short lived. This test fails 
periodically on Solaris 11 where it appears that FILE_REMOVE events 
aren't being queued by the kernel. There are a couple of workarounds in 
this code to deal with a kernel issues in this area and I've decided it 
to be best to just remove these and change the implementation so that it 
detects file deletions when scanning the directory (which it has to do 
anyway when the directory changes).

The webrev with the changes is here:

http://cr.openjdk.java.net/~alanb/7191467/webrev/

The main change is that entries in directories are only registered with 
the kernel when the directory is registered for ENTRY_MODIFY events. 
ENTRY_CREATE and ENTRY_DELETE events are now completely triggered on 
changes to the directory.

One other change in here, and it stemmed from a discussion on this mail 
a few months ago, is that if there is an error encountered when 
iterating over the directory then an OVERFLOW event is queued. That is 
the trigger to the user application to re-scan the directory to update 
its view of the directory.

-Alan


More information about the nio-dev mailing list