Bug 245915

Summary: x11-fonts/fontconfig: webfonts on many sites crash www/firefox
Product: Ports & Packages Reporter: Tobias C. Berner <tcberner>
Component: Individual Port(s)Assignee: freebsd-desktop (Team) <desktop>
Status: Closed FIXED    
Severity: Affects Only Me CC: ehaupt, freebsd.68fba, gecko, grahamperrin, lightside, maciej
Priority: --- Keywords: needs-qa, regression
Version: LatestFlags: tcberner: maintainer-feedback+
tcberner: merge-quarterly+
Hardware: Any   
OS: Any   
See Also: https://bugzilla.mozilla.org/show_bug.cgi?id=1629231
Bug Depends on:    
Bug Blocks: 239167    
Attachments:
Description Flags
workaround: revert regressing backport
none
upstream fix
none
upstream fix none

Description Tobias C. Berner freebsd_committer freebsd_triage 2020-04-25 22:20:51 UTC
Moin moin 

Since the upgrade to 75.0 tabs of e.g. 'https://www.galaxus.ch/' keep crashing [1]


mfg Tobias


[1]
Gah. Your tab just crashed.
We can help!

Choose Restore This Tab to reload the page.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2020-04-27 04:25:13 UTC
Can you reproduce after disabling gfx.downloadable_fonts.enabled in about:config? If so then all these crashes are related.

