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 190462 - Native FS notifications not working for files not in source roots of open projects
Summary: Native FS notifications not working for files not in source roots of open pro...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 7.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: REGRESSION
: 191133 191211 191348 191843 (view as bug list)
Depends on: 197964
Blocks: 26230 187163 196914
  Show dependency tree
 
Reported: 2010-09-20 14:32 UTC by Jesse Glick
Modified: 2011-04-21 19:32 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2010-09-20 14:32:42 UTC
Ubuntu w/ all updates, JDK 6u21, 44dca4908ecb, fs.inotify.max_user_watches=99999 in /etc/sysctl.conf, fresh user dir. Start IDE, switch to Favorites tab, expand ~/Desktop (normally empty). Start GNOME Terminal, cd Desktop, touch hello. Nothing appears in the IDE, even after returning focus to it. Source > Scan for external changes does work. No apparent warnings in IDE log nor in /var/log/messages. The same test works fine with Nautilus, so native file notifications are indeed working on my system generally.
Comment 1 Petr Nejedly 2010-09-20 17:49:15 UTC
Well, the infrastructure is only bound to the folders covered by the addRecursiveListener (based on Yarda's advice).
I have expected that it would have the same coverage as the original refresh-after-window-activated, but it seems it behaves differently.

The notifications, for sure, work for source folders of opened projects (and java infrastructure does pick them up and update its metadata). Thus lowering to P2.

I generally agree that it should work for any folder hierarchy (and any editor opened) in the IDE.
Comment 2 Jaroslav Tulach 2010-09-21 22:06:44 UTC
For Windows this shall be easy to fix. Get a notifications about a file being changed, look if there is FileObject for it in memory. If so, call refresh. If not  look if there is a parent. If yes, do refresh.

However for other systems (that don't listen on all filesystem changes) we need a way to add/remove native listeners as soon as FileObjects are created/garbage collected. That will need some special API between masterfs and the watchers.
Comment 3 Jesse Glick 2010-10-07 19:44:10 UTC
Applies also to FileBuiltQuery. For example, edit a class in a GUI app, then Run. Switch back to the IDE - still displayed as out of date, until you close the app so the process finishes and an old-style refresh is triggered. Before native listeners were introduced, the out-of-date badge would disappear from the editor soon after switching back to the IDE.
Comment 4 Jesse Glick 2010-10-07 19:45:22 UTC
Adjusting summary to emphasize that this applies also to files inside projects but not in the source roots, e.g. target/classes.
Comment 5 Petr Nejedly 2010-10-19 12:39:33 UTC
*** Bug 191133 has been marked as a duplicate of this bug. ***
Comment 6 Petr Nejedly 2010-10-26 10:55:40 UTC
*** Bug 191348 has been marked as a duplicate of this bug. ***
Comment 7 Petr Nejedly 2010-11-11 15:44:06 UTC
*** Bug 191843 has been marked as a duplicate of this bug. ***
Comment 8 Michel Graciano 2010-11-11 16:10:47 UTC
*** Bug 191843 has been marked as a duplicate of this bug. ***
Comment 9 Jaroslav Tulach 2010-11-24 20:14:40 UTC
*** Bug 191211 has been marked as a duplicate of this bug. ***
Comment 10 Jaroslav Tulach 2010-11-26 13:44:18 UTC
Disgustingly pragmatic solution: core- main#a4a49524a55f
Comment 11 Quality Engineering 2010-11-27 06:26:05 UTC
Integrated into 'main-golden', will be available in build *201011270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a4a49524a55f
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #190462: Keeping the automatic fs refresh when focus gained on, just skipping all files that are under control of recursive listeners (e.g. the majority)
Comment 12 Michel Graciano 2010-11-29 11:59:02 UTC
Looks fine to me. v. Build 101129-e5fa9d201a2b
Comment 13 Jaroslav Tulach 2010-11-29 16:40:51 UTC
Good, marking verified then.
Comment 14 Jesse Glick 2010-12-01 21:05:03 UTC
This fix is not very satisfactory. It reintroduces the dreaded "scanning for external changes" process, even when we _have_ the ability to use native listeners. Would much prefer that the native listeners be used whenever code asks to listen to changes on a disk file or folder.
Comment 15 Jaroslav Tulach 2010-12-02 06:19:00 UTC
Overall we have improved the system over the state in 6.9. It works and is more efficient.
Comment 16 Jesse Glick 2010-12-02 17:22:48 UTC
Agreed that the state is preferable to that in 6.9, but I would not consider us to have "implemented native file notifications" when they are implemented for only a subset of the files the IDE is listening to!
Comment 17 Vladimir Voskresensky 2010-12-02 18:40:20 UTC
can someone clarify what is needed to be done on client side to be native-listened?

because by default c++ project source roots are not listened as well.
They are listened only if register them in indexing api
Comment 18 Jaroslav Tulach 2010-12-03 15:41:55 UTC
(In reply to comment #17)
> can someone clarify what is needed to be done on client side to be
> native-listened?


Native listening is enabled for all subtrees under FileObject which's addRecursiveListener method is called.
Comment 19 Vladimir Voskresensky 2010-12-03 17:46:09 UTC
great, thanks!(In reply to comment #18)
> (In reply to comment #17)
> > can someone clarify what is needed to be done on client side to be
> > native-listened?
> 
> 
> Native listening is enabled for all subtrees under FileObject which's
> addRecursiveListener method is called.

Great! Thanks