13

When trying to run Headless Chrome on both mac and linux, it fails with the following error

Chrome --headless --disable-gpu https://www.yahoo.com
[0505/072239.922334:ERROR:browser_process_sub_thread.cc(217)] Waited 5 ms for network service

I'm testing with version Google Chrome 74.0.3729.131

asked May 5, 2019 at 14:25
4
  • 1
    yeah i'm having the same issue but if i add a URL like you did i get Segmentation fault <p> google-chrome --headless google.com <p> [0510/173839.408209:ERROR:command_buffer_proxy_impl.cc(125)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer. [0510/173839.408083:WARNING:ipc_message_attachment_set.cc(49)] MessageAttachmentSet destroyed with unconsumed attachments: 0/1 [0510/173839.648167:ERROR:command_buffer_proxy_impl.cc(106)] ContextResult::kTransientFailure: Shared memory region is not valid <p> Segmentation fault Commented May 10, 2019 at 13:58
  • i've tried a myriad of things to get this to work myself, have you gotten it to work? Commented May 10, 2019 at 13:59
  • Not really an answer. Had same problem, spent days. Some say downgrading chrome helps, but not for me. Ended up using Puppeteer: github.com/GoogleChrome/puppeteer Commented May 14, 2019 at 15:53
  • I get the exact same error as @MistaWizard using cef 79.1.26 chromium embedded framework on ubuntu 19.04; it loads a webpage but none of the callbacks are called; I had this working 3 years ago on ubuntu 16.04 with the cef from then, but now that setup doesn't compile unless I create symlinks, such as /usr/include/gtk pointing to /usr/include/gtk-2.0/gtk and edit system includes; and once it compiled on 19.04, then it gets the above error Commented Jan 15, 2020 at 16:05

1 Answer 1

7

Try adding some of the following options:

chromeOptions.addArguments("--headless")
chromeOptions.addArguments("--no-sandbox")
chromeOptions.addArguments("--disable-dev-shm-usage")
chromeOptions.addArguments("--disable-gpu")
chromeOptions.addArguments("--disable-features=NetworkService") ##this did it for me
chromeOptions.addArguments("--window-size=1920x1080")
chromeOptions.addArguments("--disable-features=VizDisplayCompositor")
answered Jan 23, 2020 at 6:00
Sign up to request clarification or add additional context in comments.

2 Comments

Specifically, --disable-gpu did it for me, but others might be helpful as well
The largest list of (hopefully updated) arguments I can find is here: peter.sh/experiments/chromium-command-line-switches Its exhaustive :)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.