Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 125970 - Gamin uses lots of CPU
Summary: Gamin uses lots of CPU
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Daniel Drake (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-12 12:28 UTC by takken
Modified: 2008-02-21 21:48 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description takken 2006-03-12 12:28:59 UTC
Gamin is often consuming ~40% CPU when using applications that watch files. FAM could go nuts when lots of files were changed very quickly, but Gamin can even start to misbehave when nothing is happening to the files that are being watched. For instance, even a Konqueror window that displays a static set of files can trigger nuttyness in Gamin. I draw this conclusion from the fact that the madness stops when I close a konqueror window with static files in it, and the fact that I configured Konqueror to use one
independent process for every window.

Other applications that watch files trigger the problem as well. When I start KWrite, everything is fine. But as soon as I open a file, Gamin goes nuts. Killing Gamin does not help. A new Gamin process is started,
which happily continues wasting CPU. 

I also found that when Gamin goes nuts, ~/.xsession-errors contains lots and lots of these messages:

end from FAM server connection
invalid length 24902
invalid length 24902
invalid length 24902
invalid length 24902
end from FAM server connection
invalid length 24902
invalid length 24902
invalid length 24902
invalid length 24902

using kernel 2.6.14-gentoo-r5, gamin-0.1.7.

emerge info:

Portage 2.0.54 (default-linux/x86/2005.0, gcc-3.3.4, glibc-2.3.5-r2, 2.6.14-gentoo-r5 i686)
=================================================================
System uname: 2.6.14-gentoo-r5 i686 AMD Athlon(tm) Processor
Gentoo Base System version 1.6.14
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
dev-lang/python:     2.3.3-r1
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -g3 -march=athlon -pipe -mmmx -m3dnow -ffast-math"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -g3 -march=athlon -pipe -mmmx -m3dnow -ffast-math"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distcc distlocks nostrip sandbox sfperms strict"
GENTOO_MIRRORS="ftp://ftp.easynet.nl/mirror/gentoo/ ftp://mirror.nutsmaas.nl/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
LC_ALL="nl_NL@euro"
LINGUAS="nl"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex X a52 aac aalib alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 cdparanoia cdr crypt cups curl debug dri dts dv dvd eds emboss encode exif expat fam ffmpeg flac fluidsynth foomaticdb fortran gdbm gif gimpprint glut gnome gphoto2 gpm gstreamer gtk gtk2 hal idn imagemagick imlib jack jpeg kde kdeenablefinal ladcca lcms libg++ libwww lirc mad ming mmx mmx2 mmxext mng motif mp3 mpeg ncurses no_wxgtk1 nodrm ogg oggvorbis openal opengl pam pcre pdflib perl png python qt quicktime readline rtc ruby sdl slang sox spell sqlite ssl svg tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts udev usb vorbis win32codecs xine xml xml2 xmms xscreensaver xv xvid xvmc zlib linguas_nl userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LDFLAGS, PORTDIR_OVERLAY
Comment 1 Mike McQuaid 2006-03-20 17:42:27 UTC
I'm seeing the same bug
Comment 2 takken 2006-03-23 14:17:04 UTC
I replaced Gamin with good old FAM again and decided *not* to start the FAM daemon anymore. I only keep it for now so I don't need to re-compile stuff. Now KDE has switched to its own polling mechanism and it feels *fast*. Problem solved. Who said polling is inefficient? :)


In the mean time, I read that Gamin will be enabled by default for Gentoo:

http://www.gentoo.org/news/en/gwn/20060320-newsletter.xml

Hmmm...
Comment 3 David Grant 2006-04-15 12:27:52 UTC
I'm seeing this with the latest k3b, 0.12.15. I don't remember seeing it before in k3b, but maybe I didn't notice it. I only upgraded to gamin from fam a while ago. I'm thinking of removing gamin and installing fam again.
Comment 4 Mike McQuaid 2006-04-27 18:47:41 UTC
No updates/ideas on this?
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2006-05-05 16:04:00 UTC
gamin is using lots of CPU, since we don't enable inotify by default.

http://www.gnome.org/~veillard/gamin/config.html

Moreover, we don't install any sample config file either. And instead of the useful docs only useless stuff gets installed unless USE=doc is enabled. The omitted docs include stuff like config.html, among others. :(

Please, remove the USE=doc flag, there's no reason to use it for installing a bunch of HTML files. Also, some sample config would be *really* useful. TIA.

Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-05 16:19:37 UTC
Err just to let you know, if fam is not present, kdelibs drops back to inotify, and then to dnotify, if present, and only if those aren't available it falls back to polling.

As gamin is polling by default, of course *notify is faster than it.
Comment 7 takken 2006-05-06 02:47:10 UTC
One mechanism being slower than another is one thing, but when Gamin continuously eats 40% CPU when nothing else is running on the computer, things are not just going slow but things are going plain wrong.

Are you *sure* KDE supports inotify/dnotify?
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-05-06 04:39:11 UTC
KDE 3.4 supports dnotify, KDE 3.5 supports both inotify and dnotify. And of that I'm completely sure as I'm the one who enabled them in the kdelibs ebuild.
Comment 9 Marcus 2006-05-15 17:36:42 UTC
I am having the problem, too, on my new amd4600+ box. It makes about 8% load without any configuration. then I tried to lower the load by creating a configuration file /etc/gamin/gaminrc , but that increased the load to about 21%. 

That is way too much. Also, I am not really satisfied with logging or just seeing what gamin does and why it uses so much load.

the use flag + - 'fam' does not affect any of my packages, not even kdelibs.
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2006-05-29 14:46:35 UTC
I think someone either jumped the gun on this, or I just misunderstood this bug when I read it first.

I got the jist from this bug that gamin doesn't use inotify by default, unless it is explicitly asked to in the config file. I checked the source and that is not the case. I also looked at the configuration documentation and don't see where it says that.

I also checked my local system: I have no gaminrc anywhere, and it uses inotify just fine.

So, the problem isn't quite as obvious. Who here can still reproduce this easily? We need to get onto debugging it.
Comment 11 Bryan Jacobs 2006-05-31 18:51:28 UTC
(In reply to comment #10)
> I think someone either jumped the gun on this, or I just misunderstood this bug
> when I read it first.
> 
> I got the jist from this bug that gamin doesn't use inotify by default, unless
> it is explicitly asked to in the config file. I checked the source and that is
> not the case. I also looked at the configuration documentation and don't see
> where it says that.
> 
> I also checked my local system: I have no gaminrc anywhere, and it uses inotify
> just fine.
> 
> So, the problem isn't quite as obvious. Who here can still reproduce this
> easily? We need to get onto debugging it.
> 

It is possible that this bug actually comes from a different source.

I enabled inotify (using 'notify /*' in my gaminrc), and still noticed ~30-40% of my CPU being consumed by gam_server.  I have my home directory on AFS - I think the issue stems from its descending into one of my dozen or so network filesystems and choking.
Comment 12 Andy 2006-06-08 09:06:23 UTC
I have the same problem and observe that gam_server 0.1.7 (after moving a large amount of files from one directory to another) although uses about 42.5% CPU on average, actually jumps between about 2% and 82-98% every 0.5 seconds (this can be observed in KDE System Monitor Applet on the panel).
Comment 13 MT 2006-07-30 10:45:27 UTC
try to put into ~/.gaminrc the line below:

notify /*
Comment 14 James Johnson 2006-09-08 07:02:02 UTC
This fixed my issue with gam_server and .xsession-errors:

#cat /etc/gamin/gamin
rcnotify /*
fsset ext3 notify
fsset ext2 notify
fsset xfs notify
Comment 15 crusaderky 2006-11-13 06:45:59 UTC
(In reply to comment #14)
> This fixed my issue with gam_server and .xsession-errors:
> 
> #cat /etc/gamin/gamin
> rcnotify /*
> fsset ext3 notify
> fsset ext2 notify
> fsset xfs notify
> 
according to http://www.gnome.org/~veillard/gamin/config.html the command "rcnotify" does not exist, nor does /etc/gamin/gamin...

identical problem here.
Comment 16 crusaderky 2006-11-13 06:49:24 UTC
P.S. nor does fsset <filesystem> notify.

A correct config file would be:

notify /*
fsset ext2 kernel
fsset ext3 kernel
fsset reisefs kernel

I just added the "fsset" lines. I'll report back if the problem still happens.
Comment 17 crusaderky 2006-11-27 17:18:44 UTC
(In reply to comment #16)
> I just added the "fsset" lines. I'll report back if the problem still happens.
> 
Problem still happens. >_>
I'm using gamin with thunar-0.5.0_rc2.
Comment 18 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-12-05 11:52:23 UTC
I've also noticed this problem recently (about 30% usage, may be related to switch to 2.6.19 kernel but not sure). Tried gamin-0.1.8 (bug 157043, just renamed old ebuild) and problem is gone.
Comment 19 Raymond Lewis Rebbeck 2006-12-05 22:03:41 UTC
I've also been running gamin-0.1.8 for the last couple of days and I'm yet to see any high cpu usage or gamin filling up ~/.xsession-errors with many MBs of error messages constantly. Both of which I saw frequently with earlier versions.
Comment 20 Daniel Drake (RETIRED) gentoo-dev 2006-12-06 16:34:52 UTC
Added 0.1.8 to portage, reopen if the bug still exists there