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

QT_QPA_PLATFORM for phantomjs headless #2569

Closed
gravitystorm opened this issue Mar 25, 2020 · 8 comments
Closed

QT_QPA_PLATFORM for phantomjs headless #2569

gravitystorm opened this issue Mar 25, 2020 · 8 comments

Comments

@gravitystorm
Copy link
Collaborator

While investigating #2556 I found a problem with our phantomjs config. After running vagrant up, phantomjs is in a non-working state:

vagrant@ubuntu-bionic:/srv/openstreetmap-website$ /usr/bin/phantomjs --version
qt.qpa.screen: QXcbConnection: Could not connect to display 
Could not connect to any X display.

This turns out to be expected, since the debian/ubuntu build of phantomjs doesn't use the patched+bundled version of QT that is in the official phantomjs builds.

We already have code to handle this situation in the test suite, namely:

ENV["QT_QPA_PLATFORM"] = "phantom" if IO.popen(["phantomjs", "--version"], :err => :close).read.empty?

... but this doesn't work on our vagrant boxes, because:

vagrant@ubuntu-bionic:/srv/openstreetmap-website$ QT_QPA_PLATFORM=phantom /usr/bin/phantomjs --version
This application failed to start because it could not find or load the Qt platform plugin "phantom"
in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

I don't know where the "phantom" in ENV["QT_QPA_PLATFORM"] = "phantom" comes from. Should this be "offscreen"? Or will that break a different situation?

@tomhughes
Copy link
Member

It comes from ariya/phantomjs#14376 (comment) I think but the key point is that it doesn't work with the Debian/Ubuntu packaged phantom - you need to use the upstream one.

@tomhughes
Copy link
Member

I don't believe offscreen will work by the way because it still requires an X server I think - it just positions the window off the edge of the screen so it's not visible.

@tomhughes
Copy link
Member

Hmm 2f342ba is odd because it was supposed to be making it conditional but also changed it from offscreen to phantom.

@tomhughes
Copy link
Member

The core issue though is that there is no good solution for Debian/Ubuntu systems - you basically can't use the packaged phantomjs on a headless system. So you either have to use the upstream one or you have to run in an environment with an X server of some sort even if it's Xvfb or something.

@gravitystorm
Copy link
Collaborator Author

"offscreen" works on my virtual machine, without needing an X server. I suspect/guess that "phantom" is a platform that only exists on the phatomjs patched version of QT.

@tomhughes
Copy link
Member

I mean I'm happy to change that given that I don't understand why it changed in the way it did and I suspect it may have been an accident.

There must have been a reason I made it conditional though, which suggests that there was some situation where offscreen didn't work.

@gravitystorm
Copy link
Collaborator Author

Sounds good!

@tomhughes
Copy link
Member

Having now tried on my machine, where I use the upstream phantomjs I think I have a better handle on what happened.

The upstream phantomjs actually only has one backend, namely the phantom one, so that is why I tried to make offscreen conditional. It seems however that, probably as a result of trying various alternatives, I accidentally changed what it was setting the value to at the same time.

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

2 participants