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

Pages not loading, screenshots empty. DumpIO Error: Lost UI shared context #1828

Closed
webdevian opened this issue Jan 17, 2018 · 27 comments
Closed

Comments

@webdevian
Copy link

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.0.0
  • Platform / OS version: Ubuntu 16.04
  • URLs (if applicable): google.com
  • Node.js version: 8.9.4

What steps will reproduce the problem?

Please include code that reproduces the issue.

const puppeteer = require('puppeteer');

(async() => {

const browser = await puppeteer.launch({dumpio: true});
const page = await browser.newPage();

page.on('load', () => console.log('Loaded: ' + page.url()))

await page.goto('https://google.com');
await page.screenshot({path: 'example.png'});

browser.close();
})();

Console output:

[0117/125830.649194:ERROR:gpu_process_transport_factory.cc(1043)] Lost UI shared context.

DevTools listening on ws://127.0.0.1:37429/devtools/browser/1f0b2bf7-dfdd-44ac-9da7-f2659d352f0d
Loaded: chrome-error://chromewebdata/

What is the expected result?
Screenshot of google homepage generated. (I can curl google fine from the machine)

What happens instead?

Blank white screenshot generated.

@bahattincinic
Copy link

I tried same code on my local machine (MacBook Pro). it worked.

Console Output:

bash-3.2$  nodeenv --node=8.9.4 test
bash-3.2$ touch a.js
bash-3.2$ vim a.js
bash-3.2$ node a.js
[0117/181928.011265:ERROR:gpu_process_transport_factory.cc(1043)] Lost UI shared context.

DevTools listening on ws://127.0.0.1:54269/devtools/browser/32cbf9f0-5540-4c79-b071-1881f049237e
Loaded: https://www.google.com.tr/?gfe_rd=cr&dcr=0&ei=gGlfWtGhGMrCXtbfmcgE

@webdevian
Copy link
Author

Yes it works fine on my Mac too

@bahattincinic
Copy link

bahattincinic commented Jan 17, 2018

Can you test with --no-sandbox and --disable-setuid-sandbox flags

const puppeteer = require('puppeteer');
(async() => {
  const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
  const page = await browser.newPage();
  await page.goto('https://google.com');
  await page.screenshot({path: 'example.png'});
  browser.close();
})();

@webdevian
Copy link
Author

Still a blank screenshot (And no console output because dumpio is turned off)

@webdevian
Copy link
Author

Puppeteer (0.13.0) was working working ok a couple of weeks ago. Since then all I've done is reboot the machine and it stopped working. I upgraded to 1.0.0 to see if that worked but it hasn't made any difference.

Loaded: chrome-error://chromewebdata/ is a hint, it seems like chromium is forwarding all requests to there before they even get a chance to load from the web.

@bahattincinic
Copy link

