Bug report #20262

WFS provider: ERROR: Opening of authentication db FAILED

Added by Richard Duivenvoorde over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Nyall Dawson
Category:Web Services clients/WFS
Affected QGIS version:3.5(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28083

Description

In Current Master, when for example calling this wfs:

https://geodata.nationaalgeoregister.nl/bag/wfs?request=GetCapabilities
(epsg:28992, please zoom in enough to only show a couple of kilometres)

Sometimes (I think initiated by an 'abort') you will see a lot of:

ERROR: Opening of authentication db FAILED

Messages in the messagebar (see screenshot),

Debug output below.

Note that this IS not an authenticated service (it is public).
Not sure if it is really about the auth db, or maybe about the WFS-cache??? db?

Note that I'm behind a http-proxy here, not sure if that can be part of the issue.

ERROR: Opening of authentication db FAILED
/home/richard/bin/qgis/master/debug/bin/qgis(+0xcd40)[0x558ac11b9d40]
/home/richard/bin/qgis/master/debug/bin/qgis(+0xd1d7)[0x558ac11ba1d7]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0xaee38)[0x7f8ca888ee38]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0xaf0d8)[0x7f8ca888f0d8]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QMessageLogger::warning(char const*, ...) const+0xaf)[0x7f8ca886122f]
/usr/lib/x86_64-linux-gnu/libQt5Sql.so.5(+0x11c4f)[0x7f8caf984c4f]
/home/richard/bin/qgis/master/debug/lib/libqgis_core.so.3.5.0(QgsAuthManager::sslCertCustomConfigByHost(QString const&)+0x1af)[0x7f8caff768cd]
/home/richard/bin/qgis/master/debug/lib/libqgis_core.so.3.5.0(QgsNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, QNetworkRequest const&, QIODevice*)+0x620)[0x7f8cb0235200]
/usr/lib/x86_64-linux-gnu/libQt5Network.so.5(QNetworkAccessManager::get(QNetworkRequest const&)+0x15)[0x7f8ca8d1bbc5]
/home/richard/bin/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so(+0x75d29)[0x7f8c7beb1d29]
/home/richard/bin/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so(+0x798fe)[0x7f8c7beb58fe]
/home/richard/bin/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so(std::function<void ()>::operator()() const+0x32)[0x7f8c7beb6926]
/home/richard/bin/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so(+0x7712c)[0x7f8c7beb312c]
/home/richard/bin/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so(+0x6989a)[0x7f8c7bea589a]
/home/richard/bin/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so(+0x6bd5d)[0x7f8c7bea7d5d]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0xc2c97)[0x7f8ca88a2c97]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7f2a)[0x7f8ca81e1f2a]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f8ca82f2edf]
../src/core/qgsmessagelog.cpp: 29: (logMessage) [18ms] [thread:0x7f8c10477320] 2018-10-29T14:34:17 Qt[1] QSqlQuery::prepare: database not open
../src/core/auth/qgsauthmanager.cpp: 3647: (authDbQuery) [0ms] [thread:0x7f8c10477320] Auth db query exec() FAILED
../src/core/qgsnetworkaccessmanager.cpp: 96: (queryProxy) [0ms] [thread:0x7f8c10477320] using fallback proxy for https://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=bag:pand&STARTINDEX=41000&COUNT=1000&SRSNAME=urn:ogc:def:crs:EPSG::28992&BBOX=32388.60293342829027097,374470.21242620510747656,54231.19356689201958943,391744.00903031969210133,urn:ogc:def:crs:EPSG::28992
../src/core/qgsnetworkaccessmanager.cpp: 223: (createRequest) [0ms] [thread:0x7f8c10477320] Created [reply:7f8bdc101b90]

authentication.png (121 KB) Richard Duivenvoorde, 2018-10-29 03:08 PM

Associated revisions

Revision a392a160
Added by Nyall Dawson over 5 years ago

Fix authentication database connections

