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

PyQGIS crash when running QgsMeshLayer in a loop with simple processing algorithm #56996

Closed Moawadal closed 7 months ago

Moawadal commented 7 months ago

What is the bug or the crash?

PyQGIS crashes when I run in a for loop a simple processing algorithm on QgsMeshLayer output.

Steps to reproduce the issue

  1. Read mesh layer (.2dm) from a path using QgsMeshLayer(MESH_PATH, "Mesh Layer", "mdal")
  2. Add datasets to the mesh layer (.xdmf) using .addDatasets(result_path)
  3. Rasterize mesh dataset using processing.run("native:meshrasterize")

Versions

Report Details

Python Stack Trace

Windows fatal exception: access violation

Current thread 0x00001b68 (most recent call first):
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python/plugins\processing\gui\AlgorithmExecutor.py", line 70 in execute
    results, ok = alg.run(parameters, context, feedback, {}, False)
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python/plugins\processing\core\Processing.py", line 176 in runAlgorithm
    ret, results = execute(alg, parameters, context, feedback, catch_exceptions=False)
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python/plugins\processing\tools\general.py", line 109 in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
  File "C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib\code.py", line 90 in runcode
    exec(code, self.locals)
  File "C:\PROGRA~1\QGIS33~1.5\apps\Python39\lib\code.py", line 74 in runsource
    self.runcode(code)
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python\console\console_sci.py", line 251 in runsource
    return super(PythonInterpreter, self).runsource(source, filename, symbol)
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python\console\console_sci.py", line 228 in execCommandImpl
    res = self.runsource(src)
  File "C:\PROGRA~1/QGIS33~1.5/apps/qgis-ltr/./python\console\console_sci.py", line 353 in keyPressEvent
    super().keyPressEvent(e)

Stack Trace


QgsMeshLayerElevationProperties::writeXml :
QgsMeshUtils::exportRasterBlock :
QgsMeshContours::operator= :
QgsProcessingAlgorithm::runPrepared :
QgsProcessingAlgorithm::run :
pdal::Option::getName :
PyObject_Str :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFunction_Vectorcall :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFunction_Vectorcall :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFunction_Vectorcall :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyEval_EvalCodeWithName :
PyEval_EvalCodeEx :
PyEval_EvalCode :
PyCodec_DecodeText :
PyCodec_DecodeText :
PyEval_EvalFrameDefault :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyObject_GC_Del :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFunction_Vectorcall :
PyObject_GC_Del :
PyVectorcall_Call :
PyObject_Call :
PyInit__gui :
QgsCodeEditor::runCommand :
QgsCodeEditor::keyPressEvent :
QgsCodeEditorPython::keyPressEvent :
PyInit__gui :
PyObject_Str :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFunction_Vectorcall :
PyObject_GC_Del :
PyVectorcall_Call :
PyObject_Call :
PyInit__gui :
QWidget::event :
QFrame::event :
QAbstractScrollArea::event :
PyInit__gui :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processKeyEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.34.5-Prizren QGIS code revision: 4b308492 Compiled against Qt: 5.15.3 Running against Qt: 5.15.3 Compiled against GDAL: 3.8.4 Running against GDAL: 3.8.4

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.19045

Supported QGIS version

New profile

Additional context

This workflow ran very well 5 days ago. Since yesterday it has started to crash. It has been tested on QGIS 3.34.5 LTR and QGIS 3.34.0 and is showing the same crash.

Moawadal commented 7 months ago

the same script that did not work previously now works! No idea why.