title: puppeteer/chromium: handle crashing memory-heavy pages?
body: <p>I have the following code:</p>
  
  <pre><code>puppeteer.launch().then(async browser =&gt; {
      for (let id of ids) {
          try {
              const page = await browser.newPage();
              //const url = 'chrome://crash';
              await page.goto(url + id)
              await page.waitFor(5000);
              await page.screenshot({
                  path: path.join(__dirname, "../public/images/screenshots/" + id + ".png"),
                  clip: { x: 10, y: 70, width: 780, height: 470}
              });
          } catch (error) {
              console.log('Exception', id, error.message);
              page.close();
          }
      };
      browser.close();
  });
  </code></pre>
  
  <p>It generally works OK but I'm having problems with a particular page (with a URL that unfortunately I can't share). </p>
  
  <p>This page tries to load a GB of data and causes Chrome to crash, so I guess it's causing Chromium to crash too. </p>
  
  <p>The error I see from this page is: <code>Exception 6766 Navigation Timeout Exceeded: 30000ms exceeded</code>. This is fine, but it doesn't seem to stop at this point - it causes my whole server to hang, I guess because it's trying to use too much memory at the OS level. </p>
  
  <p>How can I stop my server from hanging and handle this gracefully? Are there flags I can provide to Chromium to limit the memory used and give up gracefully? I'm also not sure my error handling as a whole is correct, so any tips would be appreciated. </p>