Closed Bug 1566053 Opened 5 years ago Closed 4 years ago

CPU Overload interaction with libchromiumcontent

Categories

(Core :: Performance, defect, P3)

68 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1495900

People

(Reporter: timj, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

  1. Start Firefox-68.0 (fresh profile) on Ubuntu 18.04.2 LTS with X11 on Linux 4.15.0-50-generic x86_64. (Note, this behaviour has also been observed with FF-67 versions.)

  2. Start an application with libchromiumcontent >= 69.0.3497.128, e.g. by starting electron-4 (v69.0.3497.128) or electron-5 (v73.0.3683.121) or gooogle-chrome (v75.0.3770.100). Example:
    npm i electron@4 && node_modules/electron/dist/electron

  3. The second application can be closed immediately, starting it is enough already to trigger FF.

Note, libchromiumcontent v66.0.3359.181 (from electron-3) does NOT trigger FF.

Actual results:

Firefox uses up all CPU cores (8 here) at 100% for several seconds, observable e.g. via htop with thread view.
Even exiting the libchromiumcontent using application immediately doesn't cure FF from overloading all CPU cores for several more seconds.
If you happen to have about:performance opened during the overload situation, it will display only the "Task Manager" row, until it recovers from the overload situation, after that point it also lists the other rows for additional tabs again.

Expected results:

A) FF CPU usage should not be triggered by libchromiumcontent using applications.
B) Tab "about:performance" should actually indicate where the CPU cycles are being wasted.

Thanks Tim for the report! Could you please be more specific with the steps to reproduce?

npm i electron@4 && node_modules/electron/dist/electron opens for me:
Electron v4.2.8Chromium v69.0.3497.128Node v10.11.0v8 v6.9.427.31-electron.0

Not sure how to trigger firefox to load when starting electron.

Flags: needinfo?(timj)

(In reply to Adrian Florinescu [:adrian_sv] from comment #1)

Thanks Tim for the report! Could you please be more specific with the steps to reproduce?

npm i electron@4 && node_modules/electron/dist/electron opens for me:
Electron v4.2.8Chromium v69.0.3497.128Node v10.11.0v8 v6.9.427.31-electron.0

Not sure how to trigger firefox to load when starting electron.

Hi Adrian,
starting electrong (or a new version of google-chrome) is enough already.

If you cannot notice the overload (are you using X11?) can you give it a shot under Ubuntu 18.04?
Or let me know what dist you're testing on, so I can give that a shot as well.

Flags: needinfo?(timj)

Apologies, I've tested with Ubuntu 16.04 and I haven't noticed a Firefox process starting or any overload; that's why I assumed I was missing a step or two. Sure, will give it a try on Ubuntu 18.04 and post back if I get a positive result.

Slipped my todo list, adding a NI to get back to this.

Flags: needinfo?(aflorinescu)

I'm still seeing massive CPU overload with Firefox 68.0.1 and e.g. electron-6.

Attaching gdb to a running /usr/lib/firefox/firefox shows that, as soon as electron is started, the firefox process gets a massive amount of SIGSYS signals. Apparently all due to looking for font files. And each firefox process does gets these signals which seems to cause the overload, we're talking about ca 12000 signals on my system, probably due to the great number of font files I have installed here. Here are some excerpts from the debugging session:

Thread 1 "Web Content" received signal SIGSYS, Bad system call.
0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8cff489aa0 "/etc/fonts/fonts.conf", buf=0x7fffe2acfb70) at ../sysdeps/unix/sysv/linux/wordsize-64/xstat.c:35
Thread 1 "Web Content" received signal SIGSYS, Bad system call.
0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8cff678d00 "/etc/fonts/conf.d", buf=0x7fffe2acfb70) at ../sysdeps/unix/sysv/linux/wordsize-64/xstat.c:35

etc. Other locations/syscalls:

