Bug report #18988

QGIS Server rendering different from Desktop rendering

Added by Tudor Bărăscu almost 6 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Paul Blottiere
Category:QGIS Server
Affected QGIS version:3.1(master) Regression?:No
Operating System:Debian Buster Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26819

Description

I've attached a test project.
In QGIS Desktop the rendered image looks like:
Desktop rendering
while the GetMap output is:
Server rendering

Moreover, when adding the WMS layer in QGIS Desktop, I had the following error:

valid Layer : WMS provider Cannot calculate extent (file: swmsprovider.cpp row: 159function QgsWmsProvider:)
             Raster layer Provider is not valid (provider: wms, URI: contextualWMSLegend=0&crs=EPSG:3844&dpiMode=7&featureCount=10&format=image/png&layers=renderbug%20locations&styles=default&url=http://qgis.demo/cgi-bin/qgis_mapserv.fcgi?VERSION%3D1.3.0%26map%3D/home/web/Downloads/bug/bug.qgs (file: asterlayer.cpp row: 609function setDataProvider:)

and I have to add the root project (all layers) so that it works.

server_rendering_bug.zip - Test project (18.4 KB) Tudor Bărăscu, 2018-05-18 04:04 PM

good.png - Desktop rendering (5.76 KB) Tudor Bărăscu, 2018-05-18 04:08 PM

bad.png - Server rendering (1.36 KB) Tudor Bărăscu, 2018-05-18 04:09 PM

server_rendering_bugv2.zip - Test projects for 2.18 and master (24.2 KB) Tudor Bărăscu, 2018-05-18 04:47 PM

History

#1 Updated by Giovanni Manghi almost 6 years ago

  • Status changed from Open to Feedback

regression?

#2 Updated by Tudor Bărăscu almost 6 years ago

Seems to also be present on 2.18 Server. I have a server from several weeks ago though.
I'm attaching project for 2.18 and master.
Could you please also test?

#3 Updated by Tudor Bărăscu over 5 years ago

  • Status changed from Feedback to Open

Present also on 3.3 Master.

The label using this expression is not rendered by the server:

attribute(get_feature('renderbug_5a22d758_2257_411b_8036_2bc91d3ac4da', 'idmetr', "idmetr"), 'val')

#4 Updated by Paul Blottiere over 5 years ago

I just tested this issue with the next GetMap request and the rendered image is correct:

curl "http://localhost/qgisserver?MAP=/tmp/server_rendering_bugv2/bug.qgs&SERVICE=WMS&REQUEST=GetMap&WIDTH=400&HEIGHT=700&CRS=EPSG:3844&BBOX=-1915141.5,-761930.0,3332178.7,1294759.6&LAYERS=renderbug locations" > out.png

Tudor, can you confirm/deny that behavior with the current master branch?

#5 Updated by Paul Blottiere over 5 years ago

  • Assignee set to Paul Blottiere
  • Status changed from Open to Feedback

#6 Updated by Tudor Bărăscu over 5 years ago

I just build the master from the beginning and I cannot even get an image.. the server freezes at your example request.
Only on this type of project. Will get back soon (few hours). It's surely a bug.

#7 Updated by Tudor Bărăscu over 5 years ago

  • Status changed from Feedback to Open

Hi Paul. With the current master all the getmap request for that specific labeling layer are freezing. I created a test in this branch https://github.com/tudorbarascu/qgis/tree/test_server but for me on debian buster the test for getmap is freezing and nothing happens. I also built from source.. the same.
I redid the project from scratch, the same.
I am currently installing ubuntu bionic in a VM and retest there.
What OS do you have?

#8 Updated by Tudor Bărăscu over 5 years ago

I cannot replicate under ubuntu 18.04 but I installed another system with debian Buster (testing) and it's the same.

- my laptop (Buster): * ctest -R PyQgsServerWMSGetMap -V hangs when it arrives at the new test. This also hangs for the local server (through nginx)

curl "http://localqgis/cgi-bin/qgis_mapserv.fcgi?MAP=/home/web/dev/cpp/qgis/tests/testdata/qgis_server_accesscontrol/project.qgs&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=pointlabel&STYLES=&FORMAT=image/png&BBOX=-16817707,-4710778,5696513,14587125&HEIGHT=500&WIDTH=500&CRS=EPSG:3857" > out.png

- On the newly created ubuntu bionic VM both the curl and the ctest -R PyQgsServerWMSGetMap -V work fine although the configs are exactly the same as on my laptop

- On another Debian Buster server which I use in production the ctest -R.. works but the curl hangs..

I get no errors whatsoever and the configuration files are the same on all three systems. I disabled parallel rendering and it doesn't fix the issue.

Should I open a pull request with the test and see what it does for others?

I don't have any other ideas for now.
Thank you.

#9 Updated by Tudor Bărăscu over 5 years ago

Installed on a new VM with Debian Buster, I cannot replicate at all, same packages same CmakeCache.txt file .. same configuration files etc.. The only difference between the Debian systems is that one is new install (works..) and others are systems installed around 8 months ago and updated.

#10 Updated by Paul Blottiere over 5 years ago

Hi Tudor,

Installed on a new VM with Debian Buster, I cannot replicate at all, same packages same CmakeCache.txt file .. same configuration files etc.. The only difference between the Debian systems is that one is new install (works..) and others are systems installed around 8 months ago and updated.

OK, I'm not the only one then :). I tried to reproduce your error on a fresh VM or from a Docker debian:buster image without success...

I think that this issue may be closed, as well as the corresponding PR (without merging it I mean).

What do you think?

#11 Updated by Tudor Bărăscu over 5 years ago

It's the logical thing to do! Closing it now!

I just wanted to close it when I deactivated the parallel rendering on my desktop and it works now (ctest -R PyQgsServerWMSGetMap -V + curl..) It seems last time when I tested single thread I must have not reloaded nginx after deactivating it so... it wasn't really deactivated.

I can successful replicate on the debian buster vm now.
You can replicate by doing ``export QGIS_SERVER_PARALLEL_RENDERING=true``
I think I got tricked into starting the VM with only one core (so.. don't forget to put at least 2 cores) and I also expected that the server parallel rendering is enabled by default at least for tests and it's not.
On ubuntu 18.04 I cannot replicate, maybe it's because qt 5.9 and not 5.11 as in buster.

I created a new VM with ubuntu cosmic (18.10) and I can replicate (QT 5.11).

#12 Updated by Giovanni Manghi over 5 years ago

I just wanted to close it when I deactivated the parallel rendering on my desktop and it works now (ctest -R PyQgsServerWMSGetMap -V + curl..) It seems last time when I tested single thread I must have not reloaded nginx after deactivating it so... it wasn't really deactivated.

I can successful replicate on the debian buster vm now.
You can replicate by doing ``export QGIS_SERVER_PARALLEL_RENDERING=true``
I think I got tricked into starting the VM with only one core (so.. don't forget to put at least 2 cores) and I also expected that the server parallel rendering is enabled by default at least for tests and it's not.
On ubuntu 18.04 I cannot replicate, maybe it's because qt 5.9 and not 5.11 as in buster.

I created a new VM with ubuntu cosmic (18.10) and I can replicate (QT 5.11).

is this stuff documented somewhere?

#13 Updated by Tudor Bărăscu over 5 years ago

@Giovanni. Which part, exactly?
On my local machine, the server tests at least.. are taking the environment variables of the desktop. On the test VM, as I only installed the server, there wasn't any parallel rendering by default.
I'll look in a few days if it's documented or not when I start working on the docs.

#14 Updated by Paul Blottiere over 5 years ago

Hi Tudor,

The PR fixing the freezing issue is merged now (https://github.com/qgis/QGIS/pull/8228).

Can you check that the rendered image is correct on your side now (which was the initial issue)?

curl "http://localhost/qgisserver?MAP=/tmp/server_rendering_bugv2/bug.qgs&SERVICE=WMS&REQUEST=GetMap&WIDTH=400&HEIGHT=700&CRS=EPSG:3844&BBOX=-1915141.5,-761930.0,3332178.7,1294759.6&LAYERS=renderbug locations" > out.png

#15 Updated by Tudor Bărăscu over 5 years ago

Will check later on and close this after retesting. Thanks a lot Paul for your valuable work.

I have a pull request (https://github.com/qgis/QGIS/pull/8063) with a test for this, do you think it's valuable or should I close it?
I also don't know if the multithreading on the server is by default enabled in travis, do you have any ideas? Will try and check for this later. Thanks again!

#16 Updated by Paul Blottiere over 5 years ago

I have a pull request (https://github.com/qgis/QGIS/pull/8063) with a test for this, do you think it's valuable or should I close it?

If the resulting image is not rendered correctly on your side, then yes it's an interesting PR to merge. But if the image is valid, I don't think it's necessary. So let's now wait for your test :).

I also don't know if the multithreading on the server is by default enabled in travis, do you have any ideas? Will try and check for this later. 

Multithreading is not enabled on Travis.

#17 Updated by Tudor Bărăscu over 5 years ago

  • Status changed from Open to Closed

The image is valid so i'm closing this. Shouldn't we enable multithreading on Travis by default?
I wrote that test so that the CI ensures it doesn't happen again but of course it won't work if multithreading is disabled.
Is there another way to handle this that I don't currently see?

Also available in: Atom PDF