Bug 248054 - wasteful calls to inotify_add_watch
wasteful calls to inotify_add_watch
Status: CLOSED DUPLICATE of bug 240385
Product: Fedora
Classification: Fedora
Component: gnome-menus (Show other bugs)
7
All Linux
low Severity low
: ---
: ---
Assigned To: Ray Strode [halfline]
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-12 16:19 EDT by Dave Jones
Modified: 2015-01-04 17:29 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-24 22:46:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dave Jones 2007-07-12 16:19:22 EDT
Something (I'm assuming gnome menus has something to do with this based upon the
filenames) is trying to continuously add inotify watches on files that don't
exist.   strace -p `pidof gam_server` shows this ..

inotify_add_watch(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|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=4, events=0}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8,
events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=4,
events=POLLIN}, {fd=3, events=POLLIN}], 8, 3999) = 0
poll([{fd=4, events=0}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8,
events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=4,
events=POLLIN}, {fd=3, events=POLLIN}], 8, 0) = 0
inotify_add_watch(3, "/home/davej/.config/menus/gnome-screensavers-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/etc/xdg/menus/gnome-screensavers-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus/server-settings-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/etc/xdg/menus/server-settings-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus/system-settings-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/etc/xdg/menus/system-settings-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus/preferences-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus/settings-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/etc/xdg/menus/settings-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus/applications-merged",
IN_MODIFY|IN_ATTRIB|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(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|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)


This could be a lot less work if it just checked for ~/.config first and not
bothering with all the subsequent calls.

Better yet would be for this to be a single inotify watch on $HOME to watch for
the creation of a .config, and only then start doing this polling.
Comment 1 Ray Strode [halfline] 2007-07-12 16:36:20 EDT
I think this is a duplicate of an existing open bug report (Peter filed it I
think?).

Anyway, yea we should definitely watch .config and only add the watches when the
directories are around.

I don't think watching $HOME would be good.  it gets so much activity there
would be a lot of spurious wakeups, no?
Comment 2 Dave Jones 2007-07-15 17:37:27 EDT
If you're only watching for IN_CREATE activity, there'll not be /that/ much
activity. Sure most of it will be unrelated to what we're watching for, but it's
still going to be a lot lower overhead than what we're doing now, by changing
from a constant "did something happen?" loop to a "something happened, did we
care?" event model.
Comment 3 Ray Strode [halfline] 2007-07-18 10:31:10 EDT
Right, I'm just saying we should watch in ~/.config (which should always be
around, and hardly ever changes) instead of watching ~ which changes all the time.

(I think that's what you suggested in the second to last paragraph?)

Retitling for now, I may mark this as a duplicate if I can find the other report.
Comment 4 Matthias Clasen 2007-07-24 22:46:35 EDT

*** This bug has been marked as a duplicate of 240385 ***

Note You need to log in before you can comment on or make changes to this bug.