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 error - Target closed: puppeteer stopped working. #7455

Closed
ishfx opened this issue Aug 2, 2021 · 9 comments
Closed

Protocol error - Target closed: puppeteer stopped working. #7455

ishfx opened this issue Aug 2, 2021 · 9 comments

Comments

@ishfx
Copy link

ishfx commented Aug 2, 2021

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 10.1.0
  • Platform / OS version: Arch Linux x86_64 5.13.6-arch1-1
  • URLs (if applicable):
  • Node.js version: v16.6.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

  1. mkdir -p /tmp/test-p && cd /tmp/test-p
  2. yarn init (default for all options)
  3. yarn add puppeteer
  4. vim ./index.js then copy/paste/save the first code example in the readme:
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'example.png' });

  await browser.close();
})();
  1. node ./index.js

What is the expected result?
No error and a screenshot.

What happens instead?

/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:217
            this._callbacks.set(id, { resolve, reject, error: new Error(), method });
                                                              ^

Error: Protocol error (Page.navigate): Target closed.
    at /tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:217:63
    at new Promise (<anonymous>)
    at CDPSession.send (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:216:16)
    at navigate (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:108:47)
    at FrameManager.navigateFrame (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:91:13)
    at Frame.goto (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:416:41)
    at Page.goto (/tmp/test-p/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1133:53)
    at /tmp/test-p/index.js:6:14
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Additional information
I've been using puppeteer for months without any issue. Earlier, I tried to run one of my scripts but I got the error above. I tried to narrow the problem and found out that it still happens even with a fresh install and a simple code.

Whats the root cause of this error ? Am i doing something wrong ? Needless to say that i didn't find any answer in google/SO/etc.

Thanks in advance!

@kami4ka
Copy link

kami4ka commented Aug 3, 2021

The same for me.
Possible relations for this bug:
#7407
#7318
#7225
#3423

And many more, see: #6610 (comment)

@schlaegerz
Copy link

schlaegerz commented Aug 13, 2021

We are seeing this same issue on one of our dev's boxes. The exact same setup works fine on every other device we have including on ubuntu docker on circle ci.

So this is specifically a Arch linux problem from what we can tell. None of the other bugs that I find seem to be relevant since the OS isn't quite the same.

It would be helpful if someone had some setup instruction for Arch linux, as we can't exactly figure out if we are missing some setup step or something.

if we enable dumpio on the chrome launch we get this


Gtk-Message: 15:46:40.036: Failed to load module "colorreload-gtk-module"
Gtk-Message: 15:46:40.036: Failed to load module "window-decorations-gtk-module"
DevTools listening on ws://127.0.0.1:36091/devtools/browser/2fee76ca-1e40-4895-90b7-11722f454b5b
Received signal 11 SEGV_MAPERR 00000000101e
#0 0x55b3dd7f8f49 Received signal 11 SEGV_MAPERR 00000000101e
#0 0x55b3dd7f8f49 base::debug::CollectStackTrace()
#1 0x55b3dd762933 Received signal 6
#0 0x55b3dd7f8f49 base::debug::CollectStackTrace()
#1 0x55b3dd762933 base::debug::CollectStackTrace()
#1 0x55b3dd762933 base::debug::StackTrace::StackTrace()
#2 0x55b3dd7f8a21 base::debug::StackTrace::StackTrace()
#2 0x55b3dd7f8a21 base::debug::StackTrace::StackTrace()
#2 0x55b3dd7f8a21 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f5929f77870 (/usr/lib/libpthread-2.33.so+0x1386f)
#4 0x55b3dd814e82 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f5929f77870 (/usr/lib/libpthread-2.33.so+0x1386f)
#4 0x55b3dd814e82 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f5929f77870 (/usr/lib/libpthread-2.33.so+0x1386f)
#4 0x7f592911cd22 __GI_raise
#5 0x7f5929106862 __GI_abort
#6 0x55b3dd7f7cb5 base::internal::PartitionGetSizeEstimate()
#5 0x7f5914907337 <unknown>
#6 0x7f59148fed4e <unknown>
#7 0x7f59291c799e gaih_inet.constprop.0
#8 0x7f59291c8899 __GI_getaddrinfo
#9 0x55b3da2b4605 net::AddrInfoGetter::getaddrinfo()
#10 0x55b3da2b4171 net::AddressInfo::Get()
#11 0x55b3da2e2846 net::SystemHostResolverCall()
#12 0x55b3da2da32d net::HostResolverManager::ProcTask::DoLookup()
#13 0x55b3da2da76b base::internal::Invoker<>::RunOnce()
#14 0x55b3dd7bbb13 base::debug::BreakDebugger()
#7 0x55b3dd7f852d base::TaskAnnotator::RunTask()
#15 0x55b3dd7d2947 base::internal::PartitionGetSizeEstimate()
#5 0x7f5914907337 <unknown>
#6 0x7f59148fed4e <unknown>
#7 0x7f59291c799e gaih_inet.constprop.0
#8 0x7f59291c8899 __GI_getaddrinfo
#9 0x55b3da2b4605 net::AddrInfoGetter::getaddrinfo()
#10 0x55b3da2b4171 net::AddressInfo::Get()
#11 0x55b3da2e2846 net::SystemHostResolverCall()
#12 0x55b3da2da32d net::HostResolverManager::ProcTask::DoLookup()
#13 0x55b3da2da76b base::internal::Invoker<>::RunOnce()
#14 0x55b3dd7bbb13 base::internal::TaskTracker::RunContinueOnShutdown()
#16 0x55b3dd7d2485 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#8 0x7f5929f77870 (/usr/lib/libpthread-2.33.so+0x1386f)
#9 0x55b3dd814e82 base::TaskAnnotator::RunTask()
#15 0x55b3dd7d2947 base::internal::TaskTracker::RunTask()
#17 0x55b3dd80944e base::internal::PartitionGetSizeEstimate()
#10 0x7f5914907337 <unknown>
#11 0x7f59148fed4e <unknown>
#12 0x7f59291c799e gaih_inet.constprop.0
#13 0x7f59291c8899 __GI_getaddrinfo
#14 0x55b3da2b4605 net::AddrInfoGetter::getaddrinfo()
#15 0x55b3da2b4171 net::AddressInfo::Get()
#16 0x55b3da2e2846 net::SystemHostResolverCall()
#17 0x55b3da2da32d net::HostResolverManager::ProcTask::DoLookup()
#18 0x55b3da2da76b base::internal::Invoker<>::RunOnce()
#19 0x55b3dd7bbb13   Test Cura worker
base::internal::TaskTracker::RunContinueOnShutdown()
#16 0x55b3dd7d2485 base::internal::TaskTrackerPosix::RunTask()
#18 0x55b3dd7d2118 base::internal::TaskTracker::RunTask()
#17 0x55b3dd80944e base::TaskAnnotator::RunTask()
#20 0x55b3dd7d2947 base::internal::TaskTracker::RunAndPopNextTask()
#19 0x55b3dd7ddcba base::internal::TaskTrackerPosix::RunTask()
#18 0x55b3dd7d2118 base::internal::TaskTracker::RunContinueOnShutdown()
#21 0x55b3dd7d2485 base::internal::WorkerThread::RunWorker()
#20 0x55b3dd7dd99d base::internal::TaskTracker::RunAndPopNextTask()
#19 0x55b3dd7ddcba base::internal::TaskTracker::RunTask()
#22 0x55b3dd80944e base::internal::WorkerThread::RunPooledWorker()
#21 0x55b3dd809c9c base::internal::WorkerThread::RunWorker()
#20 0x55b3dd7dd99d base::internal::TaskTrackerPosix::RunTask()
#23 0x55b3dd7d2118 base::(anonymous namespace)::ThreadFunc()
#22 0x7f5929f6d259 start_thread
#23 0x7f59291de5e3 __GI___clone
  r8: 0000000000000000  r9: 0000000000000000 r10: 00007ffc48112080 r11: 00007ffc48112090
 r12: 0000000000000000 r13: 0000000000000000 r14: 00007f591bdb56f0 r15: 0000244800fd3b80
  di: 000055b3e2c3c7f8  si: 0000000000000000  bp: 00007f591bdb5600  bx: 0000000000000000
  dx: 0000000000000000  ax: 0000000000001000  cx: 0000000000000000  sp: 00007f591bdb5600
  ip: 000055b3dd814e82 efl: 0000000000010206 cgf: 002b000000000033 erf: 0000000000000004
 trp: 000000000000000e msk: 000000001e493a01 cr2: 000000000000101e

@marcelarie
Copy link

marcelarie commented Sep 1, 2021

I fixed this downgrading to 7.0.1.

@MunyuShizumi
Copy link

MunyuShizumi commented Sep 15, 2021

Exact same issue here with Puppeteer v10.2.0, v9.1.1, v8.0.0 & Node v16.9.1, v14.17.4.
Downgrading to Puppeteer v7.1.0 resolves the issue, so it's something introduced between v7.1.0 and v8.0.0.

Technically, it's not a Page.goto() issue, ChromeLauncher.launch() will also fail on its own half a second later:

Error: Protocol error (Target.setDiscoverTargets): Target closed.
    at /home/shizumi/puppeteer-test/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:71:63
    at new Promise (<anonymous>)
    at Connection.send (/home/shizumi/puppeteer-test/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:70:16)
    at Function.create (/home/shizumi/puppeteer-test/node_modules/puppeteer/lib/cjs/puppeteer/common/Browser.js:117:26)
    at ChromeLauncher.launch (/home/shizumi/puppeteer-test/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:109:56)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /home/shizumi/puppeteer-test/example.js:4:18

All Chromium dependencies installed, using Brave as a daily browser without issues.

@mariusa
Copy link

mariusa commented Oct 13, 2021

Same issue on Fedora 35 (node 16). Same solution as @MunyuShizumi

@bodinsamuel
Copy link
Contributor

Same issue CircleCI Node 16.13.0 (cimg/node:16.13.0).
Happening when fetching the browser, with puppeteer-core: 11.0.0

Downloaded Chromium rev 901912
Unhandled rejection
ProtocolError: Protocol error (Target.setDiscoverTargets): Target closed.
    at /home/circleci/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:75:24
    at new Promise (<anonymous>)
    at Connection.send (/home/circleci/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:71:16)
    at Function.create (/home/circleci/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js:121:26)
    at ChromeLauncher.launch (/home/circleci/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js:117:56)
    at async Browser.create (/home/circleci/app/dist/lib/browser/Browser.js:50:25)
    at async TasksManager.launch (/home/circleci/app/dist/lib/TasksManager.js:54:9) {
  originalMessage: undefined
}

@trygveaa
Copy link

trygveaa commented Feb 1, 2022

This is fixed for me in puppeteer >= 12.0.0.

@marcelarie
Copy link

I'm using puppeteer@13.0.1 with no problems now.

trygveaa added a commit to trygveaa/aws-azure-login that referenced this issue Feb 1, 2022
puppeteer v10.x is broken in Arch Linux[0], so upgrade to the most
recent version to fix it.

[0]: puppeteer/puppeteer#7455
trygveaa added a commit to trygveaa/aws-azure-login that referenced this issue Feb 1, 2022
puppeteer v10.x is broken on Arch Linux[0], so upgrade to the most
recent version to fix it.

[0]: puppeteer/puppeteer#7455
@ishfx
Copy link
Author

ishfx commented Feb 14, 2022

I'm closing this issue for now since the problem seems to be fixed in the latest versions.

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

No branches or pull requests

8 participants