Bug 178757

Summary: gnome apps using fontconfig take a long time to start up
Product: [Fedora] Fedora Reporter: Dan Williams <dcbw>
Component: fontconfigAssignee: Ray Strode [halfline] <rstrode>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: marius.andreiana, mclasen, sangu.fedora, umar, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-08 21:09:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 150222    
Attachments:
Description Flags
Using attachment 123232, strace file. none

Description Dan Williams 2006-01-24 02:35:01 UTC
fontconfig-2.3.93-4

Happens with lots of gnome apps on my box, eg nautilus, gedit, gaim, etc. 
Grabbed a backtrace from gaim, but same pattern is seen in backtraces from other
apps:

#0  0x00693d68 in ps_hints_apply () from /usr/lib/libfreetype.so.6
#1  0x00663c06 in FT_Get_Char_Index () from /usr/lib/libfreetype.so.6
#2  0x005cf6c2 in FcFreeTypeCharSetAndSpacing () from /usr/lib/libfontconfig.so.1
#3  0x005d1152 in FcFreeTypeQuery () from /usr/lib/libfontconfig.so.1
#4  0x005ce845 in FcFileScanConfig () from /usr/lib/libfontconfig.so.1
#5  0x005ceb46 in FcDirScanConfig () from /usr/lib/libfontconfig.so.1
#6  0x005c772b in FcDirCacheUnlink () from /usr/lib/libfontconfig.so.1
#7  0x005c775d in FcDirCacheUnlink () from /usr/lib/libfontconfig.so.1
#8  0x005c775d in FcDirCacheUnlink () from /usr/lib/libfontconfig.so.1
#9  0x005c7883 in FcCacheRead () from /usr/lib/libfontconfig.so.1
#10 0x005c98c3 in FcConfigBuildFonts () from /usr/lib/libfontconfig.so.1
#11 0x005d225f in FcInitLoadConfigAndFonts () from /usr/lib/libfontconfig.so.1
#12 0x005d2334 in FcInit () from /usr/lib/libfontconfig.so.1
#13 0x005c8e4f in FcConfigGetCurrent () from /usr/lib/libfontconfig.so.1
#14 0x005cb074 in FcConfigSubstituteWithPat () from /usr/lib/libfontconfig.so.1
#15 0x005cb0db in FcConfigSubstitute () from /usr/lib/libfontconfig.so.1
#16 0x00513ca4 in pango_cairo_fc_font_map_get_type () from
/usr/lib/libpangocairo-1.0.so.0
#17 0x0060ec4c in pango_fc_font_lock_face () from /usr/lib/libpangoft2-1.0.so.0
#18 0x00610fa3 in pango_fc_font_map_get_type () from /usr/lib/libpangoft2-1.0.so.0
#19 0x004e4eb8 in pango_font_map_load_fontset () from /usr/lib/libpango-1.0.so.0
#20 0x004e3117 in pango_context_get_font_description () from
/usr/lib/libpango-1.0.so.0
#21 0x004e3456 in pango_itemize_with_base_dir () from /usr/lib/libpango-1.0.so.0
#22 0x004ead07 in pango_layout_iter_get_char_extents () from
/usr/lib/libpango-1.0.so.0
#23 0x004eb8ad in pango_layout_iter_get_char_extents () from
/usr/lib/libpango-1.0.so.0
#24 0x002bff12 in gtk_label_new () from /usr/lib/libgtk-x11-2.0.so.0

Let me know if you want mtimes for directories or something...

Comment 1 sangu 2006-01-25 13:00:54 UTC
please see also bug 177591 .

Making ~/.fonts.cache-2, gtk2 programs become maybe slow.

$rm ~/.fonts.cache-2 

execute gtk2 program.
$gedit

slow slow slow.

quit gedit.

$ls ~/.fonts.cache-2
.fonts.cache-2

execute gedit again.

fast. 

$rm ~/.fonts.cache-2

$gedit
slow slow slow.

quit gedit

$gedit 

fast.

