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

Page crash in Puppeteer >= 2.6.0 #16243

Closed
3 tasks done
LegitTrevorTiernan opened this issue Nov 5, 2024 · 6 comments
Closed
3 tasks done

Page crash in Puppeteer >= 2.6.0 #16243

LegitTrevorTiernan opened this issue Nov 5, 2024 · 6 comments

Comments

@LegitTrevorTiernan
Copy link

LegitTrevorTiernan commented Nov 5, 2024

FAQ

URL

cnn.com

What happened?

I was attempting to use puppeteer 23.6.0+ and the latest lighthouse 12.2.1
I ran into an issue where I was getting

page errored! Error: Page crashed!
--
  | 2024-11-05T19:15:18.618Z | at #onTargetCrashed (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:384:50)

If I do not run lighthouse, the process is ok with Puppeteer 2.7.0. Although this error does not happen with lighthouse if puppeteer < 23.6.0.
When I did a deeper debug, I got an error similar to
https://stackoverflow.com/questions/49386692/aw-snap-and-asr-no-room-in-socket-buffer-errors-in-chrome
However, I'm using the flag. "--disable-dev-shm-usage",

What did you expect?

I expected the lighthouse audit to complete correctly without a puppeteer page crash.

What have you tried?

I tried running the process without lighthouse, and it worked.
I also tried running with an earlier version of Puppeteer, which did work with a lighthouse.

How were you running Lighthouse?

node

Lighthouse Version

12.2.1

Chrome Version

130.0.6723.58+

Node Version

20

OS

Linux (Amazon ECS task)

Relevant log output

Page errored! Error: Page crashed!
2024-11-05T19:46:33.223Z
at #onTargetCrashed (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:379:50)
2024-11-05T19:46:33.223Z
at /node_modules/puppeteer-core/lib/cjs/third_party/mitt/mitt.js:62:7
2024-11-05T19:46:33.223Z
at Array.map (<anonymous>)
2024-11-05T19:46:33.223Z
at Object.emit (/node_modules/puppeteer-core/lib/cjs/third_party/mitt/mitt.js:61:20)
2024-11-05T19:46:33.223Z
at CdpCDPSession.emit (/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:83:23)
2024-11-05T19:46:33.223Z
at CdpCDPSession._onMessage (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:82:18)
2024-11-05T19:46:33.223Z
at Connection.onMessage (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:143:25)
2024-11-05T19:46:33.223Z
at WebSocket.<anonymous> (/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js:44:32)
2024-11-05T19:46:33.223Z
at callListener (/node_modules/ws/lib/event-target.js:290:14)
2024-11-05T19:46:33.223Z
at WebSocket.onMessage (/node_modules/ws/lib/event-target.js:209:9)

Error! TargetCloseError: Protocol error (Emulation.setTouchEmulationEnabled): Target closed
at CallbackRegistry.clear (/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:73:36)
at CdpCDPSession._onClosed (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:101:25)
at #onClose (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:167:21)
at WebSocket.<anonymous> (/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js:49:30)
at callListener (/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onClose (/node_modules/ws/lib/event-target.js:220:9)
at WebSocket.emit (node:events:519:28)
at WebSocket.emitClose (/node_modules/ws/lib/websocket.js:272:10)
at Socket.socketOnClose (/node_modules/ws/lib/websocket.js:1341:15)
at Socket.emit (node:events:519:28) {
cause: ProtocolError
at <instance_members_initializer> (/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:94:14)
at new Callback (/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:98:16)
at CallbackRegistry.create (/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:23:26)
at Connection._rawSend (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:90:26)
at CdpCDPSession.send (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33)
at next (/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:34:41)
at CdpCDPSession.send (/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:67:18)
at #applyViewport (/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/EmulationManager.js:147:32)
at EmulatedState.<anonymous> (/node_modules/puppeteer-core/lib/cjs/puppeteer/util/decorators.js:154:23)
at /node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/EmulationManager.js:69:33
}
content types: text/html video/mp4
TargetCloseError: Protocol error (Emulation.setTouchEmulationEnabled): Target closed
@adamraine
Copy link
Member

Can you please provide a minimum script or other repro steps for this issue

@LegitTrevorTiernan
Copy link
Author

LegitTrevorTiernan commented Nov 19, 2024

Sorry it took so long. The bug presented in propriety code, and I needed to create a minimal example.
minimal.txt
package.json

@LegitTrevorTiernan
Copy link
Author

I was researching Chrome and Chromium and stumbled upon more information about this bug.
The bug is reproducible using Puppeteer 23.5.3 IF you do not use the built-in Chrome (which does not crash) but instead specify an executable path to a later Chrome (in my case, chrome for Mac 131).

@LegitTrevorTiernan
Copy link
Author

Well, I just installed Chromium (133) via homebrew on my Mac and no crash there, either.
Maybe this is a chrome issue?

  "devDependencies": {
    "lighthouse": "12.2.2",
    "puppeteer": "23.9.0"
  },

@adamraine
Copy link
Member

Yeah I can reproduce this on 132.0.6834.57 but not 133.0.6907.0. This looks like a Chrome bug that was fixed recently, I will see if I can confirm anything.

@adamraine
Copy link
Member

adamraine commented Dec 20, 2024

Ok I did some bisecting and I think I found the patch which fixed it:
https://chromium.googlesource.com/chromium/src/+/f4b301d60033d304154df5a7e29afcb2edc76464

For posterity, this was my bisect range:
https://chromium.googlesource.com/chromium/src/+log/79360f3352eefb2cffac8bc0b76f998e6f653927..b8eb04c97a626785ca4b1c7193b59b8dfd09a05c

Since this appears to be fixed in the latest Chrome I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants