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.43k stars 2.99k forks source link

QGIS hangs when trying to calculate new field via expression calculator on GPKG layer - if automatic transaction groups enabled #52277

Open phidrho opened 1 year ago

phidrho commented 1 year ago

What is the bug or the crash?

Recently QGIS started to stuck on some endless loop when trying to create a new field on GPKG layer. I've tried to wait for a few hours, but it seems it never ends. I've tried to update to latest release (3.30 RC) but bug is still present. I first noticed it on 3.28. (can't remember subversion number), but didn't found existing bug report. Bug doesn't happen on SHP file format, and I did not test any other data sources except GPKG and SHP.

Here is a dataset including project for replicating bug: new_field_via_expression_calculator_gpkg_bug_qgis3-28.zip

Video demo: youtube

EDIT: I just tried to change "Transaction mode" to "Local Edit Buffer" from "Automatic Transaction Groups" and problem doesn't appear

Steps to reproduce the issue

IMPORTANT: you need to select "Automatic transaction group" for Transaction mode in Data Sources section under Project properties

  1. download zip with dataset and project linked above
  2. create a new field on GPKG layer via field calculator: to_int(string_to_array("nationalCadastralReference",'-','0')[0])
  3. QGIS freezes here after getting to 100% (I've waited for few hours)
  4. optional: try the same on SHP layer with expression: to_int(string_to_array("nationalCa",'-','0')[0])

Versions

QGIS version 3.30.0-'s-Hertogenbosch QGIS code revision f186b8efe0e Qt version 5.15.3 Python version 3.9.5 GDAL/OGR version 3.6.2 PROJ version 9.1.1 EPSG Registry database version v10.076 (2022-08-31) GEOS version 3.11.1-CAPI-1.17.1 SQLite version 3.39.4 PDAL version 2.4.3 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.13.1 OS version Windows 10 Version 2009

Active Python plugins db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.6 processing 2.12.99

Supported QGIS version

New profile

Additional context

I tested it also on Win10, but didn't on any Linux device.

elpaso commented 1 year ago

I cannot reproduce on current master/Linux, is this specific to windows?

phidrho commented 1 year ago

Hi @elpaso sorry for the late reply.

I just tried to test this again on a full clean installation of brand new QGIS 3.32 on Windows 11 (Win 11 Pro 22H2) on a fairly new laptop (Core i7-11370H 11th Gen 4 cores 8 threads @3.3GHz, with 16 gigs of RAM and Intel Iris Xe + Nvidia GeForce 3050 Ti Laptop), and I can confirm problem still exists. The processor is stuck at 30% all the time and QGIS hangs. QGIS memory usage is going up and down, it started from 200 MB and went up to more than 700, then again went down to 400 and started slowly rising again. It's been more than 5 minutes now and processing is still active (the user interface still hangs).

If I can do anything more to test this more thoroughly, please give me some instructions.

image

phidrho commented 1 year ago

I am also testing this now on Kubuntu 20.04 (QGIS 3.30.3 installed via Flatpak) and I'm getting same behavior as in Windows - QGIS is hanging after coming to 100% on the status bar, and processor is working hard, RAM usage is slowly increasing with time:

image image

Please note that you need enable the Automatic transaction group for this bug to appear - I've added it to Steps for reproduce section.