zeitgeist-datahub is calling inotify_add_watch() on .kde RecentDocuments every 4 seconds and failing

Bug #934156 reported by Colin Ian King
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
The Ubuntu Power Consumption Project
New
High
Unassigned
zeitgeist (Ubuntu)
New
High
Unassigned

Bug Description

zeitgeist-datahub is adding inotify_add_watch on /home/$USER/.kde/share/apps/RecentDocuments every ~4 seconds and failing with -ENOENT since it does not exist.

strace shows:

poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 3, 3998) = 0 (Timeout)
read(3, 0x7fffcfb823d0, 16) = -1 EAGAIN (Resource temporarily unavailable)
inotify_add_watch(8, "/home/king/.kde/share/apps/RecentDocuments", 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)
poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 3, 3995) = 0 (Timeout)
read(3, 0x7fffcfb823d0, 16) = -1 EAGAIN (Resource temporarily unavailable)
inotify_add_watch(8, "/home/king/.kde/share/apps/RecentDocuments", 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)

So clearly we have a ~4000 millesecond poll that times out followed by a inotify_add_watch on a directory that does not exist. I don't have any ~/.kde path to add the watch on to. So this seems a little bit wasteful to do this every 4 seconds.

Not sure about this, but the poll times out but we still do a read on fd 3, which is clearly not in a read state because the poll timed out rather than indicating fd 3 is read to read, so perhaps this is a bug.

Anyhow, my points are:

1. Is the ~4000ms poll really required?
2. Is the read on fd 3 required considering we just poll'd on it and it does not indicated it is read to read
3. Why is a watch being added for a path that does not exist every 4 seconds?

Although these wakeups are infrequent, they still contribute to probably unnecessarily keeping the CPU from a deep C state and hence this wastes power.

Revision history for this message
Colin Ian King (colin-king) wrote :

OK, it's got worse in Trusty, now it's polling even more directories that don't exist:

inotify_add_watch(9, "/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(9, "/usr/share/ubuntu/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(9, "/home/king/.kde/share/apps/RecentDocuments", 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)
poll([{fd=10, events=POLLIN}, {fd=9, events=POLLIN}], 2, 3997) = 0 (Timeout)

Why does this have to be every 4 seconds? That's sucking power on an idle system.

Changed in zeitgeist (Ubuntu):
importance: Undecided → High
Changed in ubuntu-power-consumption:
importance: Undecided → High
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.