After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782676 - Ship with current fontconfig version to avoid fontconfig cache issues
Ship with current fontconfig version to avoid fontconfig cache issues
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Windows Installer
gimp-2-8
Other Windows
: Normal blocker
: 2.8
Assigned To: GIMP Bugs
Jernej Simončič
: 787808 792041 792992 793000 793918 794255 795074 796067 796363 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-05-16 04:10 UTC by Edward Ingram
Modified: 2018-05-25 15:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Gimp startup log (font loading) (527.15 KB, application/vnd.ms-excel)
2017-05-16 10:14 UTC, Simon Müller
Details
Fontconfig cache, corrupt vs working (311.44 KB, application/x-7z-compressed)
2017-05-16 16:15 UTC, Simon Müller
Details
Screenshot of 2.10.2 (69.76 KB, image/jpeg)
2018-05-25 15:07 UTC, Ashwani
Details

Description Edward Ingram 2017-05-16 04:10:51 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)
Comment 1 Simon Müller 2017-05-16 07:41:03 UTC
I can confirm this. I have the same problem with 2.8.22 on Win10 1703 build 15063.296.
Comment 2 Michael Schumacher 2017-05-16 08:05:18 UTC
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.
Comment 3 Simon Müller 2017-05-16 10:14:23 UTC
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.
Comment 4 Michael Schumacher 2017-05-16 11:23:12 UTC
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).
Comment 5 Edward Ingram 2017-05-16 13:42:48 UTC
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.
Comment 6 Simon Müller 2017-05-16 16:15:30 UTC
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)
Comment 7 Jehan 2017-05-16 17:50:03 UTC
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.
Comment 8 Michael Schumacher 2017-05-17 08:00:18 UTC
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.
Comment 9 Edward Ingram 2017-05-17 12:12:15 UTC
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.
Comment 10 Elena 2017-06-27 11:49:30 UTC
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.
Comment 11 Michael Schumacher 2017-07-04 09:12:23 UTC
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?
Comment 12 Michael Schumacher 2017-07-11 08:36:01 UTC
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?
Comment 13 Simon Müller 2017-07-11 09:14:06 UTC
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).
Comment 14 Maxime.J 2017-07-17 10:49:48 UTC
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.
Comment 15 Michael Schumacher 2017-07-17 12:07:23 UTC
Thanks. Let's see if someone from fontconfig knows what can cause this.
Comment 16 Michael Schumacher 2017-07-18 08:09:49 UTC
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.
Comment 17 natuwes1968 2017-09-18 13:20:48 UTC
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.
Comment 18 Michael Schumacher 2017-09-18 13:58:35 UTC
Thanks, I assume it is time to update this bug's description :)
Comment 19 Michael Schumacher 2017-09-18 14:10:02 UTC
I think this is reason enough to plan for a 2.8.24 to get a properly identifiable release with this fix.
Comment 20 Michael Schumacher 2017-09-19 11:21:56 UTC
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.
Comment 21 Michael Schumacher 2017-12-30 08:13:20 UTC
*** Bug 792041 has been marked as a duplicate of this bug. ***
Comment 22 Michael Schumacher 2018-01-01 13:08:59 UTC
*** Bug 787808 has been marked as a duplicate of this bug. ***
Comment 23 Michael Schumacher 2018-01-29 08:52:20 UTC
*** Bug 792992 has been marked as a duplicate of this bug. ***
Comment 24 Michael Schumacher 2018-01-29 20:56:43 UTC
*** Bug 793000 has been marked as a duplicate of this bug. ***
Comment 25 Masamichi Hosoda 2018-02-10 10:35:39 UTC
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
Comment 26 Nicholas Edwards 2018-02-24 18:24:47 UTC
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.
Comment 27 Jehan 2018-02-25 01:21:42 UTC
(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?
Comment 28 Jehan 2018-02-25 02:34:19 UTC
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(-)
Comment 29 Jehan 2018-02-25 02:58:34 UTC
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(-)
Comment 30 Jehan 2018-02-25 14:49:55 UTC
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).
Comment 31 Jehan 2018-03-01 17:28:00 UTC
*** Bug 793918 has been marked as a duplicate of this bug. ***
Comment 32 Jehan 2018-03-12 11:24:40 UTC
*** Bug 794255 has been marked as a duplicate of this bug. ***
Comment 33 Ulrich.Windl 2018-03-13 07:34:48 UTC
(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.
Comment 34 Jehan 2018-03-13 13:45:08 UTC
(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.
Comment 35 Clemens Pflüger 2018-04-12 21:56:20 UTC
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".
Comment 36 Clemens Pflüger 2018-04-12 22:08:06 UTC
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
Comment 37 Jehan 2018-04-13 10:58:37 UTC
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.
Comment 38 Nicholas Edwards 2018-04-13 12:12:20 UTC
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!
Comment 39 Michael Schumacher 2018-04-17 14:50:33 UTC
*** Bug 795074 has been marked as a duplicate of this bug. ***
Comment 40 Ashwani 2018-05-05 14:43:02 UTC
The bug had apparently been resolved but has resurfaced, presumably on account of installation of feature update to Windows 10, version 1803.
Comment 41 Michael Schumacher 2018-05-05 14:46:40 UTC
What version of GIMP are you testing with? Note that 2.10.0 is the first stable release which includes a recent fontconfig.
Comment 42 Ashwani 2018-05-05 15:32:38 UTC
(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.
Comment 43 Michael Schumacher 2018-05-13 12:40:58 UTC
*** Bug 796067 has been marked as a duplicate of this bug. ***
Comment 44 Jehan 2018-05-23 18:26:34 UTC
*** Bug 796363 has been marked as a duplicate of this bug. ***
Comment 45 Ashwani 2018-05-24 08:03:48 UTC
(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?
Comment 46 Ashwani 2018-05-25 14:48:14 UTC
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.
Comment 47 Ashwani 2018-05-25 15:07:57 UTC
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.