After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 348974 - Make gamin sleep when nothing changes in the filesystem
Make gamin sleep when nothing changes in the filesystem
Status: RESOLVED WONTFIX
Product: gamin
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gamin Maintainer(s)
Gamin Maintainer(s)
gnome[unmaintained]
Depends on:
Blocks:
 
 
Reported: 2006-07-27 19:08 UTC by Zbigniew Chyla
Modified: 2018-07-01 08:46 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Introduces dynamic handling for events_to_process, missing_list and links_list. (4.56 KB, patch)
2006-07-27 19:10 UTC, Zbigniew Chyla
none Details | Review
Dynamic handling of per-connection GamConnDataPtr->eq queue and detection of idle period. (7.96 KB, patch)
2006-07-27 19:11 UTC, Zbigniew Chyla
none Details | Review
Dynamic handling of lists of resources from gam_poll_generic.c used inside gam_poll_basic.c. (5.96 KB, patch)
2006-07-27 19:12 UTC, Zbigniew Chyla
none Details | Review
Avoid calling time(2) too often (twice per each stat(2) on symlink or missing file). (2.06 KB, patch)
2006-07-27 19:13 UTC, Zbigniew Chyla
none Details | Review

Description Zbigniew Chyla 2006-07-27 19:08:31 UTC
I reported this problem some time ago on gamin-list@gnome.org. Cut&pasting my e-mail here so that it's not forgotten...

I'm using Linux 2.6.15 with inotify support enabled, so I couldn't understand why gam_server sometimes shows on "top" even if the machine is idle and the filesystem doesn't change at all (at least in directories that gamin clients may be interested in).
After running strace I found out that that gam_server wakes up tens times per second (because of calling poll(2) with very short timeouts) when nothing changes in the filesystem!

The attached patches (with included ChangeLog entries) fix this behaviour by switching from static registrations of timeout functions to more dynamic approach (executing timeout function that processes some queue makes sense only if the queue is not empty).
Comment 1 Zbigniew Chyla 2006-07-27 19:10:24 UTC
Created attachment 69754 [details] [review]
Introduces dynamic handling for events_to_process, missing_list and links_list.
Comment 2 Zbigniew Chyla 2006-07-27 19:11:39 UTC
Created attachment 69755 [details] [review]
Dynamic handling of per-connection GamConnDataPtr->eq queue and detection of idle period.

As a side effect this change improves idle detection mechanism. With this patch the server quits if the connections queue is really empty for 30 seconds.
Previously the timeout function was only "sampling" state of the queue so it could miss a client connection shorter than 1 second.
Comment 3 Zbigniew Chyla 2006-07-27 19:12:37 UTC
Created attachment 69757 [details] [review]
Dynamic handling of lists of resources from gam_poll_generic.c used inside gam_poll_basic.c.

Registering gam_poll_basic_scan_callback statically makes no sense because it seems that with inotify this code is not used at all (anyway, the timeout function will be registered dynamically if needed).
Comment 4 Zbigniew Chyla 2006-07-27 19:13:40 UTC
Created attachment 69758 [details] [review]
Avoid calling time(2) too often (twice per each stat(2) on symlink or missing file).
Comment 5 Daniel Veillard 2006-07-27 20:05:41 UTC
Okay, I will look at those patches (bug me if I forgot about them :-),
but to answer the key answer about why gam_server cannot sleep is that
usually there are some programs which set up a FAM watch on a non-existing
resource and the only way to learn about the breation is to wake up 
regulary and check if they have been created.
Also if you make patches make sure they don't introduce regressions in 
'make tests'

  thanks,

Daniel
Comment 6 John McCutchan 2006-09-07 05:12:41 UTC
Daniel, did these patches get committed with the recent work?
Comment 7 Daniel Veillard 2006-09-07 06:45:59 UTC
John, well I'm afraid I lost track, so no, feel free to commit
them , I'm on the road for 10 more days at least !

  thanks

Daniel
Comment 8 André Klapper 2018-07-01 08:46:54 UTC
gamin is not under active development anymore and has not seen code changes for many years.
Its codebase has been archived: https://gitlab.gnome.org/Archive/gamin/commits/master

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the responsibility for active development again.