Bug report #18747

QGIS Server GetPrint issue on Desktop Linux installations

Added by Giovanni Manghi over 1 year ago. Updated about 1 year ago.

Status:Rejected
Priority:Low
Assignee:-
Category:QGIS Server
Affected QGIS version:2.18.18 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:26634

Description

This may or may not be related to #15440

At some point in 2.18 development it seems that QGIS Server, in the context of GetPrint requests of layout composers with elements like html text boxes, stopped to accept the standard DISPLAY from X11 causing the same symptoms (QGIS Server crash) as described in the #15440 ticket.

This is a low priority issue as anyway under Linux there is a clear "workaround", install a fake xserver, for what in reality should not be a real use case (a Desktop linux installation for a server).

To be tested under QGIS Server 3.


Related issues

Related to QGIS Application - Bug report #15440: QGIS Server: GetPrint crashes on Windows when there are ... Closed 2016-08-15

History

#1 Updated by Jürgen Fischer over 1 year ago

  • Description updated (diff)

#2 Updated by Jürgen Fischer over 1 year ago

  • Related to Bug report #15440: QGIS Server: GetPrint crashes on Windows when there are advanced elements (i.e. html text boxes) in the layout being printed added

#3 Updated by Alessandro Pasotti over 1 year ago

  • Status changed from Open to Rejected
  • Resolution set to wontfix

I cannot reproduce on 2.18 if running the server with my current user inside an xterm.

Btw I'd be surprised if it was working before: in order to not crash with HTML texts an X server is needed (fake or real) AND must be accessible by the client user, that implies that if you are running the server under the same user that has access to DISPLAY (normally = ":0" ) everthing works fine but if you try to run the server from a user (e.g. www-data) that has no authority to access to the DISPLAY it will fail.

Bottom line is: xvfb has always been required to run the server outside a graphical terminal shell (which would be nonsense for a server application).

Yuo can also test after "xhost +" and passing DISPLAY=:0 from a www-data termninal and it will work (because now it has authority to access X)

#4 Updated by Giovanni Manghi over 1 year ago

Alessandro Pasotti wrote:

I cannot reproduce on 2.18 if running the server with my current user inside an xterm.

Btw I'd be surprised if it was working before: in order to not crash with HTML texts an X server is needed (fake or real) AND must be accessible by the client user, that implies that if you are running the server under the same user that has access to DISPLAY (normally = ":0" ) everthing works fine but if you try to run the server from a user (e.g. www-data) that has no authority to access to the DISPLAY it will fail.

Bottom line is: xvfb has always been required to run the server outside a graphical terminal shell (which would be nonsense for a server application).

Yuo can also test after "xhost +" and passing DISPLAY=:0 from a www-data termninal and it will work (because now it has authority to access X)

I have just tested on a VM (Ubuntu Desktop 12.04 installed from scratch) and GetPrint works without needing to install xvfb (the package is not installed). Or maybe it could another fake xserver that could be installed by default on older Ubuntu distributions? Any hint about what I should look for?

#5 Updated by Giovanni Manghi over 1 year ago

I have just tested on a VM (Ubuntu Desktop 12.04 installed from scratch) and GetPrint works without needing to install xvfb (the package is not installed). Or maybe it could another fake xserver that could be installed by default on older Ubuntu distributions? Any hint about what I should look for?

forgot to mention: qgis server 2.8

#6 Updated by Giovanni Manghi over 1 year ago

Giovanni Manghi wrote:

I have just tested on a VM (Ubuntu Desktop 12.04 installed from scratch) and GetPrint works without needing to install xvfb (the package is not installed). Or maybe it could another fake xserver that could be installed by default on older Ubuntu distributions? Any hint about what I should look for?

forgot to mention: qgis server 2.8

I tried also on Ubuntu 14.04 Desktop and QGIS 2.14, same result. No fake x server (not xvfb at least) and getprint works.

#7 Updated by Giovanni Manghi over 1 year ago

I finally was able to test QGIS Server (master) on a Desktop Ubuntu installation, and this "issue" is not anymore. Much like for Windows: https://issues.qgis.org/issues/15440#note-39

So... I agree that this in Linux/2.18 is not a problem (install the fake xserver) but I still wonder about the coincidence that this "affects" also QGIS Server 2.18 on Windows, where there is no solution.

#8 Updated by Uroš Preložnik over 1 year ago

Please don't leave this issue as fixed already. We need full instructions on DISPLAY variable and fake xserver, because I and believe many other users have no idea what we are talking about here.

