From kde-core-devel Tue Jan 18 14:05:46 2005 From: Waldo Bastian Date: Tue, 18 Jan 2005 14:05:46 +0000 To: kde-core-devel Subject: Re: serious kfind and famd problems, help needed Message-Id: <200501181505.46958.bastian () suse ! com> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=110605715100583 On Monday 17 January 2005 19:33, Josef Weidendorfer wrote: > On Sunday 09 January 2005 14:34, Alexander Neundorf wrote: > > Hi, > > > > famd seems to cause serious problems with kfind: > > http://bugs.kde.org/show_bug.cgi?id=68220 > > http://bugs.kde.org/show_bug.cgi?id=77846 > > http://bugs.kde.org/show_bug.cgi?id=77854 > > http://bugs.kde.org/show_bug.cgi?id=79512 > > http://bugs.kde.org/show_bug.cgi?id=85802 > > > > I don't have fam installed so I can't reproduce and fix it. > > Could somebody who has fam installed please have a look ? > > > > Thanks > > Alex > > Hi, > > the following code in kfinddlg.cpp looks quite suspicious: > ============================= > ... > //Getting a list of all subdirs > if(tabWidget->isSearchRecursive() && (dirwatch->internalMethod() == > KDirWatch::FAM)) > { > QStringList subdirs=getAllSubdirs(query->url().path()); > for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); > ++it) dirwatch->addDir(*it,true); > } > ... > ================================ > Why does anybody want to add dirWatches for *all* directories searched? > Even more strange: Why is this only enabled when FAM is used? > > But if you look at the code of getAllSubdirs(), you partly will kow why > this can lock up: > =================================== > ... > for(QStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it) > { > if((*it==".")||(*it=="..")) > continue; > subdirs.append(d.path()+"/"+*it); > subdirs+=getAllSubdirs(d.path()+"/"+*it); > } > ... > ===================================== > If the start dir is "/", this will freeze kfind GUI while scanning your > whole harddisk. Such potentially long lasting code parts should be done in > chunks, triggered by timer events from the main loop (or in another > thread). > > But it gets better: Doing a strace on kfind, I get > ... > lstat64 > ("/home/weidendo/DRI/drm/linux/linux/linux/linux/linux/linux/linux/linux/li >nux/linux/mach64.mod.c", {st_mode=S_IFREG|0644, st_size=559, ...}) = 0 > ..... > > Why is linux appearing 10x in this path ??!? > Looking into DRI/drm, I see that linux is a symlink to ".". So obviously > getAllSubdirs() deadlocks with recursive symlinks. > > And this really has *nothing* to do with fam at all, but unfortunately for > fam, this buggy getAllSubdirs() is only called when fam is used, triggering > this deadlock. > > I can understand that fam looks strange to some people, but this almost > looks like somebody wanting to kill good old fam's fame by introducing bugs > which look like fam being the culprit. Sorry, couldn't resist ;-) > > Good luck fixing this, > Josef > > PS: I simply would remove the above cited if-body. Yes, those are good points and that would probably help a lot. I'm not sure that it explains http://bugs.kde.org/show_bug.cgi?id=77854 though, that very much suggests a FAM deadlock. (Disabling the above if-body would get rid of that as well of course) Cheers, Waldo -- bastian@kde.org | Free Novell Linux Desktop 9 Evaluation Download bastian@suse.com | http://www.novell.com/products/desktop/eval.html