Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol: [Performance] Fix font request flooding #28215

Closed
ryanthemanuel opened this issue Nov 1, 2023 · 8 comments · Fixed by #28217
Closed

Protocol: [Performance] Fix font request flooding #28215

ryanthemanuel opened this issue Nov 1, 2023 · 8 comments · Fixed by #28217
Assignees

Comments

@ryanthemanuel
Copy link
Collaborator

ryanthemanuel commented Nov 1, 2023

We are seeing issues where fonts flood as a result of various things that are either done by an application or by Cypress.

Chrome has some behavior that triggers reloading of in-memory font assets when global style sheets are updated. This has the effect of triggering all font requests to reload. Even though they are in-memory, this produces a flood of CDP events which backs up proxy correlations and bloats the test replay data being captured.

We can fix this by ensuring that the in memory cache is only used in a given context via the ScopeMemoryCachePerContext feature. This will ensure that the resource is in a local cache and it won't replay the CDP events (https://github.com/chromium/chromium/blob/118.0.5993.117/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc#L2650-L2652).

Note that we initially tried to fix this issue via #27860 when we thought it was something that Cypress was inherently doing as part of actionability. This did not resolve the issue as frameworks in the apps themselves can be causing the problem as well. As a result as a part of fixing this, we should undo: #27860

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Nov 8, 2023

Released in 13.5.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.5.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Nov 8, 2023
@ryanthemanuel
Copy link
Collaborator Author

ryanthemanuel commented Nov 15, 2023

Reopening this since we had to revert the change. More to come on the plan going forward with this.

@ryanthemanuel ryanthemanuel reopened this Nov 15, 2023
@ryanthemanuel
Copy link
Collaborator Author

ryanthemanuel commented Nov 15, 2023

We are fairly sure that this is a chromium bug at this point and there is no way we can globally work around it without causing performance problems elsewhere. I logged: https://bugs.chromium.org/p/chromium/issues/detail?id=1502591 to start the conversation with the chromium team to see if we can get it resolved.

@ryanthemanuel
Copy link
Collaborator Author

If this issue is particularly bad in a project, one potential workaround would be to add --enable-features=ScopeMemoryCachePerContext to the chrome/electron browser launch arguments: https://docs.cypress.io/api/plugins/browser-launch-api#Usage

@Narretz
Copy link
Contributor

Narretz commented Jan 10, 2024

We are fairly sure that this is a chromium bug at this point and there is no way we can globally work around it without causing performance problems elsewhere. I logged: https://bugs.chromium.org/p/chromium/issues/detail?id=1502591 to start the conversation with the chromium team to see if we can get it resolved.

So was this fixed in Chrome? The ticket is closed as wontfix: https://bugs.chromium.org/p/chromium/issues/detail?id=1502591 but there's also a commit with a fix.

@ryanthemanuel
Copy link
Collaborator Author

We are fairly sure that this is a chromium bug at this point and there is no way we can globally work around it without causing performance problems elsewhere. I logged: bugs.chromium.org/p/chromium/issues/detail?id=1502591 to start the conversation with the chromium team to see if we can get it resolved.

So was this fixed in Chrome? The ticket is closed as wontfix: bugs.chromium.org/p/chromium/issues/detail?id=1502591 but there's also a commit with a fix.

This was fixed on version 121.0.6157.0 of Chrome. I'm not sure why it got marked as wontfix, but I'll try and see if I can get that corrected.

@jennifer-shehane
Copy link
Member

Chrome has began rolling out 121 today as stable, so users should see this fixed when using the newer version of Chrome: https://chromereleases.googleblog.com/2024/01/stable-channel-update-for-desktop_23.html

We're updating Electron so that it will include this fix also.

@jennifer-shehane
Copy link
Member

Closing since this is released in Chrome 121 and also included in Cypress 13.6.5+ with our included Electron browser.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Feb 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants