"mach wpt" always takes ~7s during setup in "install_darwin_font"
Categories
(Testing :: web-platform-tests, defect)
Tracking
(firefox142 fixed)
| Tracking | Status | |
|---|---|---|
| firefox142 | --- | fixed |
People
(Reporter: whimboo, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
This is causing a huge delay for me locally each time when I run mach wpt jobs. I thought first it might be related to VCS (git or hg) but as it looks like the real underlying issue is related to the installation of the darwin fonts on MacOS.
I just found out about the ./mach --profile-command global argument and created a profile.
Here the stack with the first 10 frames that show the total time:
449 7.3 0.01626 7.3 0.01626 ~:0(<method 'read' of '_io.BufferedReader' objects>)
40 3.958 0.09895 3.958 0.09895 ~:0(<method 'acquire' of '_thread.lock' objects>)
25 0.3813 0.01525 0.3813 0.01525 ~:0(<method 'control' of 'select.kqueue' objects>)
143 0.2879 0.002014 0.2879 0.002014 ~:0(<built-in method posix.waitpid>)
399 0.2705 0.0006779 0.2705 0.0006779 ~:0(<built-in method builtins.compile>)
112358 0.2225 1.98e-06 0.2225 1.98e-06 ~:0(<built-in method posix.stat>)
324642 0.2177 6.705e-07 0.3087 9.51e-07 <frozen posixpath>:71(join)
134309 0.1914 1.425e-06 0.3174 2.363e-06 parse.py:432(urlsplit)
32 0.1616 0.005049 0.1616 0.005049 ~:0(<built-in method posix.read>)
388659 0.1596 4.105e-07 0.1709 4.398e-07 parse.py:110(_coerce_args)
Most time ~4s is spent alone in acquiring the lock for a thread.
| Reporter | ||
Comment 1•1 year ago
|
||
In CI it is unable to install the font because it is most likely not installed on the workers. But this attempt itself also takes about 30s:
https://treeherder.mozilla.org/logviewer?job_id=507347572&repo=mozilla-central&lineNumber=858-859
[task 2025-05-09T06:56:26.363Z] 06:56:26 INFO - mozversion platform_version: 140.0a1
[task 2025-05-09T06:56:53.250Z] 06:56:53 WARNING - Unable to install font: Ahem.ttf
As James pointed out the tests, that require that font, have probably moved to webfonts so that the installation is probably not needed anymore. Lets push a try build with the font installation disabled on all platforms.
| Reporter | ||
Comment 2•1 year ago
|
||
I pushed to try to see what happens when the font is not getting installed:
https://treeherder.mozilla.org/jobs?repo=try&revision=c5dab86e9cf736f17ebba6f4d04aec9d4539a279
A final patch should probably made against the upstream repository to see possible regressions in other browsers.
| Reporter | ||
Comment 3•1 year ago
|
||
(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #2)
I pushed to try to see what happens when the font is not getting installed:
https://treeherder.mozilla.org/jobs?repo=try&revision=c5dab86e9cf736f17ebba6f4d04aec9d4539a279
This doesn't look good and points out that we are still required to install the font? Emilio or Jonathan, do you may know more if we are still required to have the system installed font?
A final patch should probably made against the upstream repository to see possible regressions in other browsers.
As talked to James a good to go patch for now would be to force not installing the font at all by using --no-install-fonts in our CI. Later on we could check what to do upstream.
| Reporter | ||
Comment 4•1 year ago
|
||
We actually also seem to force the installation in mozharness, which should be obeyed:
https://searchfox.org/mozilla-central/rev/126697140e711e04a9d95edae537541c3bde89cc/testing/mozharness/scripts/web_platform_tests.py#414
Comment 5•1 year ago
|
||
It seems those tests need generally fixing? Though the SVG first-letter test might hint at a bug in Gecko.
Most of them should be fixed by doing something like document.fonts.ready.then(() => checkLayout(...)) rather than just checkLayout(...) or so.
| Assignee | ||
Comment 6•1 year ago
|
||
Is this only the Ahem font that install_darwin_font is trying to install, or are there any others?
In general tests are supposed to use Ahem as a webfont but I'm pretty sure I've seen some that haven't been updated so they still assume it's installed locally.
When it's used as a webfont, it's necessary to ensure it has loaded before scripts try to examine layout, etc., so as Emilio says in comment 5, a bunch of tests need to wait for document.fonts.ready. They currently pass with Ahem installed locally because the CSS includes src: local("Ahem"), which loads synchronously, but if it's not available they fall back to a src: url(....) rule, which loads async.
Picking an example at random, I checked locally that css/css-sizing/keyword-sizes-for-intrinsic-contributions.html behaves as expected if the checkLayout call is wrapped with document.fonts.ready.then(...), and I'd expect the same to be true for a bunch of others.
| Reporter | ||
Comment 7•1 year ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #6)
Is this only the Ahem font that install_darwin_font is trying to install, or are there any others?
Yes, this is only for Ahem which is the only font that is actually getting installed:
In general tests are supposed to use Ahem as a webfont but I'm pretty sure I've seen some that haven't been updated so they still assume it's installed locally.
When it's used as a webfont, it's necessary to ensure it has loaded before scripts try to examine layout, etc., so as Emilio says in comment 5, a bunch of tests need to wait for
document.fonts.ready. They currently pass with Ahem installed locally because the CSS includessrc: local("Ahem"), which loads synchronously, but if it's not available they fall back to asrc: url(....)rule, which loads async.Picking an example at random, I checked locally that css/css-sizing/keyword-sizes-for-intrinsic-contributions.html behaves as expected if the
checkLayoutcall is wrapped withdocument.fonts.ready.then(...), and I'd expect the same to be true for a bunch of others.
I checked this test as well and I don't get it to pass even with using document.fonts.ready.then(). To replicate I've disabled my locally installed Ahem font via the Font Book application and then run the test. But it's always failing for me.
Is that some work one of you could help us with to update? I'm happy to take the rest of the work to update wptrunner not installing the font. I would appreciate. Thanks.
| Assignee | ||
Comment 8•1 year ago
|
||
I've got a stack of patches that I believe will address most of the issues here, though try is currently closed so I don't have an up-to-date run to check them all yet. I'll file a separate bug (blocking this one) for the test updates and start posting fixes there.
| Reporter | ||
Comment 9•1 year ago
|
||
Also note that we actually never uninstall / remove the font after the tests are finished which means that the font remains on the users system. Removing it manually and running mach wpt again shows the following warning in the shell:
0:10.68 WARNING Unable to install font: Ahem.ttf
Looks like we are even failing to install the font nowadays? If we don't have to install it anymore we may be able to remove this code so that no traces are left behind.
| Assignee | ||
Comment 10•1 year ago
|
||
Actually, I believe we are installing it but the check in install_darwin_font doesn't see it, and then we end up not removing it.
| Assignee | ||
Comment 11•1 year ago
|
||
Just to update here, once bug 1967954 is landed I believe it will be OK to disable the installation of Ahem, and our CI test jobs should stay green. (A recent try run, including fixes except for bug 1967954, is at https://treeherder.mozilla.org/jobs?repo=try&revision=ebfe7999c004a89cd10fe31c8b5d36168b4be304)
| Reporter | ||
Comment 12•1 year ago
|
||
As mentioned by Jonathan on Matrix it would probably be better to remove the local("Ahem") source from ahem.css first, so that it only attempts to load the file resource, never a locally-installed font. It's still possible that "unreliable" tests (that fail to wait for document.fonts.ready) may pass in some browsers/some of the time, as they'll depend on the exact timing of resource loads.
| Reporter | ||
Comment 13•1 year ago
|
||
And to add, this is a change that we should do upstream in the wpt repository to see if other vendors don't have issues with it. Then we wait for the downstream sync for follow-up work.
| Reporter | ||
Comment 14•1 year ago
|
||
I opened a PR on the upstream wpt repository: https://github.com/web-platform-tests/wpt/pull/52776
| Reporter | ||
Comment 15•1 year ago
|
||
Jonathan, based on the following test results for Nightly stability there are more tests that use the Ahem font and do not wait for it to be loaded and are failing. Mind having a look? Thanks.
| Reporter | ||
Updated•1 year ago
|
| Assignee | ||
Comment 16•1 year ago
|
||
Which tests are you concerned about exactly? In the results there, I see two /css-page/monolithic-overflow-*-print.html tests are reported as being "slow", though not actually failing. Those are print tests, which means it's not surprising they're quite slow, and I guess loading Ahem as a webfont rather than via src:local() would make them a little slower than before, although it shouldn't be very much different.
It looks like WPT has a <meta name="timeout" content="long"> tag; does adding that to these test files stop the harness complaining?
Was there anything else raising concerns? Those "slow test" warnings were all I noticed, and they're not actually failures AFAICS.
| Reporter | ||
Comment 17•1 year ago
|
||
You need to further scroll down to actual test results. The following tests have failures:
- /soft-navigation-heuristics/softnav-after-lcp-paint-larger-than-viewport.tentative.html
- /soft-navigation-heuristics/softnav-after-lcp-paint.tentative.html
- /soft-navigation-heuristics/softnav-before-lcp-paint.tentative.html
- /soft-navigation-heuristics/softnav-between-lcp-render-and-paint.tentative.html
- /svg/interact/scripted/svg-pointer-events-bbox.html
- /svg/struct/scripted/svg-getIntersectionList-001.svg
- /svg/text/scripted/getcharnumatposition-slr.tentative.html
- /svg/text/scripted/getstartpositionofchar.html
- /svg/text/scripted/textpath-textlength-text-anchor-001.tentative.svg
| Assignee | ||
Comment 18•1 year ago
|
||
Aren't those pre-existing timeouts/failures, though? There appear to be corresponding .ini files in mozilla-central under /testing/web-platform/meta/ showing that they're expected issues.
Comment 19•1 year ago
|
||
The severity field is not set for this bug.
:jgraham, could you have a look please?
For more information, please visit BugBot documentation.
Updated•1 year ago
|
| Reporter | ||
Comment 20•1 year ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #18)
Aren't those pre-existing timeouts/failures, though? There appear to be corresponding .ini files in mozilla-central under /testing/web-platform/meta/ showing that they're expected issues.
Ok, so we probably have to check the actual stability results upstream which compares the results to main:
- Firefox: https://github.com/web-platform-tests/wpt/pull/52776/checks?check_run_id=42904792543
- Chrome: https://github.com/web-platform-tests/wpt/pull/52776/checks?check_run_id=42904792472
As it can be seen a couple of tests seem to fail now. Would you have a chance to check if those are valid?
Interesting is that /svg/text/scripted/getstartpositionofchar.html is not listed there. It also started to fail for Chrome (logs) when we remove local() for the Ahem font. For us it's expected to fail at the moment, but not sure what the right behavior is here.
| Assignee | ||
Comment 21•1 year ago
|
||
Try run with patches that aim to address the issues in comment 20:
https://treeherder.mozilla.org/jobs?repo=try&revision=445e95306962e26662346c5a6289f9bd66f299c9
If this looks good, we can take it to a WPT PR for further testing.
| Assignee | ||
Comment 22•1 year ago
|
||
Let's see how this goes: https://github.com/web-platform-tests/wpt/pull/53444
| Assignee | ||
Comment 23•1 year ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #22)
Let's see how this goes: https://github.com/web-platform-tests/wpt/pull/53444
This PR has now merged upstream, so once that is sync'd back to our tree, I think it should be possible to proceed with disabling the local Ahem installation.
| Reporter | ||
Comment 24•1 year ago
|
||
That's great to see Jonathan! The downstream sync will actually happen via bug 1976337.
| Reporter | ||
Comment 25•1 year ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #23)
Let's see how this goes: https://github.com/web-platform-tests/wpt/pull/53444
This PR has now merged upstream, so once that is sync'd back to our tree, I think it should be possible to proceed with disabling the local Ahem installation.
There were issues reported by Chrome in their own CI and they requested a backout of the PR via https://github.com/web-platform-tests/wpt/pull/53716. But so far no further reply from their side. So maybe we should still wait a bit before continuing on this bug?
| Assignee | ||
Comment 26•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 27•1 year ago
|
||
Eventually we might want to completely remove the font-installation code, but for now I suggest just changing the default we use. The above patch gives me very much quicker ./mach wpt startup locally, and tryserver logs show that we're passing --no-install-fonts so I assume it's working there as well.
Comment 28•1 year ago
|
||
| Reporter | ||
Comment 29•1 year ago
|
||
I filed bug 1977796 as follow-up to get the font installation (uninstallation) code removed.
Comment 30•1 year ago
|
||
Comment 32•1 year ago
|
||
Comment 33•1 year ago
|
||
Reverted this because it was causing wpt failures in ahem.html.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | /infrastructure/assumptions/ahem.html | Testing http://web-platform.test:8000/infrastructure/assumptions/ahem.html != http://web-platform.test:8000/infrastructure/assumptions/ahem-notref.html
| Assignee | ||
Updated•1 year ago
|
Comment 34•1 year ago
|
||
Comment 36•1 year ago
|
||
| bugherder | ||
Description
•