I have multiple QGIS Server setups on Windows and Linux (Ubuntu server, Linux Mint, Ubuntu desktop) and this issues is on all this setups on 2.18. Printing was working on same setups on 2.14 and stopped working on 2.18, no other changes.

This should be high priority issue for 2.18 which should be stable but has this problem entire time as LTR release. If there is quick fix, please
describe it, when I tried adding DISPLAY variable QGIS Server stopped on GetMap...

#9 Updated by Uroš Preložnik over 1 year ago

Also, I can't really understand why I can print PDF with map, legend and scale and if I want to print simple text box that says "Hi", then I need to install whole bunch of stuff like full desktop server and so on. Not that it's working on desktop, because it doesn't.

#10 Updated by Alessandro Pasotti over 1 year ago

This is a longstanding issue and there is no solution other than install fakex on Linux/Unix systems.

AFAIK this is documented in the official QGIS Server documentation.

As far as windows is concerned, (my personal considerations here) I'm not a windows developer and I would not advice installing QGIS Server on other platforms than Linux.

If it was my choice I would not even include Windows in the supported platforms for QGIS server.

#11 Updated by Uroš Preložnik over 1 year ago

Alessandro Pasotti wrote:

This is a longstanding issue and there is no solution other than install fakex on Linux/Unix systems.

AFAIK this is documented in the official QGIS Server documentation.

As far as windows is concerned, (my personal considerations here) I'm not a windows developer and I would not advice installing QGIS Server on other platforms than Linux.

If it was my choice I would not even include Windows in the supported platforms for QGIS server.

Thanks for looking into this. I agree that maybe Windows setup is just not working well enough to support it. I see there is a lot of interest in community for Windows setup, so I will add some note about that in this posts level2.si/2015/12/qgis-server-on-windows-10 and http://level2.si/2018/03/qgis-server-3-0-on-windows-10/

As for documentation on fake X-server I found only this about DISPLAY variable
https://docs.qgis.org/2.18/en/docs/user_manual/working_with_ogc/server/config.html#id2 and your post (couple of years old, though). Is there anything else?

#12 Updated by Harrissou Santanna over 1 year ago

As for documentation on fake X-server I found only this about DISPLAY variable
https://docs.qgis.org/2.18/en/docs/user_manual/working_with_ogc/server/config.html#id2 and your post (couple of years old, though). Is there anything else?

https://docs.qgis.org/testing/en/docs/user_manual/working_with_ogc/server/getting_started.html#xvfb maybe?

#13 Updated by Uroš Preložnik over 1 year ago

Harrissou Santanna wrote:

As for documentation on fake X-server I found only this about DISPLAY variable
https://docs.qgis.org/2.18/en/docs/user_manual/working_with_ogc/server/config.html#id2 and your post (couple of years old, though). Is there anything else?

https://docs.qgis.org/testing/en/docs/user_manual/working_with_ogc/server/getting_started.html#xvfb maybe?

Thank you, I will go through that. I was looking only in 2.18 documentation and not testing docs. One thing I still don't understand is why do I need this if I'm running QGIS Server on Ubuntu Desktop or Linux Mint with GUI. I understand it is needed for only server setups without GUI.

#14 Updated by Giovanni Manghi over 1 year ago

Uroš Preložnik wrote:

I understand it is needed for only server setups without GUI.

No, in QGIS 2.18 it is necessary also on Desktop installations (it wasn't necessary on 2.14 and is not necessary on 3). This is something that has changed at some point during the 2.18 development as the first point releases of 2.18 were not affected. I proved/tested this several times.

#15 Updated by Giovanni Manghi over 1 year ago

Giovanni Manghi wrote:

Uroš Preložnik wrote:

I understand it is needed for only server setups without GUI.

No, in QGIS 2.18 it is necessary also on Desktop installations (it wasn't necessary on 2.14 and is not necessary on 3). This is something that has changed at some point during the 2.18 development as the first point releases of 2.18 were not affected. I proved/tested this several times.

note: this #15440-23 seems to point to a packing issue rather than a bug (as when compiling the source code this problem does not seems to happen, only when using packages from repositories).

#16 Updated by Uroš Preložnik about 1 year ago

Hi,

Tested this issue with QGIS Server 3.2 on Ubuntu 18.04. It's working normally out of the box, no need to setup XVFB.

Now, documentation should be fixed, that this chapter

https://docs.qgis.org/testing/en/docs/user_manual/working_with_ogc/server/getting_started.html#xvfb

goes to 2.18 docs and is removed from testing (3.x) docs.

Is it OK to do that, is XVFB used anywhere else?

How exactly fix documentation like this?

Uroš

Also available in: Atom PDF