X11 fc-cache and XQuartz fc-cache disagree, causing 100% CPU at every start of XQuartz
Submitted by Jörg Höhle
Assigned to fon..@..op.org
Link to original bug (#100278)
Description
Hi,
I recently installed XQuartz 2.7.11 (incl. fontconfig 2.12) on my OSX 10.6.8 64 bit Mac Mini machine, upgrading from Apple's X11 (2.3.6). When XQuartz starts, the CPU gets 100% busy for one minute, while two instances of fc-cache produce error messages. One instance is reported as org.macosforge.xquartz.privileged_startx, the other is org.macosforge.xquartz.startx in Konsole.app.
What seems to distinguish my bug report from other ones about fc-cache is that X11 fc-cache and XQuartz disagree. X11 fc-cache finds everything is fine, while XQuartz fc-cache wants to recache every directory and fails at that, each time XQuartz starts. Otherwise, it seems very similar to the old https://github.com/XQuartz/xquartz-old-tickets/blob/master/ticket/820.md about 2.7.5.
So the issue is: A) Either disagreement is normal, e.g. because the file format changed; (But then, how can X11 still run after installing XQuartz?) In that case, the present issue is about a bug in the XQuartz installer process, which should have generated proper caches initially. B) Or XQuartz fc-cache is wrong, for whatever reason; the caches are fine and fc-cache should be quiet and exit fast.
I don't believe that the installation process failed. "ls -alt" shows that some root-owned files named fonts.* were created when I installed XQuartz last week: $ LANG=C ls -alt /opt/X11/share/fonts/misc -rw-r--r-- 1 root wheel 32637 Mar 12 20:50 fonts.dir drwxr-xr-x 416 root wheel 14144 Mar 12 20:49 . -rw-r--r-- 1 root wheel 4268 Mar 12 20:49 encodings.dir -rw-r--r-- 1 root wheel 2 Mar 12 20:49 fonts.scale -rw-r--r-- 1 root wheel 19562 Mar 12 20:49 fonts.list -rw-r--r-- 1 root wheel 6270 Oct 7 19:23 fonts.alias -rw-r--r-- 1 root wheel 1371 Oct 7 19:23 olcursor.pcf.gz [...]
Note that in /usr/X11R6/lib/X11/fonts/ no files were updated, except in encodings/ $ ls -alt /usr/X11R6/lib/X11/fonts/misc -rw-r--r-- 1 root wheel 32637 Feb 2 2013 fonts.dir drwxr-xr-x 416 root wheel 14144 Feb 2 2013 . -rw-r--r-- 1 root wheel 4456 Feb 2 2013 encodings.dir -rw-r--r-- 1 root wheel 2 Feb 2 2013 fonts.scale [...] $ ls -alt /usr/X11R6/lib/X11/fonts/encodings drwxr-xr-x 38 root wheel 1292 Mar 19 09:07 . -rw-r--r-- 1 root wheel 4456 Mar 19 09:07 encodings.dir drwxr-xr-x 12 root wheel 408 May 19 2009 .. -rw-r--r-- 1 root wheel 616 May 19 2009 microsoft-cp1250.enc.gz [...] Is that how the files should be?
What I don't understand is why xquartz.privileged_startx equally fails to write caches, as it seems to run as root, whereas xquartz.startx runs under the normal login UID, according to the Activity Monitor.app.
Here is X11's fc-cache -v output (edited for brevity): /usr/X11/lib/X11/fonts: skipping, existing cache is valid: 0 fonts, 10 dirs /usr/X11/..fonts/100dpi: skipping, existing cache is valid: 398 fonts, 0 dirs [...] /usr/X11/..fonts/encodings: skipping, existing cache is valid: 0 fonts, 1 dirs /usr/X11/..fonts/encodings/large: skipping, existing cache is valid: 0 fonts, 0 dirs /usr/X11/..fonts/misc: skipping, existing cache is valid: 59 fonts, 0 dirs /usr/X11/..fonts/util: skipping, existing cache is valid: 0 fonts, 0 dirs /usr/X11R6/lib/X11/fonts: skipping, existing cache is valid: 0 fonts, 10 dirs /usr/X11R6/..fonts/100dpi: skipping, existing cache is valid: 398 fonts, 0 dirs [...] /usr/X11R6/..fonts/encodings: skipping, existing cache is valid: 0 fonts, 1 dirs /usr/X11R6/..fonts/encodings/large: skipping, existing cache is valid: 0 fonts, 0 dirs /usr/X11R6/..fonts/misc: skipping, existing cache is valid: 59 fonts, 0 dirs /usr/X11R6/..fonts/util: skipping, existing cache is valid: 0 fonts, 0 dirs /Users/foobar/.fonts: skipping, no such directory /System/Library/Fonts: skipping, existing cache is valid: 69 fonts, 0 dirs /Library/Fonts: skipping, existing cache is valid: 211 fonts, 0 dirs /Users/foobar/Library/Fonts: skipping, existing cache is valid: 0 fonts, 0 dirs /usr/X11/var/cache/fontconfig: not cleaning unwritable cache directory /Users/foobar/.fontconfig: cleaning cache directory fc-cache: succeeded
For comparison, XQuartz output: $ time fc-cache -v /opt/X11/share/fonts: caching, new cache contents: 0 fonts, 10 dirs /opt/X11/share/fonts: failed to write cache /opt/X11/share/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs /opt/X11/share/fonts/100dpi: failed to write cache [...] /opt/X11/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs /opt/X11/share/fonts/encodings: failed to write cache /opt/X11/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs /opt/X11/share/fonts/encodings/large: failed to write cache /opt/X11/share/fonts/misc: caching, new cache contents: 59 fonts, 0 dirs /opt/X11/share/fonts/misc: failed to write cache /opt/X11/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs /opt/X11/share/fonts/util: failed to write cache /usr/X11R6/lib/X11/fonts: caching, new cache contents: 0 fonts, 10 dirs /usr/X11R6/lib/X11/fonts: failed to write cache /usr/X11R6/lib/X11/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs /usr/X11R6/lib/X11/fonts/100dpi: failed to write cache [...] /usr/X11R6/lib/X11/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs /usr/X11R6/lib/X11/fonts/encodings: failed to write cache /usr/X11R6/lib/X11/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs /usr/X11R6/lib/X11/fonts/encodings/large: failed to write cache /usr/X11R6/lib/X11/fonts/misc: caching, new cache contents: 59 fonts, 0 dirs /usr/X11R6/lib/X11/fonts/misc: failed to write cache /usr/X11R6/lib/X11/fonts/util: caching, new cache contents: 0 fonts, 0 dirs /usr/X11R6/lib/X11/fonts/util: failed to write cache /Users/foobar/.local/share/fonts: skipping, no such directory /Users/foobar/.fonts: skipping, no such directory /System/Library/Fonts: caching, new cache contents: 61 fonts, 0 dirs /System/Library/Fonts: failed to write cache /Library/Fonts: caching, new cache contents: 218 fonts, 0 dirs /Library/Fonts: failed to write cache /Users/foobar/Library/Fonts: caching, new cache contents: 0 fonts, 0 dirs /Users/foobar/Library/Fonts: failed to write cache /opt/X11/var/cache/fontconfig: not cleaning unwritable cache directory /Users/foobar/.cache/fontconfig: cleaning cache directory /Users/foobar/.fontconfig: cleaning cache directory fc-cache: failed real 0m54.362s user 0m49.486s sys 0m1.398s
So do X11 and XQuartz 2.7.11 share a common (or at least downward compatible) cache format? What's causing XQuartz to believe the caches need rebuilding? Is it expected that two occurrances of fc-cache run concurrently (privileged and regular startx)?
Note that above, both versions of fc-cache disagree about the number of fonts in /System/Library/Fonts and /Library/Fonts. How comes? There's no such difference about /usr/X11R6/lib/X11/fonts.
The good news is that e.g. xterm opens way before fc-cache completes.
BTW, Konsole also shows, alas without line number, 3 occurrences of org.macosforge.xquartz.startx expr: syntax error
The Mac mini machine is almost bare bones, with very few apps installed (parts of XCode, perhaps remnants of an XQuartz from Leopard before the migration to Snow Leopard)
Thank you for your work on X11/XQuartz, Jörg Höhle
Version: 2.12