Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QMS plugin crashes in master #60286

Closed
2 tasks done
pigreco opened this issue Jan 27, 2025 · 12 comments · Fixed by #60363
Closed
2 tasks done

QMS plugin crashes in master #60286

pigreco opened this issue Jan 27, 2025 · 12 comments · Fixed by #60363
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption PyQGIS Related to the PyQGIS API

Comments

@pigreco
Copy link
Contributor

pigreco commented Jan 27, 2025

What is the bug or the crash?

in the master update now, starting the QMS plugin, QGIS crashes

Image

## Report Details

**Python Stack Trace**

Windows fatal exception: access violation

Current thread 0x000064c0 (most recent call first):
  File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\quick_map_services\qgis_map_helpers.py", line 174 in add_layer_to_map
    layer.setAttribution(ds.copyright_text)
  File "C:\Users/pigre/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\quick_map_services\quick_map_services.py", line 199 in insert_layer
    add_layer_to_map(ds)


**Stack Trace**
No stack trace is available.


**QGIS Info**
QGIS Version: 3.41.0-Master
QGIS code revision: 9e25ade872
Compiled against Qt: 5.15.13
Running against Qt: 5.15.13
Compiled against GDAL: 3.11.0dev-6074ce4975
Running against GDAL: 3.11.0dev-6074ce4975



**System Info**
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.22631

Steps to reproduce the issue

  1. start the master
  2. load the OSM background map using the QMS plugin

Versions

Versione di QGIS3.41.0-Master
Revisione codice QGIS9e25ade872
 
Librerie
Versione Qt5.15.13
Versione Python3.12.8
Versione GDAL/OGR3.11.0dev-6074ce4975
Versione PROJ9.5.1
Versione database del Registro EPSGv11.022 (2024-11-05)
Versione GEOS3.13.0-CAPI-1.19.0
Versione SQLite3.46.1
Versione PDAL2.8.3
Versione client PostgreSQLunknown
Versione SpatiaLite5.1.0
Versione QWT6.3.0
Versione QScintilla22.14.1
Versione SOWindows 11 Version 2009
Questa copia di QGIS scrive messaggi di debug.
 
Plugins Python attivi
DataPlotly4.2.0
filtra_selecionados1.2
gensimplot2.1
gimpselectionfeature_plugin1.6
GroupStats2.2.7
latlontools3.7.2
nominatim_locator_filter0.3.2
pointsamplingtool0.5.4
profile-manager0.31
qconsolidate1.1.0
qduckdb1.2.1
qgis_plugin_gpq_downloader0.3.4
QuickOSM2.3.2
quick_map_services0.19.37
Split-Lines-By-Points-main1.0
ViewshedAnalysis1.9.1
db_manager0.1.20
MetaSearch0.3.6
processing2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@pigreco pigreco added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins labels Jan 27, 2025
@rouault
Copy link
Contributor

rouault commented Jan 27, 2025

That should be reported to the authors of the plugin at https://github.com/nextgis/quickmapservices so they investigate if that's a misuse of the QGIS API from their side or really a QGIS issue

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 27, 2025

The crash occurs on Windows 10 running the latest QGIS 3.41.0-Master 9e25ade (Jan 25, 2025) and f33604b (Jan 23, 2025) from OSGeo4W (using Python 3.12.8 and python3-sip 6.9.1) with the latest plugin version 0.19.37 and also with previous ones (0.19.36, 0.19.35, 0.19.34).

The crash doesn't occur on the same system running QGIS 3.41.0-Master f999386 (Jan 12, 2025) from OSGeo4W (using Python 3.12.8 and python3-sip 6.8.3) either with the latest plugin version or with the previous ones.

@rouault, the following simple -supposedly legit- Python code executed in the Python console makes QGIS 3.41.0-Master 9e25ade crash:

layer = QgsVectorLayer("Point?field=fldtxt:string&field=fldint:integer", "testlayer", "memory")
layer.setAttribution("test")

There is a test in place

layer.setAttribution("MyAttribution")

Maybe it's a Windows \ OSGeo4W specific issue.

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 27, 2025

Maybe it's a Windows \ OSGeo4W specific issue.

It looks like an OSGeo4W specific issue: the crash doesn't occur on the same system running a MingW64 build (using Python 3.11.10, sip 6.7.10) at the same commit.

Ping @jef-n.

@nyalldawson
Copy link
Collaborator

May be because setAttribution is deprecated, so could be fallout from #59834

It would be interesting to see if other deprecated methods cause crashes on that build.

@agiudiceandrea
Copy link
Contributor

It would be interesting to see if other deprecated methods cause crashes on that build.

@nyalldawson, it looks like the crash occurs with deprecated methods of QgsMapLayer involving QGIS Server (abstract, setAbstract, attribution, setAttribution, ...) while it doesn't occur with deprecated methods like hasAutoRefreshEnabled and setAutoRefreshEnabled.
The crash also occurs with other deprecated methods in other classes, e.g. QgsProject().fileInfo().

@nyalldawson
Copy link
Collaborator

ok, let's see if @troopa81 has any insights...

@agiudiceandrea agiudiceandrea added PyQGIS Related to the PyQGIS API Crash/Data Corruption Windows Related to Windows operating system and removed Plugins labels Jan 28, 2025
@troopa81
Copy link
Contributor

Ouch... I'm gonna build a Windows dev env and try to reproduce ...

@jef-n
Copy link
Member

jef-n commented Jan 28, 2025

iface.activeLayer().attribution() crashes too. Using serverProperties() helps

174             if hasattr(layer, 'serverProperties'):
175                 layer.serverProperties().setAttribution(ds.copyright_text)
176                 layer.serverProperties().setAttributionUrl(ds.copyright_link)
177             else:
178                 layer.setAttribution(ds.copyright_text)
179                 layer.setAttributionUrl(ds.copyright_link)

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 28, 2025

@jef-n, indeed the crash occurs with various methods of QgsMapLayer e.g. abstract, setAbstract, attribution, setAttribution, shortName, setShortName ... but not with e.g. hasAutoRefreshEnabled and setAutoRefreshEnabled, and also occurs e.g. with QgsProject().fileInfo().
The crash didn't occur running QGIS 3.41.0-Master f999386 (Jan 12, 2025 - Python 3.12.8, python3-sip 6.8.3) and previous versions.
The crash occurs using QGIS 3.41.0-Master f33604b (Jan 23, 2025 - Python 3.12.8, python3-sip 6.9.1), 9e25ade (Jan 25, 2025 - Python 3.12.8, python3-sip 6.9.1) and subsequent versions, while it doesn't occur running a MingW64 build (https://github.com/qgis/QGIS/actions/runs/12963618546) at the same commit 9e25ade (Python 3.11.10, sip 6.7.10).

@jef-n
Copy link
Member

jef-n commented Jan 28, 2025

also happens on debian

gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1  0x00007fffe509ddef in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:78
#2  0x00007fffe5049d02 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007fffe50324f0 in __GI_abort () at ./stdlib/abort.c:79
#4  0x00007fffe503332d in __libc_message_impl (fmt=fmt@entry=0x7fffe51b517a "*** %s ***: terminated\n") at ../sysdeps/posix/libc_fatal.c:132
#5  0x00007fffe51263f5 in __GI___fortify_fail (msg=msg@entry=0x7fffe51b5192 "stack smashing detected") at ./debug/fortify_fail.c:24
#6  0x00007fffe51275e0 in __stack_chk_fail () at ./debug/stack_chk_fail.c:24
#7  0x00007fff9003b0f4 in sip_api_deprecated_12_16 () at /usr/lib/python3/dist-packages/PyQt5/sip.cpython-313-x86_64-linux-gnu.so
#8  0x00007ffeea3b185f in meth_QgsProject_fileInfo (sipSelf=<QgsProject at remote 0x7ffee7533530>, sipArgs=()) at ./debian/build/python/core/build/_core/sip_corepart9.cpp:49951

@agiudiceandrea agiudiceandrea removed the Windows Related to Windows operating system label Jan 28, 2025
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 29, 2025

The crash doesn't occur on Ubuntu 22.04.1 running QGIS 3.41.0-Master 6f4df5d (Jan 2, 2025, from https://ubuntu.qgis.org/ubuntu-nightly/).

@troopa81
Copy link
Contributor

@agiudiceandrea @jef-n Thank you for the report. I'm suspecting that pyqt-sip module is not build against the same sip build than the qgis package. Because in the @jef-n stacktrace we see that it crashes when calling sip_api_precated_12_16, and I presume the symbol is missing.

I'm rebuilding to test a little bit more thoroughly, but I think I'm gonna disable the deprecated support until I figured out what the issue reaaly is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption PyQGIS Related to the PyQGIS API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants