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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Page Crashed, throw an error, not stuck any more. #485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

manooog
Copy link

@manooog manooog commented Sep 8, 2022

馃憦 Your code help me a lot,but I have some pain points with the Page Crashed Error.

When I open a page and do a lot of work,which take long long time(and I set timeout to the max value),then I would see the Page Crashed Error:

image

At this time,program stuck,and I can not do anything else.So I changed some code,when page crashed again,just reject~

image

I have a demo below,just take a try:

const { Cluster } = require('puppeteer-cluster');

(async () => {
  const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_CONTEXT,
    maxConcurrency: 2,
    timeout: 2147483647, // 32-bits max number
  });

  await cluster.task(async ({ page, data: url }) => {
    await page.goto(url);
    await page.evaluate(() => {
        txt = "a";
        while(1){
            txt = txt += "a";    //add as much as the browser can handle
        }
      })
  });

  cluster.queue('http://www.google.com/');

  await cluster.idle();
  await cluster.close();
})();

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

Successfully merging this pull request may close these issues.

None yet

1 participant