0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8d056b6a30 "/etc/fonts/conf.d/10-antialias.conf", buf=0x7fffe2acfb70)
at ../sysdeps/unix/sysv/linux/wordsize-64/xstat.c:35
0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8d056b6b20 "/etc/fonts/conf.d/10-hinting-slight.conf", buf=0x7fffe2acfb70)
at ../sysdeps/unix/sysv/linux/wordsize-64/xstat.c:35
0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8d056b6b50 "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", buf=0x7fffe2acfb70)
0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8d056b6b80 "/etc/fonts/conf.d/11-lcdfilter-default.conf", buf=0x7fffe2acfb70)
0x00007f8d210fe247 in __access (file=0x7f8cff695d40 "/etc/fonts/conf.d/20-unhint-small-dejavu-lgc-sans.conf", type=4) at ../sysdeps/unix/sysv/linux/access.c:27
0x00007f8d210fdd19 in __libc_open64 (file=0x7f8cff695ec0 "/etc/fonts/conf.d/20-unhint-small-dejavu-lgc-serif.conf", oflag=524288) at ../sysdeps/unix/sysv/linux/open64.c:47
0x00007f8d210fdd19 in __libc_open64 (file=0x7f8cff443c40 "/var/cache/fontconfig//3830d5c3ddfd5cd38a049b759396e72e-le64.cache-7", oflag=524290)
0x00007f8d210fd775 in __GI___xstat (vers=<optimized out>, name=0x7f8cff69bc40 "/usr/share/texmf/fonts/opentype/public/lm/lmmonocaps10-regular.otf", buf=0x7fffe2acf9b0)
0x00007f8d21b95dae in __libc_open64 (file=0x7f8cff6f89c0 "/usr/share/texmf/fonts/opentype/public/lm/lmroman9-italic.otf", oflag=0) at ../sysdeps/unix/sysv/linux/open64.c:47
0x00007f8d21b95dae in __libc_open64 (file=0x7f8cff658d80 "/usr/share/fonts/cMap/.resource/Identity-UTF16-H", oflag=0) at ../sysdeps/unix/sysv/linux/open64.c:47
0x00007f8d210fe247 in __access (file=0x7f8d05880060 "/var", type=0) at ../sysdeps/unix/sysv/linux/access.c:27
0x00007f8d210fe247 in __access (file=0x7f8d05880068 "", type=0) at ../sysdeps/unix/sysv/linux/access.c:27

etcpp. There are literally thausands of "received signal SIGSYS, Bad system call." messages. The last line pasted above looks interesting also, note that the path is empty, like some script going bonkers...

So it's probably something in recent libchromiumcontent versions that causes FF to process/search/etc all font files on the system, and for some reason each of those results in a "signal SIGSYS, Bad system call".

The same problem.
Firefox 68.* and Chrom*/Electron on Ubuntu 16.04 and Ubuntu 19.04.

(In reply to David Lechner (:dlech) from comment #8)

More info: https://askubuntu.com/questions/1076412/firefox-freezing-with-100-cpu-usage-for-30-seconds-when-launching-chromium

Thank you for the links. One of the discussion comments suggest the following to also trigger the CPU burning in FF:

mkdir -p ~/.fonts/Library/ && touch ~/.fonts/Library/

That actually works for me, without starting any libchromiumcontent app, so it's indeed due to fontconfig.

I just installed fontconfig+libfontconfig1 2.13.1-2ubuntu2 (the disco packages work on bionic), and that majorly reduces the problem. If Firefox has several tabs opened, there is still a spike that can be seen in CPU usage when libchromiumcontent starts (or with touch ~/.fonts/Library/), but its now only around 1 second, so you have to look for it to notice.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Performance
Product: Firefox → Core

Jonathan - any ideas here?

Flags: needinfo?(jfkthame)
Priority: -- → P3

This sounds like it's the same issue as described in bug 1495900. A patch just landed there which we hope will help for people who have affected fontconfig versions.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(jfkthame)
Resolution: --- → DUPLICATE
Flags: needinfo?(aflorinescu)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: