This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197966

Summary: LinuxNotifier could watch many more dirs using extra file handles
Product: platform Reporter: Jesse Glick <jglick>
Component: FilesystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED WONTFIX    
Severity: normal Keywords: PERFORMANCE
Priority: P3    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 185135    
Bug Blocks: 190675, 26230    
Attachments: Multiple PollFd instances

Description Jesse Glick 2011-04-21 19:49:44 UTC
See bug #190675 comment #7. A major limitation of the Linux FS notifier using inotify is that Linux distributions typically set the fs.inotify.max_user_watches to 8192 by default, too small for watching a big tree. You can increase your limit manually but most people will not have done so.

One possible way around this limitation might be to cheat a little and open additional file handles when you run out of watches on the first handle. Would make the implementation more complex, but could greatly expand the limit.

Marking as a DEFECT since the current implementation does not even check the return value of inotify_add_watch - so if you run out of watches, the IDE will just silently not listen for additional changes, until some recursive listeners are removed.
Comment 1 Jaroslav Tulach 2011-04-25 11:57:01 UTC
Reporting errors during add_watch: ergonomics#74b0a4008588, making enhancement.
Comment 2 Jaroslav Tulach 2011-04-25 15:30:51 UTC
Calling select via JNA seems impossible (one cannot call FD_XXX macros). Using poll looks much easier.
Comment 3 Jaroslav Tulach 2011-04-25 16:13:44 UTC
Created attachment 107930 [details]
Multiple PollFd instances
Comment 4 Jaroslav Tulach 2011-04-25 16:16:25 UTC
Here is a patch that allocates new instances of inotify, but as soon as first one hits a limit, all of the new ones return -1/28 error too. Looks like the inotify limit is per user/process in spite what documentation says!?

If you can find out why the patch does not work for me, that would be great.
Comment 5 Jaroslav Tulach 2011-05-09 10:55:51 UTC
Looks like Jesse's suggestion does not work.