Fixes the authentication database cannot be opened in some circumstances.
We need to ensure that the pooled database connection is removed
immediately on thread finalisation and cannot defer this until
the main thread event loop runs.

Fixes #20262

Revision fe3f9171
Added by Nyall Dawson over 5 years ago

Fix authentication database connections

Fixes the authentication database cannot be opened in some circumstances.
We need to ensure that the pooled database connection is removed
immediately on thread finalisation and cannot defer this until
the main thread event loop runs.

Fixes #20262

(cherry picked from commit a392a160e6d7fdc70e3da857dc1aedb601a70007)

History

#1 Updated by Mathieu Pellerin - nIRV over 5 years ago

Richard, the reason you are seeing this is because the WFS layer is served through an HTTPS (i.e. secure/encrypted) connection. HTTPS connections trigger a call to the authentication manager (to seek e.g. custom certificates).

I'm also seeing this for XYZ layers. A band aid to avoid a flood of message bar items has been submitted: https://github.com/qgis/QGIS/pull/8372

#2 Updated by Richard Duivenvoorde over 5 years ago

Ok, thanks Mathieu. But limiting the amount of msg's is/should indeed a temporal fix isn't it?

I wonder now why QGIS cannot actually open a/the db anymore?

Because I (think) I do not have one? We then can maybe create an empty one in the profile?
Or is it locked? We should think of solution for that then if possible?

Anyway thanks for this fix already!

#3 Updated by Alessandro Pasotti over 5 years ago

the proxy settings are normally stored in the authentication DB because they may contain creadentials with passwords.

You should try to understand why the authentication DB cannot be opened.

#4 Updated by Luigi Pirelli over 5 years ago

as spotted by Mathieu Pellerin the error is rised due to this PR 69dab87d4a254bca9c3b22ae0dc07af3f22c6a1a. that is necessary after the adoption of qt5.11

#5 Updated by Richard Duivenvoorde over 5 years ago

Hi Paolo,

We are talking about qgis-auth.db isn't it? File looks normal to me. I can (during the time QGIS is complaining) open it with sqlitebrowser.

The Qt tab in Log Messages shows:
2018-10-30T09:32:07 WARNING QSqlDatabasePrivate::database: requested database does not belong to the calling thread.
2018-10-30T09:32:07 WARNING QSqlQuery::prepare: database not open

At that time the Messages tab show:
2018-10-30T09:32:07 CRITICAL Authentication Manager : Opening of authentication db FAILED
2018-10-30T09:32:07 WARNING Authentication Manager : Auth db query exec() FAILED

To me here (I'm behind the proxy now) it is easy reproducible:
- create a really fresh profile
- add proxy network settings
- add WMST layer (eg https://geodata.nationaalgeoregister.nl/bag/wfs?request=GetCapabilitiesP
- add one if its (epgs:28992) layers
- nothing wrong all requests fine, no errors
- add WFS connection, eg https://geodata.nationaalgeoregister.nl/bag/wfs?request=GetCapabilities
- without even adding the layer, QGIS starts spitting out the stream of warnigs and errors

Creating a new project and adding the wmst layer again: silence...
Add one of the layers from the wfs service (zoom in a LOT) and immidiatly you see in Qt tab:

2018-10-30T09:43:01 CRITICAL Authentication Manager : Opening of authentication db FAILED
2018-10-30T09:43:01 WARNING Authentication Manager : Auth db query exec() FAILED

I have the feeling that sometimes I do not even have to add the wfs, but it happens also when only working with the wmts layer...?

#6 Updated by Richard Duivenvoorde over 5 years ago

At Luigi, yep, I'm on 5.11.2:

QGIS version
3.5.0-Master
QGIS code revision
9e45223d42
Compiled against Qt
5.11.2
Running against Qt
5.11.2

#7 Updated by Nyall Dawson over 5 years ago

  • Status changed from Open to In Progress
  • Assignee set to Nyall Dawson

#8 Updated by Nyall Dawson over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF