gacarrillor / AppendFeaturesToLayer

QGIS Processing plugin to add an algorithm for upserting features from a source vector layer to an existing target vector layer.
23 stars 4 forks source link

QGIS Crash #28

Closed grantboxer closed 8 months ago

grantboxer commented 10 months ago

I am trying to append layers between two geopackages - same structure - but it is causing a QGIS crash. Any thoughts?

Seems to run the append, then crashes. See stack trace below,

Cheers Grant

Report Details

Python Stack Trace

Windows fatal exception: access violation

Thread 0x00000f98 (most recent call first):
  File "C:\OSGeo4W/apps/qgis/./python\qgis\core\additions\edit.py", line 43 in __exit__
    if not self.layer.commitChanges():
  File "C:\Users/Grant/AppData/Roaming/QGIS/QGIS3\profiles\Grant/python/plugins\AppendFeaturesToLayer\processing\algs\AppendFeaturesToLayer.py", line 344 in processAlgorithm
    target.endEditCommand()

Current thread 0x000050d8 (most recent call first):
  File "C:\OSGeo4W/apps/qgis/./python/plugins\processing\ProcessingPlugin.py", line 432 in executeAlgorithm
    dlg.exec_()
  File "C:\OSGeo4W/apps/qgis/./python/plugins\processing\gui\ProcessingToolbox.py", line 232 in executeAlgorithm
    self.executeWithGui.emit(alg.id(), self, self.in_place_mode, False)

Stack Trace


CPLODBCDriverInstaller::RemoveDriver :
QgsOgrProviderUtils::GDALOpenWrapper :
QgsPrecalculatedTextMetrics::count :
QgsOgrProviderUtils::wildcards :
QgsPrecalculatedTextMetrics::count :
QgsVectorLayerFeatureSource::QgsVectorLayerFeatureSource :
QgsVectorLayerProfileResults::visitFeaturesInRange :
QgsVectorLayer::createMapRenderer :
QgsMapRendererJob::prepareJobs :
QgsMapRendererParallelJob::startPrivate :
QgsMapCanvas::refreshMap :
QObject::qt_static_metacall :
QTimer::timerEvent :
QObject::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QEventDispatcherWin32Private::sendTimerEvent :
QEventDispatcherWin32::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QCoreApplicationPrivate::sendPostedEvents :
qt_plugin_query_metadata :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QDialog::exec :
PyInit_QtWidgets :
PyArg_ParseTuple_SizeT :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QObject::qt_static_metacall :
QMetaObject::activate :
PyInit_QtCore :
PyInit_QtCore :
PyType_GenericNew :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QObject::qt_static_metacall :
QAbstractItemView::doubleClicked :
QTreeView::mouseDoubleClickEvent :
PyInit__gui :
QWidget::event :
QFrame::event :
QAbstractItemView::viewportEvent :
PyInit__gui :
QCoreApplicationPrivate::sendThroughObjectEventFilters :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.34.2-Prizren QGIS code revision: 7d199797fc Compiled against Qt: 5.15.3 Running against Qt: 5.15.3 Compiled against GDAL: 3.8.2 Running against GDAL: 3.8.2

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

gacarrillor commented 10 months ago

Thanks for the report @grantboxer.

Could you please share sample data to replicate the issue?

grantboxer commented 10 months ago

This is the crash report below, link to files here "https://www.dropbox.com/scl/fo/kbklx26tu4tu5yk5mrt76/h?rlkey=yjvhxb8al1apyeepd70tjg6lg&dl=0".

Essentially what I am trying to do is update a QField project with new data collected in the field. So, I am trying to add the new points file to the existing points file in the original geopackage.

Hope that makes sense.

Cheers Grant

Report Details

Python Stack Trace

Windows fatal exception: access violation

Thread 0x00003418 (most recent call first):
  File "C:\OSGeo4W/apps/qgis/./python\qgis\core\additions\edit.py", line 43 in __exit__
    if not self.layer.commitChanges():
  File "C:\Users/Grant/AppData/Roaming/QGIS/QGIS3\profiles\Grant/python/plugins\AppendFeaturesToLayer\processing\algs\AppendFeaturesToLayer.py", line 344 in processAlgorithm
    target.endEditCommand()

