qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.58k stars 3k forks source link

Browser becomes slow/hangs on windows when network drives becomes unavailable #51710

Open LtGlahn opened 1 year ago

LtGlahn commented 1 year ago

What is the bug or the crash?

An unavailable network drive will cause QGIS browser panel to freeze / become sluggish, effectively causing QGIS to be unusable. Not sure how this is on other platforms, but this is absolutely an issue on Windows. All work-related windows PC can be expected to have at least one network drive, so this problem is extra painful for those using - or trying for the first time - QGIS in a professional context where the work computer is a windows PC.

Yes, I am very well aware that you can remove those network connections manually, or tell QGIS to NOT observe those folders in real time. But this is NOT user friendly behavior, and only die-hard QGIS users (like myself) will google, find and implement this tricks.

New users will try QGIS. Those whose PC is disconnected from one network drive will experience this problem and leave QGIS forever.

Steps to reproduce the issue

  1. Install QGIS on a windows systems with network drives (i.e. your typical work PC)
  2. Make sure at least one network drive is disconnected (i.e. take your computer away from your office network)
  3. Open the browser panel
  4. Navigate into a random folder - doesn't matter where, it can be C or any other network drve
  5. Watch qgis grind to halt, or be come sluggish to the point of being unusabe

Versions

QGIS-versjon 3.28.2-Firenze QGIS-kodeversjon b47e00ba601 Qt-versjon 5.15.3 Python-versjon 3.9.5 GDAL/OGR-versjon 3.6.1 PROJ-versjon 9.1.1 Databaseversjon til EPSG-register v10.076 (2022-08-31) GEOS-versjon 3.11.1-CAPI-1.17.1 SQLite-versjon 3.39.4 PDAL-versjon 2.4.3 PostgreSQL-klientversjon unknown SpatiaLite-versjon 5.0.1 QWT-versjon 6.1.6 QScintilla2-versjon 2.13.1 OS-versjon Windows 10 Version 2009

Aktive Python-programtillegg QuickOSM 2.1.1 QuickWKT 3.1 quick_map_services 0.19.32 wfsclient 0.9.11 db_manager 0.1.20 MetaSearch 0.3.6 processing 2.12.99

Supported QGIS version

New profile

Additional context

No response

roya0045 commented 1 year ago

Duplicate of #51226 (possibly of many other)

pathmapper commented 1 year ago

leave QGIS forever.

I heard such complaints recently, this issue happens often when VPN is used -> #37324

Klaus-PVA commented 1 year ago

A duplicate of so many Bug Reports, especially closed ones that claimed to have it fixed. But over the years it's appearing again and again and its still there. Tested today with fresh installed QGIS: 3.28.3 with new Profile on Windows 10 Version 2009.

My suggestion is also to make the browser a separate thread so the main program can be used during the connection process.

QGIS User Group Germany has offered help if funds are needed for this. If anyone likes to take this advantage im happy to help to get in contact with them.

LtGlahn commented 1 year ago

I'd also like to mention that if I would very much like to file a bug report on the general user experience of the file browser - but I am struggling with how to formulate the problem in a way that developers can relate to, i.e. a way to reproduce my experience: The browser frequently becomes sluggish and unresponsive, borderline unusable for the impatient, but somewhat usable if you dose yourself with patience. The sluggish behavior seems to occur whenever I open a directory with geopackage files (and probably other data files as well), making me guess that QGIS does a scan of the content (which takes time, leaving me with an unresponsive system). It is also sluggish whenever I open one of those geopackage files, no matter if those are tiny data sets.

Not entirely sure if my settings are optimal, but it seems you need to hide ALL network drives and disable both "monitor changes" and "quick read" options for the remaining (local) drives. Best so far, it seems.

image

elpaso commented 1 year ago

May I suggest you to reword the title of this issue?

QGIS is neither a person a company or a legal entity but a community of users and developers, I don't get to whom "must" is addressed.

pathmapper commented 1 year ago

Related thread -> [Qgis-user] painful file-browser

Jeroen-GroeneBij commented 1 year ago

