New issue
Advanced search Search tips

Issue 787098 link

Starred by 5 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Nov 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Chrome --headless cannot be started via ssh - _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.

Reported by jzlowo...@marthus.pl, Nov 20 2017

Issue description

Chrome Version       : Google Chrome 62.0.3202.94
OS version               : System Version: OS X 10.10.5 (14F27), Kernel Version: Darwin 14.5.0

What steps will reproduce the problem?
(1) Log out all user sessions from Mac OS GUI
(2) Log in user via SSH only
(3) Run chrome from CLI via SSH with --headless flag, e.g making a screenshot command:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --disable-gpu --screenshot --window-size=1280,1696 https://www.chromestatus.com/

What is the expected result?
screenshot.png file is created

What happens instead?
Error report shows up, saying that connection to WindowServer cannot be established
(_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL) and the process hangs.

Full output:
mac2:~ shots$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless --disable-gpu --screenshot --window-size=1280,1696 https://www.chromestatus.com/
Nov 20 21:01:31 mac2 Google Chrome[65944] <Error>: Set a breakpoint at CGSLogError to catch errors as they are logged.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Error>: This user is not allowed access to the window system right now.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: Invalid Connection ID 0
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65944] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Nov 20 21:01:31 mac2 Google Chrome[65953] <Error>: Set a breakpoint at CGSLogError to catch errors as they are logged.
Nov 20 21:01:31 mac2 Google Chrome[65953] <Error>: This user is not allowed access to the window system right now.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextConcatCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextConcatCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextGetCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextGetDefaultUserSpaceToDeviceSpaceTransform: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextConcatCTM: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextGetAlpha: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Nov 20 21:01:32 mac2 Google Chrome[65953] <Error>: CGContextRestoreGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.



If user is logged-in in Mac OS GUI, everything works OK.

 
Labels: Proj-Headless
Components: Internals>Headless
Status: WontFix (was: Unconfirmed)
Hi, thanks for the report. 

Note that Chrome headless on Mac OS doesn't run in true headless, but on a hidden Window. This means that the Windows server needs to be available, hence the user needs to be logged in. Maybe there's a way to activate the Windows server without a GUI logon, but I'm not sure.
Thanks for the reply, haven't found that info in docs (originally I was using pupeteer).

Based on your experience, do you recommend any virtual WindowServer for mac, so the `--headless` works fine without actual GUI loaded by the user manually?

Sign in to add a comment