puppeteer: Request interception hanging forever
Steps to reproduce
Tell us about your environment:
- Puppeteer version: 10.2.0
- Platform / OS version: macOS Big Sur 11.5
- URLs (if applicable): https://login.tonies.com/legals/terms-of-service
- Node.js version: 16.6.1
What steps will reproduce the problem?
The issue can be reproduced with the following snippet:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
page.on('request', request => request.continue());
await page.setRequestInterception(true);
await page.goto('https://login.tonies.com/legals/terms-of-service');
console.log('SUCCESS');
await browser.close();
})();
- Run above snippet -> never prints “SUCCESS”
Note: When run in headful mode via devtools: true
it fails not as consistently anymore, but still fails from time to time.
From the past hours debugging this, it seems to be caused by a font-face request pending forever. This issue seems similar to #6696 .
What is the expected result?
Requests should not hang.
What happens instead?
A request for a font never resolves, which leads to the load
event never being fired. This leads to puppeteer throwing a timeout error.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 40 (17 by maintainers)
Commits related to this issue
- fix: handle multiple/duplicate Fetch.requestPaused events (#7802) Issues: #7475, #6696, #7225 — committed to puppeteer/puppeteer by benallfree 3 years ago
- Disable WebFontsCacheAwareTimeoutAdaption (#196) font request interception caching might trigger a double requestPaused CDP event which triggers "request" Puppeteer event to be emitted twice which... — committed to alwaysmeticulous/meticulous-sdk by alexivanov 2 years ago
I still see this issue with latest, v19.8.3
Not stale, because I’m waiting for response from @benallfree 😃
This issue doesn’t occur when caching is disabled via
await page.setCacheEnabled(false);
.Ah, it seems like there is a corresponding CR bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1196004 . The mentioned
--disable-feature=WebFontsCacheAwareTimeoutAdaption
flag doesn’t workaround this problem for me though. Only disabling caching does.Just encountered this issue with:
Pptr: 20.8.0 Chrome: 114.0.5735.133
Using waitForRequest() works, the correct url is being intercepted and the intercepted request is paused and is interactable. So, the request is being intercepted properly and postData is being overriden properly on
await request.continue({postData: postData});
And the actual request is sent, but the browser hangs after sending the request, even though a redirect is to be expected, no redirect occurs. When checking the backend the data is there, its just chrome that hangs when continuing the request.Edit: Maybe using the Fetch Domain directly can be a workaround for this issue?
edit2:
It is! Interception and continuation do work properly using the Fetch Domain. With the version Im using, at least.
I am not able to repro https://github.com/puppeteer/puppeteer/issues/7475#issuecomment-1124905216 with v20.2.1
So it seems only the repro from https://github.com/puppeteer/puppeteer/issues/7475#issuecomment-1124905216 is reproducible with the current version of Puppeteer. It does look like another instance of double pause events sent by the backend. It does not lead to indefinite hanging for page.goto though.
I can confirm the problem persists.
Issue still reproduces consistently on my end with puppeteer v13.0.1 while working fine when reverted back to v10.1.0 It’s probably got something to do with the puppeteer-extra module and its plugins.
I have a PR started to address this issue. Please test it if you can https://github.com/puppeteer/puppeteer/pull/7802.
@atikenny I confirm the same thing exactly. @razorman8669 Definitely not related to #6735.
According to
git bisect
:Bad commit: https://github.com/puppeteer/puppeteer/commit/f863f4bfe015e57ea1f9fbb322f1cedee468b857 Previous commit (good): https://github.com/puppeteer/puppeteer/commit/2c9ff4feafdad31120aa25c30f03ea4c84a88857
Changing from Chromium
869685
to884014
is the culprit.All you have to do in https://github.com/puppeteer/puppeteer/commit/f863f4bfe015e57ea1f9fbb322f1cedee468b857 is update
./src/revisions.ts
back to869685
and it works again.@jschfflr This one comes from #7288, any thoughts?