Bug report #13088

qgis-server mixing layer db-connections

Added by Tom Palan over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:QGIS Server
Affected QGIS version:master Regression?:No
Operating System:Linux / Ubuntu / Debian Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:21155

Description

Environment:

2 PostGIS databases
2 project files, one for each database

When using the qgis-web-client and qgis-server to display the projects, the qgis-server mixes the database-connections and displays data from the other project. This happens randomly, but is reproducible after a few tries.
It only happens when the 2 projects are accessed simultaneously (e.g. using 2 browsers, and switching between them).

I compiled qgis-server from source (2015-06-08), and added some debug statements. Somehow after the QgsPostgresProvider for the layer is created (Line: "p3: Table name is.."), some calls to featureSource return the right datasource-uri, and some use another.
That's how far I got.

This happens on my Ubuntu 14.04 /64bit and Debian Jessie 64bit, using Apache2

I would be happy to supply some more information.

example-debug-messages.txt Magnifier (3.55 KB) Tom Palan, 2015-07-08 04:26 AM

disable_layer_caching.patch Magnifier (581 Bytes) Tom Palan, 2015-07-09 06:08 AM

History

#1 Updated by Tom Palan over 8 years ago

Update: The problem only occures if the 2 projects have layers with the same name. Apparently somewhere in QgsWMSProjectParser::mapLayerFromStyle (when called with useCache=true) mixes layers from different projects.
I was able to "fix" it by disabling caching of layers, see patch. As this is only a temporary fix, could somebody with more knowledge of QGIS chime in?

#2 Updated by Marco Hugentobler over 8 years ago

  • Status changed from Open to Closed

It happened if two layers have the same id and the same layer name. But it should be fixed in master branch already (127dd64)

Also available in: Atom PDF