Appears to affect www/firefox-esr as well. Unlike gov.uk the crash seems to have different backtrace each time. MOZ_FORCE_DISABLE_E10S=1 doesn't help but we need to collect affected FreeBSD versions to rule out a kernel regression e.g., on -CURRENT.
Comment 2 Emanuel Haupt freebsd_committer freebsd_triage 2020-04-27 08:44:05 UTC
I'm having the same issue (same website). I can confirm that disabling gfx.downloadable_fonts.enabled solves the issue for me.
Comment 3 Tobias C. Berner freebsd_committer freebsd_triage 2020-04-27 16:51:24 UTC
(In reply to Jan Beich from comment #1)
Indeed, toggling this config seems to fix the issue.
Comment 4 Jan Beich freebsd_committer freebsd_triage 2020-05-07 19:00:12 UTC
Over to gnome@ per https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/237
Comment 5 Jan Beich freebsd_committer freebsd_triage 2020-05-07 19:01:21 UTC
Err, it's desktop@ after ports r517750.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2020-05-07 19:14:42 UTC
Created attachment 214242 [details]
workaround: revert regressing backport

I've tried https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/94/diffs?commit_id=6edaaa4d1823518a97fb4cc3004d110b1046f742 at first but it doesn't seem to help. Maybe we need to backport more commits.
Comment 7 Jan Beich freebsd_committer freebsd_triage 2020-05-07 19:23:30 UTC
Created attachment 214243 [details]
upstream fix

Nevermind, I should've used patch(1) instead of trying to apply the fix manually only to get context wrong.
Comment 8 Jan Beich freebsd_committer freebsd_triage 2020-05-07 19:26:09 UTC
Created attachment 214244 [details]
upstream fix

Oops, somehow patch header was lost while switching between repos.
Comment 9 lightside 2020-05-08 16:02:56 UTC
Hello.

Also may confirm, that patch in attachment #214244 [details] fixes Firefox's tab crashes for https://www.galaxus.ch site.

Sorry about that, since I proposed to include affected https://cgit.freedesktop.org/fontconfig/commit/?id=61573ad5f7c4dd0860d613d99d0086433240eb75 commit in bug #239167, mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=1629231#c25 comment.

Thanks Jonathan Kew and Jan Beich for proposed fixes.
Comment 10 Tobias C. Berner freebsd_committer freebsd_triage 2020-05-09 06:48:24 UTC
(In reply to lightside from comment #9)
Thank you very much for the patch, I will give it a go locally.


mfg Tobias
Comment 11 commit-hook freebsd_committer freebsd_triage 2020-05-09 07:04:35 UTC
A commit references this bug:

Author: tcberner
Date: Sat May  9 07:03:57 UTC 2020
New revision: 534715
URL: https://svnweb.freebsd.org/changeset/ports/534715

Log:
  x11-fonts/fontconfig: webfonts on many sites crash www/firefox

  A "bad" commit [1] included in the recent fontconfig upgrade to 2.13.92, lead to many
  crashed tabs inside firefox. A fix has been provided upstream in [2], and fixed in fix [3].

  Related Mozilla bugreport [4].

  [1] https://cgit.freedesktop.org/fontconfig/commit/?id=61573ad5f7c4dd0860d613d99d0086433240eb75
  [2] https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/237
  [3] https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/6edaaa4d1823518a97fb4cc3004d110b1046f742
  [4] https://bugzilla.mozilla.org/show_bug.cgi?id=1629231

  PR:		245915
  Submitted by:	jbeich
  Reported by:	Graham Perrin, jbeich, ehaupt, tcberner

Changes:
  head/x11-fonts/fontconfig/Makefile
  head/x11-fonts/fontconfig/files/patch-2.13.92.diff
Comment 12 commit-hook freebsd_committer freebsd_triage 2020-05-09 07:05:37 UTC
A commit references this bug:

Author: tcberner
Date: Sat May  9 07:04:54 UTC 2020
New revision: 534716
URL: https://svnweb.freebsd.org/changeset/ports/534716

Log:
  MFH: r534715

  x11-fonts/fontconfig: webfonts on many sites crash www/firefox

  A "bad" commit [1] included in the recent fontconfig upgrade to 2.13.92, lead to many
  crashed tabs inside firefox. A fix has been provided upstream in [2], and fixed in fix [3].

  Related Mozilla bugreport [4].

  [1] https://cgit.freedesktop.org/fontconfig/commit/?id=61573ad5f7c4dd0860d613d99d0086433240eb75
  [2] https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/237
  [3] https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/6edaaa4d1823518a97fb4cc3004d110b1046f742
  [4] https://bugzilla.mozilla.org/show_bug.cgi?id=1629231

  PR:		245915
  Submitted by:	jbeich
  Reported by:	Graham Perrin, jbeich, ehaupt, tcberner

  Approved by:	ports-secteam (implicit)

Changes:
_U  branches/2020Q2/
  branches/2020Q2/x11-fonts/fontconfig/Makefile
  branches/2020Q2/x11-fonts/fontconfig/files/patch-2.13.92.diff
Comment 13 Tobias C. Berner freebsd_committer freebsd_triage 2020-05-09 07:06:27 UTC
Thanks everyone, committed and mfh'd.
Comment 14 Graham Perrin freebsd_committer freebsd_triage 2020-05-09 08:57:18 UTC
Superb – thanks to all concerned for identification of the bug and the rapid fix. 

Fix confirmed, although I found it necessary to _force_ the upgrade: 

----

root@momh167-gjp4-8570p:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01    
Fetching packagesite.txz: 100%   27 KiB  28.0kB/s    00:01    
Processing entries: 100%
The provides database is up-to-date.
poudriere repository update completed. 94 packages processed.
All repositories are up to date.
Checking for upgrades (5 candidates): 100%  0%
Processing candidates (5 candidates): 100%^[[F
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        linux_base-c7: 7.8.2003 -> 7.8.2003_1 [FreeBSD]

Installed packages to be REINSTALLED:
        libfmt-6.1.2 [FreeBSD]

Number of packages to be upgraded: 1
Number of packages to be reinstalled: 1

147 KiB to be downloaded.

Proceed with this action? [y/N]: y
Please type 'Y[es]' or 'N[o]' to make a selection

Proceed with this action? [y/N]: y
[1/1] Fetching libfmt-6.1.2.txz: 100%  147 KiB 151.0kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/2] Upgrading linux_base-c7 from 7.8.2003 to 7.8.2003_1...
[1/2] Extracting linux_base-c7-7.8.2003_1: 100%
[2/2] Reinstalling libfmt-6.1.2...
[2/2] Extracting libfmt-6.1.2: 100%
root@momh167-gjp4-8570p:~ # pkg upgrade -f -r poudriere fontconfig
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        fontconfig: 2.13.92_1,1 -> 2.13.92_2,1 [poudriere]

Number of packages to be upgraded: 1

Proceed with this action? [y/N]: y
[1/1] Upgrading fontconfig from 2.13.92_1,1 to 2.13.92_2,1...
[1/1] Extracting fontconfig-2.13.92_2,1: 100%
Running fc-cache to build fontconfig cache...
Font directories:
        /usr/local/share/fonts
        /usr/local/lib/X11/fonts
        /usr/local/share/fonts/100dpi
        /usr/local/share/fonts/75dpi
        /usr/local/share/fonts/Caladea
        /usr/local/share/fonts/Carlito
        /usr/local/share/fonts/ChromeOS
        /usr/local/share/fonts/GentiumBasic
        /usr/local/share/fonts/Liberation
        /usr/local/share/fonts/LinLibertineG
        /usr/local/share/fonts/OTF
        /usr/local/share/fonts/TTF
        /usr/local/share/fonts/Type1
        /usr/local/share/fonts/afm
        /usr/local/share/fonts/b612
        /usr/local/share/fonts/cantarell
        /usr/local/share/fonts/courier-prime
        /usr/local/share/fonts/cyrillic
        /usr/local/share/fonts/dejavu
        /usr/local/share/fonts/encodings
        /usr/local/share/fonts/hack-font
        /usr/local/share/fonts/kanjistrokeorders
        /usr/local/share/fonts/misc
        /usr/local/share/fonts/noto
        /usr/local/share/fonts/twemoji-color-font-ttf
        /usr/local/share/fonts/util
        /usr/local/share/fonts/encodings/large
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 24 dirs
/usr/local/share/fonts/100dpi: caching, new cache contents: 398 fonts, 0 dirs
/usr/local/share/fonts/75dpi: caching, new cache contents: 398 fonts, 0 dirs
/usr/local/share/fonts/Caladea: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/Carlito: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/ChromeOS: caching, new cache contents: 12 fonts, 0 dirs
/usr/local/share/fonts/GentiumBasic: caching, new cache contents: 8 fonts, 0 dirs
/usr/local/share/fonts/Liberation: caching, new cache contents: 12 fonts, 0 dirs
/usr/local/share/fonts/LinLibertineG: caching, new cache contents: 10 fonts, 0 dirs
/usr/local/share/fonts/OTF: caching, new cache contents: 23 fonts, 0 dirs
/usr/local/share/fonts/TTF: caching, new cache contents: 13 fonts, 0 dirs
/usr/local/share/fonts/Type1: caching, new cache contents: 29 fonts, 0 dirs
/usr/local/share/fonts/afm: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/b612: caching, new cache contents: 8 fonts, 0 dirs
/usr/local/share/fonts/cantarell: caching, new cache contents: 5 fonts, 0 dirs
/usr/local/share/fonts/courier-prime: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/cyrillic: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/dejavu: caching, new cache contents: 22 fonts, 0 dirs
/usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/hack-font: caching, new cache contents: 4 fonts, 0 dirs
/usr/local/share/fonts/kanjistrokeorders: caching, new cache contents: 1 fonts, 0 dirs
/usr/local/share/fonts/misc: caching, new cache contents: 89 fonts, 0 dirs
/usr/local/share/fonts/noto: caching, new cache contents: 13 fonts, 0 dirs
/usr/local/share/fonts/twemoji-color-font-ttf: caching, new cache contents: 1 fonts, 0 dirs
/usr/local/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/lib/X11/fonts: skipping, no such directory
/usr/local/share/fonts/100dpi: skipping, looped directory detected
/usr/local/share/fonts/75dpi: skipping, looped directory detected
/usr/local/share/fonts/Caladea: skipping, looped directory detected
/usr/local/share/fonts/Carlito: skipping, looped directory detected
/usr/local/share/fonts/ChromeOS: skipping, looped directory detected
/usr/local/share/fonts/GentiumBasic: skipping, looped directory detected
/usr/local/share/fonts/Liberation: skipping, looped directory detected
/usr/local/share/fonts/LinLibertineG: skipping, looped directory detected
/usr/local/share/fonts/OTF: skipping, looped directory detected
/usr/local/share/fonts/TTF: skipping, looped directory detected
/usr/local/share/fonts/Type1: skipping, looped directory detected
/usr/local/share/fonts/afm: skipping, looped directory detected
/usr/local/share/fonts/b612: skipping, looped directory detected
/usr/local/share/fonts/cantarell: skipping, looped directory detected
/usr/local/share/fonts/courier-prime: skipping, looped directory detected
/usr/local/share/fonts/cyrillic: skipping, looped directory detected
/usr/local/share/fonts/dejavu: skipping, looped directory detected
/usr/local/share/fonts/encodings: skipping, looped directory detected
/usr/local/share/fonts/hack-font: skipping, looped directory detected
/usr/local/share/fonts/kanjistrokeorders: skipping, looped directory detected
/usr/local/share/fonts/misc: skipping, looped directory detected
/usr/local/share/fonts/noto: skipping, looped directory detected
/usr/local/share/fonts/twemoji-color-font-ttf: skipping, looped directory detected
/usr/local/share/fonts/util: skipping, looped directory detected
/usr/local/share/fonts/encodings/large: skipping, looped directory detected
/var/db/fontconfig: cleaning cache directory
fc-cache: succeeded
root@momh167-gjp4-8570p:~ # 

----

Tested: 

<https://www.gov.uk/coronavirus>
<https://issuu.com/medical-forum-magazine/docs/medical_forum_magazine_april__2020_public_edition>
<https://www.galaxus.ch/>
<https://www.gov.uk/government/organisations/hm-revenue-customs>
Comment 15 Patrick Mackinlay 2020-05-24 10:36:37 UTC
*** Bug 246687 has been marked as a duplicate of this bug. ***