[Bug]: Problems displaying own WMS services from the same server under 3.8.11-pre and 3.9.0-rc.4 with Py-QGIS-Server
What is the bug? (in English)
A QGIS server (3.8.8 or 3.9.0-rc.1) with Py-QGIS server provides a WMS service via a Lizmap project (https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=gvv-nk_alkis_wms_3_40):
https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=gvv-nk_alkis_wms_3_40
This service can be used perfectly in QGIS or on other servers in Lizmap projects. E.g. here: https://cx21-8.webgis.biz/index.php/view/map?repository=fnpv9py&project=FNP_3_40
However, on the server on which the service is provided, it cannot be used in other Lizmap projects (https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=FNP_3_40)
There are the following entries in the qgis-server.log:
Steps to reproduce the issue
see above
Versions, safeguards, check summary etc
Versions :
- Lizmap Web Client : 3.9.0-rc.1 - commit da24129e6 https://github.com/3liz/lizmap-web-client/commit/da24129e6
- Lizmap plugin : 4.5.0
- QGIS Desktop : 3.40.6
- QGIS Server : 3.40.6
- Py-QGIS-Server : 1.9.4
- QGIS Server plugin atlasprint : 3.4.2
- QGIS Server plugin lizmap_server : 2.13.1
- QGIS Server plugin wfsOutputExtension : 1.8.3
List of Lizmap Web Client modules :
* Version Lizmap Web Client 3.8 needed
List of safeguards :
* Mode : normal
* Allow parent folder : yes
* Number of parent : 2 folder(s)
* Prevent other drive : no
* Prevent PG service : yes
* Prevent PG Auth DB : yes
* Force PG user&pass : yes
* Prevent ECW : yes
Check Lizmap plugin
- [x] I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.
Operating system
Ubuntu 24.04.
Browsers
Chrome
Browsers version
Version 136.0.7103.93
Relevant log output
All requests are 200 HTTP code.
However, we can see line 271 Timed out on a GetMap request.
As it's working from "another LWC" (so another domain ?), and from QGIS Desktop, it seems only when it's used from within your domain nginx41-9.webgis.biz, it seems that QGIS Server can't resolve wms101.webgis.biz ? You will need to dig into HTTP requests with the route ?
What is the URL inside your QGIS projects of these layers ? Are you sure that these HTTP requests DNS can be resolved ? It works if you take another WMS with a different domain server ? Does it work with the option "request straight the WMS provider from client" checkbox ?
This is out of my scope of knowledge, with this kind of debug, just trying an answer.
Sorry, the project was a bit too complex for the error description.
The problem is not the access to another server: https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=WMS_Test_3_40_from_AX101 this works well.
Only the use of WMS services from your own server (nginx41-9) causes problems. The WMS service with the cadastral data is provided in this project: https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=gvv-nk_alkis_wms_3_40
Here only PostgreSQL data is loaded from the own server. This project works quickly and flawlessly.
In this project: https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=WMS_Test_3_40 the corresponding WMS service is used and it's quite slow if you zoom in further (e.g. 1:500)
WMS service: https://nginx41-9.webgis.biz/index.php/lizmap/service?repository=gvvnk&project=gvv-nk_alkis_wms_3_40&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
I noticed one more thing: I have to activate the option “Ignore reported layer extents” in QGIS 3.40, otherwise I only get a small section of the display. I did not have to do this in QGIS 3.22 / Limap 3.7. Are there perhaps other options that need to be considered?
I have now taken another closer look at the log files. This error message also appears in the QGIS log file when the external server is successfully accessed:
318 proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: inv (File not found or invalid) 319 proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: proj=hgridshift (File not found or invalid)
I can find something on the Internet in connection with QField, but I can't assign it: https://github.com/opengisch/QField/discussions/3986 Does anyone know the cause?
If there is a problem accessing the WMS service from your own server, you will receive these messages:
304 QFont::fromString: Invalid description '(empty)' 305 QFont::fromString: Invalid description '(empty)' 306 2025-05-14 08:14:11,744 RREQ [910] 200 GET http://127.0.0.1:7200/ows/?FORMAT=application%2Fjson&LAYER=Politischegrenzen&MAP=%2Fsrv%2Fdata%2Ftest9%2Fgvv-nk%2FWMS_Test_3_40_from_AX1 01.qgs&REQUEST=getlegendgraphic&SERVICE=WMS&STYLES=default&VERSION=1.3.0&LIZMAP_USER=&LIZMAP_USER_GROUPS= 143 60 REQ_ID:682434b392523-c04affabe1583fd3166d 307 2025-05-14 08:14:11,744 REQ [910] 127.0.0.1 200 POST /ows/ 144 60 3.9.0-rc.2 REQ_ID:682434b392523-c04affabe1583fd3166d 308 proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: inv (File not found or invalid) 309 proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: proj=hgridshift (File not found or invalid) 310 proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: inv (File not found or invalid) 311 proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: proj=hgridshift (File not found or invalid) 312 2025-05-14 08:14:11,834 WARNING [1053] Qgis: Network: Network request https://bourbon.3liz.com/api/event timed out 313 2025-05-14 08:14:11,834 WARNING [1053] Qgis: Network: Network request https://bourbon.3liz.com/api/event timed out 314 2025-05-14 08:14:11,834 WARNING [1053] Qgis: Network: Network request https://bourbon.3liz.com/api/event timed out 315 2025-05-14 08:14:11,908 INFO [1053] Updated project '/srv/data/test9/gvv-nk/WMS_Test_3_40_from_AX101.qgs' in cache
There are such entries in the nginx error log: 1 2025/05/14 08:19:32 [error] 967#967: *31 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 92.117.173.138, server: nginx41-9.webgis.biz, request: "GET /index.php/lizmap/service?repository=gvvnk&project=WMS_Test_3_40&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=default&TRANSPARENT=TRUE&LAYERS=Politischegrenzen&DPI=96&WIDTH=2222 &HEIGHT=1052&CRS=EPSG%3A25832&BBOX=398022.40883686306%2C5332009.839983641%2C403900.40392618655%2C5334793.262217152 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.3-fpm.sock", host: "nginx41-9. webgis.biz", referrer: "https://nginx41-9.webgis.biz/index.php/view/map?repository=gvvnk&project=WMS_Test_3_40"
As described, the same WMS services work perfectly on the CX22 server without Py-QGIs server and under Apache with Lizmap 3.8: https://cx21-8.webgis.biz/index.php/view/map?repository=fnpv9py&project=FNP_3_40 (a bit slow but that's ok as very small cloud server)
However, the error entry “proj_create: Error 1029 (...” can also be found there in the Apache error.log
Update: The problem only occurs if the PostgreSQL DB of the project providing the WMS service is located on the same server. If the DB is located on an external server, the speed is very good. I understand that even less, but I could live with it if necessary.
Project providing the WMS service with data from an external DB: https://nginx41-9.webgis.biz/index.php/view/map?repository=wmsextdb&project=gvv-nk_alkis_wms_3_40_ext_db
Project that uses the above service: https://nginx41-9.webgis.biz/index.php/view/map?repository=wmsextdb&project=WMS_Test_3_40_ext_DB
I understand that even less, but I could live with it if necessary.
@guenterw meh, this should not happen, it is confusing.
The problem only occurs if the PostgreSQL DB of the project providing the WMS service is located on the same server. If the DB is located on an external server, the speed is very good.
This is probably related from routing to the server itself using an external network interface, depending on the topology of your network, this kind of loop may leads to undefined behavior. If your service are on the same host, try to resolve to local loopback (127.0.0.1) instead.
Hint: Use PostgresQL services in your projects so that, on the server, the service resolve to localhost (or somewhere else on your LAN).
Thank you very much for the feedback and the hint.
I first tried it with “host=localhost”, then with the own IP address and now with “host=127.0.0.1”. Unfortunately, none of this makes any difference.
How do I resolve the local loopback (127.0.0.1)? Does this have to do with the /etc/hosts file? This looks as follows:
127.0.1.1 CPX41-nginx CPX41-nginx 127.0.0.1 localhost
'# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
The problem persists after the third installation. It cannot be due to the size of the memory (now 128 GB RAM). Since I cannot use this type of installation (with Py-QGIS-Server under nginx) productively without solving the problem, I will try to describe the problem again. The server is actually running smoothly and quickly. Only not when WMS services are integrated from the own server. The project that provides the WMS services also runs well and the services can be used well in QGIS. https://wms102.webgis.biz/index.php/view/map?repository=herbolzheim&project=herbolzheim_alkis_wms_3_40
With intensive use (a lot of zooming and moving), the QGIS server has a lot to do, but it remains smooth even after a long time.
The WebGIS project in which these WMS services are integrated can also be started and the layers can be loaded https://test102-9.webgis.biz/index.php/view/map?repository=db&project=test9
But after zooming a few times, no more data can be loaded. The image “freezes” and the QGIS server hardly does anything:
There are entries in the QGIS error log file indicating that the external database required by the project for the WMS service is no longer accessible:
A short time later, however, the DB connection in the WMS project works perfectly again.
In the nginx logs there are error files of both projects with the corresponding error messages that the data could not be loaded - timeout
Does anyone have any idea what the problem could be? Is there a cache specifically for the WMS services? Is there anything that needs to be taken into account during installation? I would be grateful for any information.