In stead of opening a new bug report, I would like to support this one. I am also having increasing issues with very slow responsiveness in the browser panel and in rendering .gpkg when these are stored on a NAS. It is hard to come up with good tests and replications, but the problem is getting worse in later QGIS versions. 3.16 was fine, 3.22 a bit less fine, 3.28 is much worse and 3.30 is awful as well.

I support the idea that it has something to do with scanning all content in the folders clicked. Opening the Windows Task Manager I can see lot of network-traffic , peaking over 100 Mbits/s for just browsing and opening folders in the Browser panel. Often I just can't add a single layer due to unresponsiveness. These are layers of just a few hundred kB.

If anyone has any good ideas on testing this? The only constant thing is, that this is only happening on my NASdrive, not on local drives.

I will start with some teste on an empty folder and one by one adding different files types: gpkg, shp, gjon, but also pdf and zip.

nyalldawson commented 1 year ago

For those impacted by this slowness: Can you please run the following commands in the Python console and report the results?

# replace this with the actual path to the network drive, using forward slashes:
drive_path = 'f:/'
print(QgsFileUtils.driveType(drive_path))
print(QgsFileUtils.pathIsSlowDevice(drive_path))
Klaus-PVA commented 1 year ago

On my homeoffice computer, no matter if connected via VPN or not, i get these results:

drive_path = 'f:/' print(QgsFileUtils.driveType(drive_path)) DriveType.Remote print(QgsFileUtils.pathIsSlowDevice(drive_path)) True

I also get these results on my computer in the office which is directly connected to the network drive.

LtGlahn commented 1 year ago

My local hard drive drive_path = 'c:/' print(QgsFileUtils.driveType(drive_path)) DriveType.Fixed print(QgsFileUtils.pathIsSlowDevice(drive_path)) False

(yes, sluggish and slow, even at my C-drive)

Repeating for a (temporarily) disconnected network drive (not currently at my office network) drive_path = 'o:/' print(QgsFileUtils.driveType(drive_path)) DriveType.Remote print(QgsFileUtils.pathIsSlowDevice(drive_path)) True

Jeroen-GroeneBij commented 1 year ago

My NAS drive

drive_path = "//mollie218/home/GroeneBij_NAS/01KAARTEN" print(QgsFileUtils.driveType(drive_path)) DriveType.Fixed print(QgsFileUtils.pathIsSlowDevice(drive_path)) False

Even diving deep into the folder structure, it still says False drive_path = "//mollie218/home/GroeneBij_NAS/01KAARTEN/1 PROJECTMAPPEN/2 traningen/Gevorderd/Voor_docenten/oefeningen" print(QgsFileUtils.pathIsSlowDevice(drive_path)) False

nicogodet commented 1 year ago

In my company, windows drive T: is mapped to \\islsudouest\affaires. image

>>> drive_path = 'T:/'
>>> print(QgsFileUtils.driveType(drive_path))
DriveType.Remote
>>> print(QgsFileUtils.pathIsSlowDevice(drive_path))
True
>>> drive_path = '//islsudouest/affaires'
>>> print(QgsFileUtils.driveType(drive_path))
DriveType.Fixed
>>> print(QgsFileUtils.pathIsSlowDevice(drive_path))
False
Hannes-Ole commented 1 year ago

I have the same issues and the same setup as @nicogodet In my company, windows drive P: is mapped to \xyz.org\data

drive_path = 'P:/'
print(QgsFileUtils.pathIsSlowDevice(drive_path))
>True
print(QgsFileUtils.driveType(drive_path))
>DriveType.Remote

drive_path = '//xyz.org/data/'
print(QgsFileUtils.pathIsSlowDevice(drive_path))
>False
print(QgsFileUtils.driveType(drive_path))
>DriveType.Fixed
ArnoGitHub commented 11 months ago

Still the same problem with QGIS 3.34.0 - Prizren

markmapper commented 8 months ago

Is this likely to be fixed, we are noticing this slowness more and more to the point of nearly unworkable

Hannes-Ole commented 8 months ago

There is a workaround that may help in some cases: https://gis.stackexchange.com/questions/403343/what-can-be-a-reason-of-qgis-slow-work

