Bug report #20826

Open capabilities but restricted service - QGIS crashes

Added by Peter Melin about 1 year ago. Updated 12 months ago.

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

Description

Hi,
We have a WMS-service that is restricted (Basic auth). To let the users access the capabilities we have published the capabilities-document on an open adress.
When you connect to the service, to the open capabilities-adress, in QGIS it works fine but when you try to add a layer from the service (send a GetMap-request) QGIS chrashes. It looks like the application tries to open an athentication window but it just freezes. Any suggestion why? We have tried four different versions of QGIS and they all react in the same way

Associated revisions

Revision c9e76164
Added by Nyall Dawson 12 months ago

Fix hang when WMS credentials requested

Remove responsibility for credentials mutex locking from external
callers and handle appropriate locks internally. This allows the
mutex lock to be much "tighter" and avoids deadlocks when
credentials are requested while an existing credentials dialog
is being shown.

(No mutex is required protecting the credentials dialog itself
as this is ALWAYS shown in the main thread)

Fixes #20826

Revision ad6e1566
Added by Nyall Dawson 12 months ago

Fix hang when WMS credentials requested

Remove responsibility for credentials mutex locking from external
callers and handle appropriate locks internally. This allows the
mutex lock to be much "tighter" and avoids deadlocks when
credentials are requested while an existing credentials dialog
is being shown.

(No mutex is required protecting the credentials dialog itself
as this is ALWAYS shown in the main thread)

Fixes #20826

(cherry picked from commit c9e761649820f8444a41da5e18850061b207c09c)

Revision 2af35352
Added by Jürgen Fischer 10 months ago

[needsbackport] apply an alternative fix for #20826

Partly reverts c9e761649, which removed the synchronizatiion of
credential requests (eg. in a project that has multiple layers from the
same postgresql database without credentials) and led to multiple
concurrent requests for the same credentials.

Some of which were silently discarded, when events processed in the
dialogs exec() event loop tried to reinvoke the dialog and caused
invalid layers.

Authentications caused by network requests can still cause this.

The credential cache is now guarded by a separate mutex.

Revision e26c4bf3
Added by Jürgen Fischer 10 months ago

[needsbackport] apply an alternative fix for #20826 & #21582

Partly reverts c9e761649, which removed the synchronizatiion of
credential requests (eg. in a project that has multiple layers from the
same postgresql database without credentials) and led to multiple
concurrent requests for the same credentials.

Some of which were silently discarded, when events processed in the
dialogs exec() event loop tried to reinvoke the dialog and caused
invalid layers.

Authentications caused by network requests can still cause this.

The credential cache is now guarded by a separate mutex.

(cherry picked from commit 2af35352167257f5f3f73bea8fbee6f5506829bb)

Revision f7d47f08
Added by Jürgen Fischer 10 months ago

[needsbackport] apply an alternative fix for #20826 & #21582

Partly reverts c9e761649, which removed the synchronizatiion of
credential requests (eg. in a project that has multiple layers from the
same postgresql database without credentials) and led to multiple
concurrent requests for the same credentials.

Some of which were silently discarded, when events processed in the
dialogs exec() event loop tried to reinvoke the dialog and caused
invalid layers.

Authentications caused by network requests can still cause this.

The credential cache is now guarded by a separate mutex.

(cherry picked from commit 2af35352167257f5f3f73bea8fbee6f5506829bb)

History

#1 Updated by Alessandro Pasotti about 1 year ago

  • Status changed from Open to Feedback

First: can you please check a recent version like QGIS 3.4 ?

Second: can you share the WMS address?

#2 Updated by Peter Melin about 1 year ago

  • Assignee set to Alessandro Pasotti

I've istalled QGIS 3.4 and tested the service, but QGIS reacts the same (crashes)

The url I'm testing is http://maps-ver.lantmateriet.se/capabilities/inspire/hy/wms/v1?request=getcapabilities&version=1.3.0 and i've verified that the capabilities have the correct adress for GetMap-requests by providing authentication information when connecting to the open capabilities (but it should not be necessary) and then it works like a sharm

#3 Updated by Alessandro Pasotti about 1 year ago

  • Assignee deleted (Alessandro Pasotti)

#4 Updated by Peter Melin about 1 year ago

  • Status changed from Feedback to Open

Peter Melin wrote:

Hi,
We have a WMS-service that is restricted (Basic auth). To let the users access the capabilities we have published the capabilities-document on an open adress.
When you connect to the service, to the open capabilities-adress, in QGIS it works fine but when you try to add a layer from the service (send a GetMap-request) QGIS chrashes. It looks like the application tries to open an athentication window but it just freezes. Any suggestion why? We have tried four different versions of QGIS and they all react in the same way

#5 Updated by Giovanni Manghi about 1 year ago

  • Status changed from Open to Feedback

Peter Melin wrote:

Peter Melin wrote:

Hi,
We have a WMS-service that is restricted (Basic auth). To let the users access the capabilities we have published the capabilities-document on an open adress.
When you connect to the service, to the open capabilities-adress, in QGIS it works fine but when you try to add a layer from the service (send a GetMap-request) QGIS chrashes. It looks like the application tries to open an athentication window but it just freezes. Any suggestion why? We have tried four different versions of QGIS and they all react in the same way

I have several WMS services that are protected with basic http authentication (Apache as web server, QGIS Server nad Mapserver) and I can't get any crash, but in my case the GetCapabilities call is also protected. Can you share your server configuration?

#6 Updated by Giovanni Manghi about 1 year ago

  • Affected QGIS version changed from 3.0.2 to 3.4.0

#7 Updated by Alessandro Pasotti about 1 year ago

  • Assignee set to Alessandro Pasotti

#8 Updated by Alessandro Pasotti about 1 year ago

  • Affected QGIS version changed from 3.4.0 to 3.5(master)
  • Operating System changed from Windows 10 Enterprise to Any

It's a deadlock when the credentials dialog appears.

#9 Updated by Nyall Dawson 12 months ago

  • Status changed from Feedback to In Progress
  • Assignee changed from Alessandro Pasotti to Nyall Dawson

#10 Updated by Nyall Dawson 12 months ago

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

Also available in: Atom PDF