$pmap [gedit process]
[...]
b79da000    252K r--s-  /home/sangu/.fonts.cache-2
b7a19000     48K r--s-  /home/sangu/.fonts.cache-2
b7a25000     12K r--s-  /home/sangu/.fonts.cache-2
b7a28000      4K r--s-  /home/sangu/.fonts.cache-2
b7a29000      4K r--s-  /home/sangu/.fonts.cache-2
b7a2a000     16K r--s-  /home/sangu/.fonts.cache-2
b7a2e000     16K r--s-  /home/sangu/.fonts.cache-2
b7a32000     36K r--s-  /home/sangu/.fonts.cache-2
b7a3b000     36K r--s-  /home/sangu/.fonts.cache-2
b7a44000     12K r--s-  /home/sangu/.fonts.cache-2
b7a47000     12K r--s-  /home/sangu/.fonts.cache-2
b7a4a000      8K r--s-  /home/sangu/.fonts.cache-2
b7a4c000     48K r--s-  /home/sangu/.fonts.cache-2
b7a58000     12K r--s-  /home/sangu/.fonts.cache-2
b7a5b000     48K r--s-  /home/sangu/.fonts.cache-2
b7a67000     24K r--s-  /home/sangu/.fonts.cache-2
b7a6d000    200K r--s-  /home/sangu/.fonts.cache-2
b7a9f000     52K r--s-  /home/sangu/.fonts.cache-2

[...]
b7f5d000     12K r--s-  /home/sangu/.fonts.cache-2
b7f60000     12K r--s-  /home/sangu/.fonts.cache-2
b7f63000     12K r--s-  /home/sangu/.fonts.cache-2
b7f66000      4K r--s-  /home/sangu/.fonts.cache-2
b7f67000     44K r--s-  /home/sangu/.fonts.cache-2


Comment 2 sangu 2006-01-25 13:03:19 UTC
fontconfig version is 2.3.93.cvs20060124-1 in my system.

Comment 3 Matthias Clasen 2006-01-25 13:25:13 UTC
Have you run fc-cache as root, to create the font caches in /var/cache/fontconfig ?

Comment 4 sangu 2006-01-25 13:30:46 UTC
Matthias Clasen : Yes, I do like $sudo fc-cache -f -s -v.

and many cahce.2 files are in /var/cache/fontconfig.

And rhgb and gdm take a long time to start up, too.

$ sudo ls -al /var/gdm/
total 5472
drwxrwx--T  2 root gdm     4096  1ì 25 21:33 .
drwxr-xr-x 25 root root    4096 12ì 12 21:06 ..
-rw-------  1 root root      33  1ì 25 21:33 .cookie
-rw-------  1 gdm  gdm  5558273  1ì 25 21:33 .fonts.cache-2
prw-rw----  1 root root       0  1ì 25 21:33 .gdmfifo
-rw-r-----  1 root root      45  1ì 25 21:33 :0.Xauth
-rw-r--r--  1 root root      59  1ì 25 21:33 :0.Xservers


Comment 5 Dan Williams 2006-01-25 14:52:17 UTC
After updating to latest fontconfig (2.3.93.cvs20060124-1) I still get this issue...

Comment 6 Matthias Clasen 2006-01-25 14:57:31 UTC
Odd, I don't. 

Dan do you have any font directories with cache files, where the fonts have been
moved somewhere else ?

Can you see if removing all font cache files and doing a fc-cache -f as root
makes a difference ?

Comment 7 Dan Williams 2006-01-25 15:11:14 UTC
I'm wrong, I though I had it installed (I had to cancel the yum transaction to
leave for work) but I actually don't.  I'll let you know how the new version
works for me when I reboot.

Comment 8 sangu 2006-01-25 15:12:02 UTC
Created attachment 123673 [details]
Using attachment 123232 [details], strace file.

Removing all fc-cache.2 file in /usr/share/fonts/ and /usr/share/X11/fonts/,
~/.fonts, gtk2 programs begin to read /var/cache/fontconfig/*.cache2 files

Using file attachment 123232 [details] 
strace ./pango-test > pango-strace4.txt 2>&1
[...]
open("/home/sangu/.fonts/fonts.cache-2", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/home/sangu/.fonts", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
open("/var/cache/fontconfig/74de6d2d19edb0f936a044589ceed6d9.cache-2",
O_RDONLY) = -1 ENOENT (No such file or directory)
close(-1)
[...]

still Doing rm ~/.fonts.cache-2, gtk2 program take along time to startup.
but Making ~/.fonts.cache-2, gtk2 startup time become fast.

$ pmap 2734
2734:	gedit
[...]
b60f6000  25120K r----	/usr/share/fonts/ko/TrueType/Hanyang/ngulim.ttf
b797e000     80K r----	/usr/share/fonts/TrueType/Adobe/Adobe Myriad Pro Semi
Extended/Fonts/MyriadPro-SemiExt.otf
b7992000    136K r--s-	/home/sangu/.fonts.cache-2
b79b4000     28K r--s- 
/var/cache/fontconfig/be85c56e05c5eddf23821abc58a49bff.cache-2
b79bb000     72K r--s- 
/var/cache/fontconfig/928824533f229a5e57df47cd52fcfc53.cache-2
b79cd000     16K r--s- 
/var/cache/fontconfig/418fd5576625361440112eea85397ec8.cache-2
b79d1000     48K r--s- 
/var/cache/fontconfig/d4b9178f63088034476ae3c16c5e9ffa.cache-2
[...]

Comment 9 Dan Williams 2006-01-26 11:41:04 UTC
Matthias: fontconfig from yesterday still has same problem.  Bootup is ok, but
from login->desktop is the slow part.  It looks like it's recreating most of
/var/cache/fontconfig every login:

[localhost ~]# ls -al /var/cache/fontconfig/
total 4400
drwxr-xr-x  2 root root    4096 Jan 26 06:28 .
drwxr-xr-x 12 root root    4096 Jan 22 20:02 ..
-rw-r--r--  1 root root   32768 Jan 26 06:28
0ff6f82dbf790ad053eeb7e60fb69f01.cache-2
-rw-r--r--  1 root root    8192 Jan 26 06:28
1bafac3d201394e20ca569af29462f53.cache-2
-rw-r--r--  1 root root   40960 Jan 26 06:28
27d5b818a802b42ab2f3fc496e59a977.cache-2
-rw-r--r--  1 root root  294912 Jan 26 06:28
4f9ce6354b1cf11b651ac663e2bad3a0.cache-2
-rw-r--r--  1 root root   16384 Jan 26 06:28
7a426ebbad5b15cec756d42779fa4129.cache-2
-rw-r--r--  1 root root  303104 Jan 26 06:28
88fe7a657865849dd90c96886eae1da0.cache-2
-rw-r--r--  1 root root   86016 Jan 20 14:09
9b7d20e8db16b902f67d1e4fdd04d026.cache-2
-rw-r--r--  1 root root  270336 Jan 26 06:28
aab09ac2251f7ac4fa5bff39e71df460.cache-2
-rw-r--r--  1 root root   16384 Jan 26 06:28
b130ce1d95177f008f34357b80002e7d.cache-2
-rw-r--r--  1 root root    4096 Jan 25 09:59
b219960f116ab25f17b640e8e78a644e.cache-2
-rw-r--r--  1 root root  135168 Jan 26 06:28
ba940667c0b337bfdcbfd9901fd37155.cache-2
-rw-r--r--  1 root root  524288 Jan 26 06:28
be85c56e05c5eddf23821abc58a49bff.cache-2
-rw-r--r--  1 root root 1310720 Jan 26 06:28
c974e4c60d201a21112df444ab73ef55.cache-2
-rw-r--r--  1 root root   57344 Jan 26 06:28
cf38a9fb1312d32d0623f02fc63e292c.cache-2
-rw-r--r--  1 root root   32768 Jan 26 06:28
d0852e6107e29cf2370e29e932b671e8.cache-2
-rw-r--r--  1 root root  946176 Jan 26 06:28
d5161dcee5eac336d61e9844ebbf0297.cache-2
-rw-r--r--  1 root root  270336 Jan 26 06:28
f020b8ea95ccc22321ce43a4499889d8.cache-2
-rw-r--r--  1 root root   98304 Jan 26 06:28
ffbeb93d66ada2631f4f047962e1ab5b.cache-2
-rw-r--r--  1 root root       0 Jan 25 09:58 stamp

[localhost ~]# ls -al ~/.fonts.cache-*
-rw-r--r-- 1 dcbw dcbw       0 Oct 12 10:43 /home/dcbw/.fonts.cache-1
-rw------- 1 dcbw dcbw 5813549 Jan 26 06:36 /home/dcbw/.fonts.cache-2

[localhost /]# cd /usr/share/fonts
[localhost fonts]# ls -al `find . -name "fonts.cache-2" | xargs`
-rw-r--r-- 1 root root 49152 Jan 13 12:19 ./bitmap-fonts/fonts.cache-2
-rw-r--r-- 1 root root 16384 Jan 13 12:18 ./bitstream-vera/fonts.cache-2
-rw-r--r-- 1 root root  4096 Jan 13 10:51 ./default/fonts.cache-2
-rw-r--r-- 1 root root 20480 Jan 13 10:51 ./default/ghostscript/fonts.cache-2
-rw-r--r-- 1 root root 12288 Dec  5 11:34 ./ko/fonts.cache-2
-rw-r--r-- 1 root root 28672 Dec  5 11:34 ./ko/TrueType/fonts.cache-2
-rw-r--r-- 1 root root 40960 Dec  5 11:33 ./mathml/fonts.cache-2
-rw-r--r-- 1 root root 12288 Dec  5 11:33 ./openoffice/fonts.cache-2



Comment 10 Dan Williams 2006-01-26 12:03:33 UTC
Furthermore, it seems to be hitting my ~/.fonts.cache-2 file every time an app
starts.  Compare the size & time from the previous comment with it now (30 
minutes later, after launching evolution, terminal, and firefox among others):

Before 2nd Firefox launch:
-rw------- 1 dcbw dcbw 7116077 Jan 26 07:00 /home/dcbw/.fonts.cache-2

After 2nd Firefox launch:
-rw------- 1 dcbw dcbw 7333165 Jan 26 07:01 /home/dcbw/.fonts.cache-2

This is _not_ the first time I've launched firefox this login session, the first
time was to file the above comment in this bug.  So it's regenerating the
fonts.cache-2 file on each launch of FF in this session.  Seems to do the same
thing for every other app too.

Comment 11 Dan Williams 2006-01-27 20:18:37 UTC
Killing ~/.fonts.cache-2 seems to have cleared up the problem for me.

Comment 12 Sammy 2006-01-29 15:42:15 UTC
I just independently discovered the same problem using KDE. Everything was
extremely slow and looked like even starting konsole was doing a lot of disk
activity (30 seconds). Doing an strace I realized that it was loading enormous
amount of fonts. Looking at my cache file it was 720MB, yes that is true.
I am investigating now if this is just resolved by removing files or not but
there are a lot of people out there complaining of major slowdowns and
thinking it has to do with kernel debugging options. 

Comment 13 Matthias Clasen 2006-02-02 15:25:57 UTC
I hope that fontconfig-2.3.93.cvs20060131-2 addresses most of the remaining
fontconfig problems.

Comment 14 Matthias Clasen 2006-02-08 04:27:59 UTC
Do people still see this problem with fontconfig >= 2.3.93.cvs20060207-1 ?
If so, does it still happen after regenerating all cache files ?

Comment 15 Warren Togami 2006-03-08 21:03:49 UTC
I haven't seen any signs of this for a while.  Should we assume it is fixed now?


Comment 16 Matthias Clasen 2006-03-08 21:09:25 UTC
Yes