Thread 0x0000348c (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 310 in _recv_bytes
    waitres = _winapi.WaitForMultipleObjects(
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 255 in recv
    buf = self._recv_bytes()
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 576 in _handle_results
    task = get()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 892 in run
    self._target(*self._args, **self._kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 954 in _bootstrap_inner
    self.run()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 912 in _bootstrap
    self._bootstrap_inner()

Thread 0x000009d0 (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 528 in _handle_tasks
    for taskseq, set_length in iter(taskqueue.get, None):
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 892 in run
    self._target(*self._args, **self._kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 954 in _bootstrap_inner
    self.run()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 912 in _bootstrap
    self._bootstrap_inner()

Thread 0x00003e74 (most recent call first):
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 816 in _exhaustive_wait
    res = _winapi.WaitForMultipleObjects(L, False, timeout)
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\connection.py", line 884 in wait
    ready_handles = _exhaustive_wait(waithandle_to_obj.keys(), timeout)
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 499 in _wait_for_updates
    wait(sentinels, timeout=timeout)
  File "C:\OSGeo4W\apps\Python39\lib\multiprocessing\pool.py", line 519 in _handle_workers
    cls._wait_for_updates(current_sentinels, change_notifier)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 892 in run
    self._target(*self._args, **self._kwargs)
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 954 in _bootstrap_inner
    self.run()
  File "C:\OSGeo4W\apps\Python39\lib\threading.py", line 912 in _bootstrap
    self._bootstrap_inner()

Current thread 0x000058b4 (most recent call first):
  File "C:\OSGeo4W/apps/qgis/./python/plugins\processing\ProcessingPlugin.py", line 432 in executeAlgorithm
    dlg.exec_()
  File "C:\OSGeo4W/apps/qgis/./python/plugins\processing\gui\ProcessingToolbox.py", line 232 in executeAlgorithm
    self.executeWithGui.emit(alg.id(), self, self.in_place_mode, False)

Stack Trace


QMimeType::staticMetaObject :
QgsVectorLayer::isModified :
QgisApp::updateLayerModifiedActions :
QgisApp::activateDeactivateLayerRelatedActions :
QgisApp::layerEditStateChanged :
QMetaCallEvent::placeMetaCall :
QObject::event :
QWidget::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QCoreApplicationPrivate::sendPostedEvents :
qt_plugin_query_metadata :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QDialog::exec :
PyInit_QtWidgets :
PyArg_ParseTuple_SizeT :
PyEval_EvalFrameDefault :
PyObject_GC_Del :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QObject::qt_static_metacall :
QMetaObject::activate :
PyInit_QtCore :
PyInit_QtCore :
PyType_GenericNew :
PyEval_EvalFrameDefault :
PyFunction_Vectorcall :
PyFloat_FromDouble :
PyVectorcall_Call :
PyObject_Call :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
PyInit_QtCore :
QObject::qt_static_metacall :
QAbstractItemView::doubleClicked :
QTreeView::mouseDoubleClickEvent :
PyInit__gui :
QWidget::event :
QFrame::event :
QAbstractItemView::viewportEvent :
PyInit__gui :
QCoreApplicationPrivate::sendThroughObjectEventFilters :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QApplicationPrivate::sendMouseEvent :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processMouseEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.34.2-Prizren QGIS code revision: 7d199797fc Compiled against Qt: 5.15.3 Running against Qt: 5.15.3 Compiled against GDAL: 3.8.2 Running against GDAL: 3.8.2

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

gacarrillor commented 10 months ago

Thanks for the sample data and the report.

It's working on QGIS master. So let's get more details.

I've tried with these 2 configurations:

1) image

2) image

However, so far I haven't tested on Windows.

What configuration are you using in the Processing algorithm dialog?

grantboxer commented 10 months ago

I was using append with no duplicates and using the Pt_name field to avoid overwriting existing points.

Should I install the dev master to see if it works with that version?

gacarrillor commented 10 months ago

Note that Just APPEND all features, no matter of duplicates actually means: All features in source layer will be appended to target layer. So, you cannot choose a field for that specific option (the algorithm won't run unless you leave the field parameters empty).

By the way, Pt_name does not exist as a field name in your sample data. Did you mean Point_id? If so, I wouldn't do it, because there are already duplicate values in Point_id.

I'll attempt to test on a Windows machine during the weekend. If you discover something (e.g., the algorithm works with certain parameters but not with others, or, on an empty project everything works as expected) please let me know.

grantboxer commented 10 months ago

I have just tried it again and it seems to work. The append all worked and the skip duplicates worked. I will try another data set and let you know if I have any problems. Thanks and cheers Grant

gacarrillor commented 8 months ago

I finally had access to a Windows machine. I tested 2 modes on QGIS 3.34.3:

Everything run smoothly.

I'll close this issue because I couldn't replicate it, and in your last comment you stated that it actually works. Feel free to reopen if you replicate the issue.