GNOME Bugzilla – Bug 791400
Hang when opening Epiphany project
Last modified: 2017-12-09 06:35:03 UTC
Today I started seeing a hang when opening my Epiphany project in Builder nightly. Here's a representative backtrace taken during the hang. DzlRecursiveFileMonitor seems to be creating a new GLocalFileMonitor for every directory in WebKit. Note that WebKit is part of the runtime, and is not even built as part of the Epiphany project, so at first I was not sure why this is happening. Then I remembered that I had tried bundling WebKit by adding it to the flatpak-builder manifest a few days ago. I had already changed my mind about that and gotten rid of it, but all the WebKit files were still there. So I deleted my .flatpak-builder subdirectory, which took a *long* time, and when that was done, the hangs disappeared and I was able to use Builder again.
Hrmm, we should *not* be diving into directories that are ignored and creating file monitors there. (We have an explicit force-ignore on .flatpak-builder).
Aha! So in libdazzle, to avoid calling the ignored files check in a thread we do the tree scan in a thread. Then on the main thread, we do the ignored dir check. The .flatpak-builder directory is ignored, but then all the subdirs do not match. If we sort the directories up front, then we should be able to simply skip-ahead when X+1..Z are descendants of X.
Created attachment 365285 [details] [review] file-monitor: improve ignored directory checks If we take the cost of having O(h) directory FDs open (where `h' is the height of the directory path from the root), then we can reduce the number of ignored directory checks we must make. We only need to walk past all the files with the ignored directory as a path prefix.
Fixed in libdazzle. Attachment 365285 [details] pushed as 063fe8f - file-monitor: improve ignored directory checks