Bug 167682

Summary: dirwatch enters potentially endless loop on encountering looped symlink directory structures
Product: [Unmaintained] kio Reporter: Rafał Rzepecki <divided.mind>
Component: generalAssignee: Rafał Rzepecki <divided.mind>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: testcase

Description Rafał Rzepecki 2008-07-29 21:42:58 UTC
Version:           r838844 (using Devel)
Installed from:    Compiled sources
Compiler:          GCC 4.2.3 Gentoo 4.2.3 p1.0
OS:                Linux

When adding a directory containing recursive symlinks with KDirWatch::addDir, telling KDirWatch to watch recursively with WatchSubDirs flag, it ends up recursively watching the same directories (it stops somewhere, but I'm not sure, why).

This might be causing gamin to use 100% CPU, not to mention other resource usage; this also might be (one of) the cause(s) of bug #161380 (I actually discovered it by noticing that strigi had been running for 24 hours and still indexing, while two nepomukservices had been saturating the CPU).

You'll find attached a testcase. I'm working on a fix ATM.

After running the testcase, you should see (assuming you have debug messages turned on) something along the lines of:

bar(8682)/kio (KDirWatch) KDirWatchPrivate::useFAM:  Setup FAM (Req 1) for "/tmp/foo/foo/bar/baz/bar/baz/bar"                                                   
bar(8682)/kio (KDirWatch) KDirWatchPrivate::useFAM:  Setup FAM (Req 2) for "/tmp/foo/foo/bar/baz/bar/foo/bar/baz/bar"                                           
bar(8682)/kio (KDirWatch) KDirWatchPrivate::useFAM:  Setup FAM (Req 3) for "/tmp/foo/foo/bar/baz/bar/foo/bar/foo/bar"                                           
bar(8682)/kio (KDirWatch) KDirWatchPrivate::useFAM:  Setup FAM (Req 4) for "/tmp/foo/foo/bar/baz/bar/foo/bar"                                                   
...
Comment 1 Rafał Rzepecki 2008-07-29 21:44:12 UTC
Created attachment 26485 [details]
testcase
Comment 2 Rafał Rzepecki 2008-07-30 16:12:12 UTC
Fixed in SVN (revision #839644).