Puppeteer upgraded chrome version to 65.0.3312.0 (r526987) in the 1.0.0 version. (https://github.com/GoogleChrome/puppeteer/releases/tag/v1.0.0)

Maybe it's related to #290 issue.

@webdevian
Copy link
Author

I did see that issue when I was searching but it's weird that there's no error message to say that chromium can't be started.

I checked the list of dependencies and they are all installed

@webdevian
Copy link
Author

When I run node_modules/puppeteer/.local-chromium/linux-526987/chrome-linux/chrome_sandbox -v --no-sandbox --disable-setuid-sandbox

it returns:

The setuid sandbox provides API version 1, but you need 0
Please read https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md.

The setuid sandbox is not running as root. Common causes:
  * An unprivileged process using ptrace on it, like a debugger.
  * A parent process set prctl(PR_SET_NO_NEW_PRIVS, ...)
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted

@webdevian
Copy link
Author

When I run node_modules/puppeteer/.local-chromium/linux-526987/chrome-linux/chrome -v --no-sandbox --disable-setuid-sandbox

it returns:

[0117/162822.358484:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

@ebidel
Copy link
Contributor

ebidel commented Jan 17, 2018

@webdevian #1464 (comment) related?

@webdevian
Copy link
Author

@ebidel I don't think so, I'm not doing anything with python (or proxy chains as far as I am aware)

@grebmeg
Copy link

grebmeg commented Jan 24, 2018

I have the same issue (screenshots empty) but after working node app for a 2-3 days (everything is ok before this term) and I don't understand why this happening...

@zekenie
Copy link

zekenie commented Jan 31, 2018

I'm having a similar issue. I'm generating PDFs on Heroku. It works great on my mac, but on Heroku it doesn't.

const db = require('APP/db/_db');
const { NotFound } = require('../errors');
const { asyncMiddleware } = require('../utils');
const puppeteer = require('puppeteer');

const generatePDF = asyncMiddleware(async (req, res) => {
  const browser = await puppeteer.launch({
    dumpio: true,
    headless: true,
    args: ['--disable-gpu', '--no-sandbox', '--disable-setuid-sandbox']
  });
  const page = await browser.newPage();
  await page.setViewport({
    width: 1600,
    height: 1200,
  });
  page.on('error', err => {
    console.error('err', err, err.stack)
    browser.close();
  });
  await page.goto(`data:text/html,${req.body.html}`, {
    waitUntil: 'networkidle2',
  });
  // await page.setContent(req.body.html);
  // this is to make sure css, etc loads
  await page.waitFor(6000);
  const pdf = await page.pdf();
  res.set('content-type', 'application/pdf');
  await browser.close();
  res.send(pdf);
});

module.exports = require('express')
  .Router()
  .post('/', generatePDF)

My stdout is:

2018-01-31T04:17:10.588975+00:00 app[web.1]: [0131/041710.587842:ERROR:gpu_process_transport_factory.cc(1043)] Lost UI shared context.
2018-01-31T04:17:10.606847+00:00 app[web.1]:
2018-01-31T04:17:10.606852+00:00 app[web.1]: DevTools listening on ws://127.0.0.1:41458/devtools/browser/178f5e54-63f3-4eb2-82cf-5b4ec97a5ffe

@fractalawareness
Copy link

fractalawareness commented Mar 1, 2018

I have the excact same issue on v1.0.0 and v1.1.1 versions while v0.10.2 was working very well. I'm on AWS Lambda, Node 6.10 (using this https://github.com/sambaiz/puppeteer-lambda-starter-kit). But it works fine on my local machine.

Also I've noticed that even if I use --disable-gpu parameter it still complains about missing libosmesa (this is not present in v0.10.2).

@rg1220
Copy link

rg1220 commented Mar 16, 2018

I'm also seeing the Lost UI shared context issue on both MacOS and Ubuntu. I've tried the args '--'disable-gpu', '--no-sandbox', '--disable-setuid-sandbox' and that hasn't worked nor has it changed the error.

Weirdly, I do get console information about the page loading but it just seems detached from puppeteer.

Has anyone figured out a work around - or a docker container that does indeed work?

@Pirozek
Copy link

Pirozek commented Mar 19, 2018

Having the same issue, working on Mac, but on Debian production server it return blank pages "sometimes". When I try to screenshot the same page 5 times in a row, there are like 2-3 screenshots missing, and rest is ok, but everything return Lost UI shared context error

@rg1220
Copy link

rg1220 commented Mar 20, 2018

For the record I am still seeing Lost UI shared context error however it doesn't appear to be causing the blank screen for me. My issue was that my User Agent appears to change between non-headless and headless mode. The site I was interacting with wouldn't render unless the User Agent was "valid".

@QuentinWangWJJ
Copy link

same issue running on iis

@xdumaine
Copy link

FWIW, I'm getting this too, using Testem with raw chromium, not with Puppeteer, so I think it's a problem with the version of Chrome that is used with the latest puppeteer.

@xdumaine
Copy link

Maybe related: #1925

@coffebar
Copy link

coffebar commented May 17, 2018

I have the same error message when trying to start headless chrome from linux terminal:
/opt/google/chrome/chrome --headless

Chrome 66.0.3359.181

Same result with command:
/opt/google/chrome/chrome --headless --no-sandbox --disable-setuid-sandbox --disable-gpu --disable-dev-shm-usage

[0517/162637.500135:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.

@nightvision04
Copy link

Any fix on this yet?

@stopsopa
Copy link

stopsopa commented Jun 4, 2018

On mac it seems to be fine but on ubuntu I have the same error. For some reason this image behaves different on mac and on linux.

@stopsopa
Copy link

stopsopa commented Jun 4, 2018

I reproduced this on Travis.ci here: link

It's quite important to solve it because this issue makes docker container useless.

@stopsopa
Copy link

stopsopa commented Jun 4, 2018

Ok so i reproduced it but on my Linux server after this error script stoppes on await page.content() but on travis it pass through... I give up

actually first .goto() is crashing (unresolved promise) but in timeout try catch I'm trying to execute page.content() but it stuck too.

image
image

the same on ubuntu
image

I think i did everything what i could, now your turn.. ;)

@aslushnikov
Copy link
Contributor

Dupe of #1925

@ujjaval77
Copy link

Could anyone help me out in knowing why is this error being occurred in console?

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