elpaso commented 7 months ago

I've received funds from QGIS user group Germany (QGIS Anwendergruppe Deutschland e.V.) to investigate this issue.

This ticket has become a list of complaints about browser slowness on different scenarios that might be or might not be related from an implementation perspective.

Therefore I will be focusing on one particular issue which is the slowness when a network (SMB) mapped drive (such a Y:) becomes unavailable after being browsed, the procedure to reproduce is:

  1. Have network drives attached and a connection via LAN (e.g. Y:)
  2. Open QGIS
  3. Browse through the network drives via QGIS browser
  4. Close all open folders (via the "arrow up" in QGIS browser)
  5. Disconnect LAN connection
  6. Try to browse again network drives via QGIS Browser
elpaso commented 7 months ago

I need some volunteers to test https://github.com/qgis/QGIS/pull/56847 when ready (please add feedback comments in that PR and not here), it will certainly help in reducing the slowness on disconnected mapped drives but it would be interesting to check if that also helps with other scenarios.

pathmapper commented 7 months ago

I need some volunteers to test https://github.com/qgis/QGIS/pull/56847 when ready

As a reminder, there's a "Test QGIS" (Windows .exe) that can be downloaded from https://github.com/qgis/QGIS/pull/56847 if you're logged in to GitHub:

image

Klaus-PVA commented 7 months ago

It seems do work :-)

After the first start i clicked on the browser tab in the datasource-manager and QGIS froze for many minutes. But after that i could open the browser-panel without any issues or delays. When i click on unreachable drives a sandclock on the drive-icon indicates business, but QGIS still keeps usable. I can click anywhere else and QGIS reacts as hoped. After the second start of the programm there was no initial freezing anymore.

Thank you for the great job.

elpaso commented 7 months ago

It seems do work :-)

The CI build uses a different compiler than the official releases, I'll merge the PR and then you can test the nightly build tomorrow to check if the improvement is still real.

Klaus-PVA commented 7 months ago

Nightly works too. Also after connecting to and disconnecting from VPN the browser worked without freezing.

Thank you very much for fixing this.

Klaus-PVA commented 7 months ago

Tested the backport to 3.36.1-QGIS-Codeversion 3e589453 either as OSGeo4W and MSI installation.

With both the program freezes at the start or the first activation of the browser. If i start QGIS with deactivated browser-panel it needs 18sec. When i then activate the browser it hangs for 50sec. If i start QGIS with active browser it takes 68sec. It freezes after the splashscreen says "QGIS is ready!"

I tested these scenarios several times (including rebooting the system) all with the same result. Except at the very first start of the new installation or after using a different QGIS-version inbetween it took 2:20 min to open the browser.

But good news after that initial freeze there is no further delay even when i try to refresh unreachable drives.

pathmapper commented 7 months ago

@Klaus-PVA did you try with a new/fresh user profile?

Klaus-PVA commented 7 months ago

Thanks for the reminder, yes i did.

Klaus-PVA commented 6 months ago

Just an addition. The freezing at the start of QGIS or at the first call of the browser only appears when drives are unreachable. As soon as the system is connected via VPN everything works immediatelly. Also on a different computer that is directly connected via LAN there is no delay at all.

andreasneumann commented 6 months ago

Just an addition. The freezing at the start of QGIS or at the first call of the browser only appears when drives are unreachable. As soon as the system is connected via VPN everything works immediatelly.

@Klaus-PVA does the Windows Explorer show the same behavior? Is it also hanging for many seconds when the drives are not available?

I have a similar system with Windows 11, VPN (Cisco Secure Client Anyconnect) - and it appears that the whole Windows explorer hangs for at least 20-30 seconds when VPN is not active and one attempts to open a network drive that is not available.

It might also be that the VPN has some configuration options to improve the situation.

Klaus-PVA commented 6 months ago

@andreasneumann you're right. And the difference is exactly that the Windows Explorer only hangs when i try to open such specific drives and not upfront. That part was already elegantly solved by @elpaso with a little sandclock at the icon of the drive in the browser which runs in background and gives you full access to QGIS while it tries to scan the drive.