3liz/py-qgis-server

Abort request to PostgreSQL if the connection pool is full

Gustry opened this issue · 3 comments

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.

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

[PostgreSQL]
default_timeout=5

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

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.