GNOME Bugzilla – Bug 782676
Ship with current fontconfig version to avoid fontconfig cache issues
Last modified: 2018-05-25 15:07:57 UTC
Since updating to 2.8.22 It always spends a long time searching for fonts. This is every time Gimp is opened, not just the first couple of times. About 5-10 seconds. then continues to load. Running on Windows 10 latest update as of 5/14/2017, (Creator version)
I can confirm this. I have the same problem with 2.8.22 on Win10 1703 build 15063.296.
5-10 seconds is much shorter than the usual delays seen for this issue - can you use Process Monitor (https://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) to check what, if any, file access is done by the gimp-2.8.exe process during this time? If you want to attach a Process Monitor log, please make sure it is in CSV format.
Created attachment 351959 [details] Gimp startup log (font loading) I just checked and for me it takes roughly 20 seconds each launch. During the launch process gimp is accessing every single font in C:\Windows\Fonts multiple times (ReadFile access, Length is always 512 Bytes with an increasing offset so I guess the file is being read). This looks like the font cache is really being rebuilt with every start of the software. The attached log file includes the first few fonts that are being loaded.
I don't see anything like this on Windows 7. But if this does indeed create the font cache, then fontconfig has become really fast now, and the remaining issue is to figure out why the cache is being recreated (if it is, actually).
I have to apologize for wasting your time. ver ---.22 now opens just as fast as ver ----.20 did Apparently this isn't a bug after all.
Created attachment 351982 [details] Fontconfig cache, corrupt vs working Since the problem seems to be solved for Edward, I did some more tests. First I created a new user settings folder for gimp in order to prevent interference from any plugins - this did not change anything regarding the font loading problem. After that, I deleted the old fontconfig cache from %LOCALAPPDATA%\fontconfig and restarted Gimp two times, since the first time was needed to create a new cache - and the problem was gone. Interesting side effect: Closing gimp also was way faster with the new cache (see https://youtu.be/hafYFxWOpy0 for a direct comparison)
Hmmm… does that mean that maybe the format of the cache was incompatible between whatever fontconfig version was used in GIMP 2.8.20 build and the one in 2.8.22 build? Then it would be a fontconfig bug to not properly handle the case, I guess.
Edward, did this happen on several starts at all, or did this just happen once after your upgraded to 2.8.22, and you assumed it would happen every time because it hadn't happened with 2.8.20 recently? (this is what most "GIMP always loads fonts!" claims turn out to be, actually). Regarding the possible font cache corruption in comment 6, this might be hard to reproduce. For example, I did not encounter anything like it on the Windows 7 system I upgraded to 2.8.22. It might be something specific to Windows 10, but researching this will require an affected user (i.e. someone who can reproduce the issue at will) who is willing to invest the time to do so, and preferably able to build fontconfig and GIMP for the Windows platforms.
No, this happened on about 10 starts. I knew it would need to find the fonts the first time. I wouldn't have assumed it was a bug if it did it only once.
Can confirm this bug on my Dell Inspiron 3537 with Windows 8.1 x64. GIMP 2.8.20 starts on this machine roughly about 10 seconds, but after upgrade to version 2.8.22 it takes up to 40-45 seconds every start! And after closing GIMP still hangs in memory for about 15-20 seconds while it loads one processor core to 100%. Thanks to Simon Müller for his comment! I found and deleted the old fontconfig cache. Now GIMP 2.8.22 starts even faster than old version and does not hang when closing.
Knowing how to detect and/or deal with a corrupt fontconfig cache might be helpful. Maybe there is something in the fontconfig API which can help there?
Simon, did fontconfig create the files with the .NEW suffix itself, or did you rename those? Their contents seem to be identical to the working ones, so one of the other files is likely causing this. Maybe fontconfig tries to read all old caches?
As far as I remember, the only thing I did was copying the cache folder to the backup archive - so no, neither did I rename anything nor did I duplicate any file. But there is another thing that came to my mind just now: In the corrupt cache folder, there are files with the "last changed" attribute set to somewhere around 2015. Since I got my current PC in April 2016, they were most likely created on the PC I used before (and brought to my current PC by an imported backup).
Concerning the .NEW file, it's created only when with 2.8.22 when cache must be updated (after a font has been added or deleted). 2.8.20 doesn't create this file so it might be a clue to fix this bug. To see this process: Let's start from the same point, Delete cache folder in %LOCALAPPDATA%\fontconfig Start GIMP, the cache is created at loading screen. Close GIMP ---There are now have 3 files in the cache folder Add or delete a font Start GIMP, the cache is updated at loading screen. Close GIMP ---There are now 4 files in the cache with a .NEW file and still the old cache--- Start GIMP, the cache is again updated at loading screen ---There isn't the .NEW file anymore and the old cache has been replaced.--- So, it takes two times (2 GIMP starts) to correctly update the cache whereas 2.8.20 direcly update it.
Thanks. Let's see if someone from fontconfig knows what can cause this.
https://bugs.freedesktop.org/show_bug.cgi?id=99360 might be related - the .NEW files could be an attempt to fix the issue reported there in a different way.
Just as information to you: in windows 10 version 1607 built 14393.1593, gimp 2.8.xx takes up to fifteen minutes to find all fonts, also after a clean installing of version 2.8.22 recently. Even with no other apps opened on my laptop this occurs. A later win10 version does not solve the problem in my case. Earlier versions of gimp took only a minute or so to find the fonts, either on-line or off-line.
Thanks, I assume it is time to update this bug's description :)
I think this is reason enough to plan for a 2.8.24 to get a properly identifiable release with this fix.
BTW, this is compounded when running both 2.8.22 and 2.9.6 on the same system. 2.9.6, shipped in an installer with a newer fontconfig, is quite fast when building the cache. This causes subsequent launches of 2.8.22 to rebuild the cache for some reason, and reliably hit the problem described here.
*** Bug 792041 has been marked as a duplicate of this bug. ***
*** Bug 787808 has been marked as a duplicate of this bug. ***
*** Bug 792992 has been marked as a duplicate of this bug. ***
*** Bug 793000 has been marked as a duplicate of this bug. ***
This issue was reproduced also in my environment (Windows10 64 bit Fall Creators Update). So I've tried to replace GIMP 2.8.22's `libfontconfig-1.dll` with Fontconfig 2.12.4's one. As a result, this issue no longer reproduces in the environment. I believe that this issue is caused by a bug in old Fontconfig (ver. 2.11.95 - 2.12.3). https://bugs.freedesktop.org/show_bug.cgi?id=99360
This opening bug, taking SO LONG to load fonts, is incredibly annoying -- especially as I NEVER USE FONTS! I tried the 2.9 Beta just to avoid this problem in 2.8.22 but am so disappointed that the "font loading" issue is still there. Using Windows10 on tablet ASUS TRANSFORMER3.
(In reply to Nicholas Edwards from comment #26) > This opening bug, taking SO LONG to load fonts, is incredibly annoying -- > especially as I NEVER USE FONTS! I tried the 2.9 Beta just to avoid this > problem in 2.8.22 but am so disappointed that the "font loading" issue is > still there. Yes, I can imagine this to be annoying. But there is not much we can do since we don't have many Windows developers. Everyone is free to contribute to take care of one's own platform, if you wish to see the problem fixed quickly. (In reply to Masamichi Hosoda from comment #25) > This issue was reproduced also in my environment (Windows10 64 bit Fall > Creators Update). > > So I've tried to replace GIMP 2.8.22's `libfontconfig-1.dll` with Fontconfig > 2.12.4's one. > As a result, this issue no longer reproduces in the environment. > > I believe that this issue is caused by a bug in old Fontconfig (ver. 2.11.95 > - 2.12.3). > https://bugs.freedesktop.org/show_bug.cgi?id=99360 Thanks Masamichi. Does that mean we should recommend fontconfig >= 2.12.4 for the Win32 platform? Or maybe even set a strict minimum version in our configure script (for Win32 only)… Will this be enough to consider the problem fixed?
Ok after re-reading the various message in this report, as well as the fontconfig bug report and the patch at fontconfig, that looks serious enough that we should just bump the fontconfig requirement (for Win32 only). Also we previously had a recommendation for fontconfig on Win32, but that becomes an actual requirement with this bump (Fontconfig had too many serious bugs which were fixed lately so that we can't just "recommend" anymore). Anyway I have tested, and it took a few minutes to cross-compile fontconfig 2.12.4 for Windows, so even if there were no pre-built package available, that would not be reason enough for packagers to ship an older version. commit 36625e087bf749d922f2cb3996fd4c5707c677bf (HEAD -> master, origin/master, origin/HEAD) Author: Jehan <jehan@girinstud.io> Date: Sun Feb 25 03:16:00 2018 +0100 Bug 782676: require fontconfig 2.12.4 on Windows. Fontconfig has a new slowness issue, this time apparently because of locked cache files, preventing a successful cache update. See: https://bugs.freedesktop.org/show_bug.cgi?id=99360 Furthermore the slowness apparently happens at every GIMP startup, and also even when GIMP closes according to various reports. So let's bump Fontconfig version (for Win32 builds only). Also let's not make it a recommendation anymore, but a requirement. That makes quite a few Win32-specific fontconfig bugs which have been fixed, and most are quite serious so this should not be considered as optional anymore, I guess. configure.ac | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-)
And in gimp-2-8 branch: commit 70d2e6aa5f91d1165e95cd25cb6263181295a6e4 (HEAD -> gimp-2-8, origin/gimp-2-8) Author: Jehan <jehan@girinstud.io> Date: Sun Feb 25 03:16:00 2018 +0100 Bug 782676: require fontconfig 2.12.4 on Windows. Fontconfig has a new slowness issue, this time apparently because of locked cache files, preventing a successful cache update. See: https://bugs.freedesktop.org/show_bug.cgi?id=99360 Furthermore the slowness apparently happens at every GIMP startup, and also even when GIMP closes according to various reports. So let's bump Fontconfig version (for Win32 builds only). Also let's not make it a recommendation anymore, but a requirement. That makes quite a few Win32-specific fontconfig bugs which have been fixed, and most are quite serious so this should not be considered as optional anymore, I guess. (cherry picked from commit 36625e087bf749d922f2cb3996fd4c5707c677bf, and amended to adapt to gimp-2-8 configure) configure.ac | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
Well I guess we can close as fixed, unless there were more fontconfig issues. With this new requirement on Win32, hopefully next release will just work properly. Feel free to reopen if I missed something. Also everyone who reported the issue in this bug report, if you could do a test similar as Masamichi Hosoda in comment 25, please tell us if that indeed fixed the issue for you as well (and if it didn't, let's reopen).
*** Bug 793918 has been marked as a duplicate of this bug. ***
*** Bug 794255 has been marked as a duplicate of this bug. ***
(In reply to Nicholas Edwards from comment #26) As a side-note: Maybe it would be an interesting experiment to postpone checking for fonts (updating the cache) until a font is actually used for the first time.
(In reply to Ulrich.Windl from comment #33) > (In reply to Nicholas Edwards from comment #26) > As a side-note: Maybe it would be an interesting experiment to postpone > checking for fonts (updating the cache) until a font is actually used for > the first time. Imagine you had thousands of fonts and the cache takes a dozen minutes to update. Then GIMP starts fast, all good; but when you start with the text tool, suddenly GIMP hangs for 10 minutes? This would be just as bad an experience. But there is another alternative which we have been considered: updating the cache from start, but in background. This way, GIMP does not hang on startup and might still hang when running the text tool, but a lot less. Now this requires some work and nobody started working on it as far as I know. See bug 788810. Patches are welcome on this bug report if anyone wants to implement this.
Up to an hour ago, gimp 2.8.22 took about 30 seconds to load the fonts on current Windows 10. Then I moved %APPDATA%\local\fontconfig\cache. The next start of gimp again took 30+ seconds, but during the following starts, I didn't even see the message "loading fonts".
supplement to my comment 35: The old cache directory has two CACHE-7-Files (1 KB and 2.1 MB) and CACHEDIR.TAG (1 KB) of the installation date of gimp, and a NEW-File, 2.2 KB of today. The new cache directory has two CACHE-7-Files (1 KB and 2.2 MB) and the CACHEDIR.TAG of today
Thanks Clemens for the feedback. This confirms previous tests. If we do a last 2.8.x release before 2.10.0, this problem should be fixed thanks to use of recent fontconfig.
moving fontconfig\cache worked for me too! Hooray! Can someone post this as a workaround? I've been looking to find this workaround for years!
*** Bug 795074 has been marked as a duplicate of this bug. ***
The bug had apparently been resolved but has resurfaced, presumably on account of installation of feature update to Windows 10, version 1803.
What version of GIMP are you testing with? Note that 2.10.0 is the first stable release which includes a recent fontconfig.
(In reply to Michael Schumacher from comment #41) > What version of GIMP are you testing with? Note that 2.10.0 is the first > stable release which includes a recent fontconfig. Under "Help" --> "About GIMP" it says, "GIMP 2.8.22". So I assume that must be the version. As I had mentioned previously, the problem had apparently been resolved but has now re-surfaced. I think it could be due to the Windows update.
*** Bug 796067 has been marked as a duplicate of this bug. ***
*** Bug 796363 has been marked as a duplicate of this bug. ***
(In reply to Michael Schumacher from comment #41) > What version of GIMP are you testing with? Note that 2.10.0 is the first > stable release which includes a recent fontconfig. I have downloaded GIMP 2.10.2. I will check out the fonts issue and report back. My query is, what happens to 2.8? Do those files get uninstalled and deleted during installation of the current version?
Further to the previous post, the fonts issue has been resolved after the download and installation of GIMP 2.10.2 which works very well and has an even better interface. But could something be done about the thumbnail badge that appears on the task bar? Looks a bit menacing.
Created attachment 372401 [details] Screenshot of 2.10.2 This has reference to my post on resolution of bug with download and installation of GIMP 2.10.2, with the suggestion for a change in the thumbnail icon in the task-bar.