serious WatchService bug on Linux when registration requests and events arriving are very close together

Lari Hotari Lari at Hotari.net
Mon Dec 21 12:31:51 UTC 2015


There is a serious bug in the Linux implementation of WatchService.

I found this blog article explaining the problem:
"Beware: java.nio.file.WatchService is subtly broken on Linux"
http://blog.omega-prime.co.uk/?p=161

This problem occurs when registering watches while simultaneously receiving
events. The blog article author explains the bug in LinuxWatchService and
how inotify event data gets corrupted in a certain situation. Quoting the
blog post: "If data happens to be available both via the pipe and via
inotify, then the read from the pipe will corrupt the first few bytes of
the inotify event stream!"

someone has also created this Hackernews discussion:
https://news.ycombinator.com/item?id=10692247

The blog article author has reported the issue to Oracle about 3 months ago
with code to reproduce the issue:
"I reported this to Oracle about 3 months ago (ref JI-9024492) but haven't
heard anything since 2015-09-29, when they contacted me asking for some
code to reproduce the issue (which I gave to them on the same day). :-/"

What is the OpenJDK bug id for this issue (JI-9024492)? I'd like to know
what the status of the fix for this issue is.

-Lari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20151221/8395a99e/attachment-0001.html>


More information about the nio-dev mailing list