unity-applications-daemon adds inotify watches on non-existent paths every 4 seconds

Bug #934177 reported by Colin Ian King
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
The Ubuntu Power Consumption Project
New
Undecided
Unassigned

Bug Description

I've notices that unity-applications-daemon wakes up periodically every ~4 seconds and attempts to add inotify_add_watches to paths that don't exist:

poll([{fd=3, events=POLLIN}, {fd=21, events=POLLIN}, {fd=22, events=POLLIN}], 3, 3996) = 0 (Timeout)
read(3, 0x7fff0cdef780, 16) = -1 EAGAIN (Resource temporarily unavailable)
inotify_add_watch(22, "/usr/local/share/applications", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 ENOENT (No such file or directory)
inotify_add_watch(22, "/usr/share/ubuntu-2d/applications", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 ENOENT (No such file or directory)
inotify_add_watch(22, "/home/king/.config/menus/unity-lens-applications-merged", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 ENOENT (No such file or directory)
inotify_add_watch(22, "/etc/xdg/xdg-ubuntu-2d/menus/unity-lens-applications-merged", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 ENOENT (No such file or directory)
inotify_add_watch(22, "/etc/xdg/menus/unity-lens-applications-merged", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 ENOENT (No such file or directory)
inotify_add_watch(22, "/etc/xdg/xdg-ubuntu-2d/menus", IN_MODIFY|IN_ATTRIB|IN_CLOSE_WRITE|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR) = -1 ENOENT (No such file or directory)

I'm guessing the logic is that these paths may suddenly appear and get populated, hence the periodical poll to add these inotify watches. However, if we don't expect these paths to appear then the polling is a little bit overzealous.

If we do expect these paths to appear during the lifetime of the daemon then perhaps we should be adding inotify watches on the parts of the paths that do exist and then observing new directories being created and add the inotify watch events on these newly created paths only once they are created.

As it is, this is adding slightly to the overall system wakeups, so it is marginal, however, it could be improved to reduce the wakeups with a little more thought.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.