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

QGIS can corrupt GeoPackages #54241

Open dlejay opened 1 year ago

dlejay commented 1 year ago

What is the bug or the crash?

The following has happened to me twice in a couple days : I connect to a GeoPackage (which already has some layers in it) in QGIS, I add some layers, rename some. Then I quit QGIS without saving.

When I reopen QGIS, I am told that several layers cannot be recovered (this is expected) but then, when I try to use the GeoPackage, the only thing I get is “layer is not valid” → all the data is lost.

Steps to reproduce the issue

I could not pin point the exact steps I took. But the same problem happened to me twice, each time after several hours of work, saved in a GeoPackage.

Versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.28.9-Firenze | QGIS code revision | 66f4d63ad4 -- | -- | -- | -- Qt version | 5.15.2 Python version | 3.9.5 GDAL/OGR version | 3.3.2 PROJ version | 8.1.1 EPSG Registry database version | v10.028 (2021-07-07) GEOS version | 3.9.1-CAPI-1.14.2 SQLite version | 3.35.2 PDAL version | 2.3.0 PostgreSQL client version | unknown SpatiaLite version | 5.0.1 QWT version | 6.1.6 QScintilla2 version | 2.11.5 OS version | macOS 13.4   |   |   |   Active Python plugins QuickOSM | 2.2.2 profiletool | 4.2.6 DataPlotly | 4.0.3 processing_saga_nextgen | 0.0.7 Serval | 3.10.5 rasterdataplotting | 1.6.3 valuetool | 3.0.15 processing | 2.12.99 sagaprovider | 2.12.99 grassprovider | 2.12.99 db_manager | 0.1.20 MetaSearch | 0.3.6 QGIS version 3.28.9-Firenze QGIS code revision [66f4d63ad4](https://github.com/qgis/QGIS/commit/66f4d63ad4) Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.3.2 PROJ version 8.1.1 EPSG Registry database version v10.028 (2021-07-07) GEOS version 3.9.1-CAPI-1.14.2 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.11.5 OS version macOS 13.4 Active Python plugins QuickOSM 2.2.2 profiletool 4.2.6 DataPlotly 4.0.3 processing_saga_nextgen 0.0.7 Serval 3.10.5 rasterdataplotting 1.6.3 valuetool 3.0.15 processing 2.12.99 sagaprovider 2.12.99 grassprovider 2.12.99 db_manager 0.1.20 MetaSearch 0.3.6 ### Supported QGIS version - [X] I'm running a supported QGIS version according to [the roadmap](https://www.qgis.org/en/site/getinvolved/development/roadmap.html#release-schedule). ### New profile - [ ] I tried with a new [QGIS profile](https://docs.qgis.org/latest/en/docs/user_manual/introduction/qgis_configuration.html#working-with-user-profiles) ### Additional context Losing QGIS data is something I can expect when I use the software. Losing separate data is something that troubles me.
agiudiceandrea commented 1 year ago

@dlejay, thanks for reporting the issue. Anyway, it could be very difficult for a dev to verify, debug and fix the issue without a sample layer and exact steps to replicate the issue.

nicogodet commented 1 year ago

@dlejay You are on MacOS which has very old dependencies... I saw some geopackage bug being fixed in recent GDAL version.

Could you try to use workarounds decribed here : https://github.com/qgis/QGIS/issues/54009#issuecomment-1659705805 or https://github.com/qgis/QGIS/issues/54009#issuecomment-1660136253 ? And retry to corrupt a geopackage with a recent version of GDAL ?

I know this is inconvenient but currently, there is no other option to have updated dependencies for MacOS

dlejay commented 1 year ago

@nicogodet Unfortunately, I tried to find a simple list of steps to corrupt a GeoPackage on purpose ; but failed.

dlejay commented 1 year ago

I have some news : the bug happened to me again two minutes ago. This time, the only operations involved are :

→ When QGIS starts again all layers are replaced by this message

Screenshot 2023-08-23 at 15 53 29

@nicogodet I'll look at your proposal.

agiudiceandrea commented 1 year ago

I have some news : the bug happened to me again two minutes ago. This time, the only operations involved are :

  • drag and drop tiffs to the GeoPackage (marked as successful by QGIS)
  • Save and Quit QGIS

→ When QGIS starts again all layers are replaced by this message

Screenshot 2023-08-23 at 15 53 29

@nicogodet I'll look at your proposal.

If the bug is reproducible, please provide the involved layers.

nilason commented 1 year ago

I know this is inconvenient but currently, there is no other option to have updated dependencies for MacOS

There is, with MacPorts https://qgis.org/en/site/forusers/alldownloads.html#macports.