3liz / py-qgis-server

QGIS embbeded WMS/WFS/WCS asynchronous scalable http server
https://docs.3liz.org/py-qgis-server
Mozilla Public License 2.0
68 stars 16 forks source link

Abort request to PostgreSQL if the connection pool is full #47

Closed Gustry closed 1 year ago

Gustry commented 1 year ago

A QGIS project is connecting to a PostgreSQL database to fetch layers. The connection pool for the user&password was full, so QGIS Server couldn't fetch data.

The "GetCapabilities" request was interrupted after a very long timeout from server with a 503 error.

It would be nice that such layers are considered "invalid" layer (like the "strict" mode in Py-QGIS-Server). When loading the given project, QGIS Server was blocking other QGIS projects to load.

rldhont commented 1 year ago

@Gustry in the QGIS3.conf do you have a default_timeout defined for PostgreSQL:

[PostgreSQL]
default_timeout=5
Gustry commented 1 year ago

I'm talking about the hosting service @rldhont ... So I was wondering if Py-QGIS-Server was catching the exception ?

dmarteau commented 1 year ago

What exactly is this about ?

Two things:

  1. If Qgis is stalled for any reason, there is not much that py-qgis-server can do except from killing the worker and return a 503 to client.
  2. Invalid layers are tested when loading a project: if Qgis stall when loading a layer this is the same punishment: nothing to do except restarting the worker.