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

Crash using Geometry Checker plugin #21577

Closed
qgib opened this issue Oct 6, 2015 · 38 comments
Closed

Crash using Geometry Checker plugin #21577

qgib opened this issue Oct 6, 2015 · 38 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins

Comments

@qgib
Copy link
Contributor

qgib commented Oct 6, 2015

Author Name: Salvatore Larosa (@slarosa)
Original Redmine Issue: 13535
Affected QGIS version: master
Redmine category:c++_plugins/geometry_checker
Assignee: Sandro Mani


Performing a check on a Polygon layer (attached) I am getting the following stacktrace:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff6b54d700 (LWP 1838)]
0x00007fffee99b165 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#_0  0x00007fffee99b165 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#_1  0x00007fffee99e3e0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#_2  0x00007fffee9d539b in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#_3  0x00007fffee9debe6 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#_4  0x00007fffee9e398c in free () from /lib/x86_64-linux-gnu/libc.so.6
#_5  0x00007ffff41465ca in QgsGeos::~QgsGeos (this=0x7fff74114840, __in_chrg=<optimized out>)
    at /home/sam/pacchetti_gis/QGIS/src/core/geometry/qgsgeos.cpp:137
#_6  0x00007fffd415d310 in QgsGeometryDuplicateCheck::collectErrors (this=0x40280c0, errors=..., messages=..., progressCounter=0x3eb3f4c, ids=...)
    at /home/sam/pacchetti_gis/QGIS/src/plugins/geometry_checker/checks/qgsgeometryduplicatecheck.cpp:58
#_7  0x00007fffd414cd73 in QgsGeometryChecker::runCheck (this=0x3eb3f10, check=0x40280c0)
    at /home/sam/pacchetti_gis/QGIS/src/plugins/geometry_checker/qgsgeometrychecker.cpp:243
#_8  0x00007fffd414d67c in QgsGeometryChecker::RunCheckWrapper::operator() (this=0x3f31058, check=0x40280c0)
    at /home/sam/pacchetti_gis/QGIS/src/plugins/geometry_checker/qgsgeometrychecker.h:57
#_9  0x00007fffd4151cd3 in QtConcurrent::MapKernel<QList<QgsGeometryCheck*>::iterator, QgsGeometryChecker::RunCheckWrapper>::runIteration (this=
    0x3f31020, it=...) at /usr/include/qt4/QtCore/qtconcurrentmapkernel.h:73
#_10 0x00007fffd4151d57 in QtConcurrent::MapKernel<QList<QgsGeometryCheck*>::iterator, QgsGeometryChecker::RunCheckWrapper>::runIterations (this=
    0x3f31020, sequenceBeginIterator=..., beginIndex=2, endIndex=3) at /usr/include/qt4/QtCore/qtconcurrentmapkernel.h:82
#_11 0x00007fffd4152205 in QtConcurrent::IterateKernel<QList<QgsGeometryCheck*>::iterator, void>::forThreadFunction (this=0x3f31020)
    at /usr/include/qt4/QtCore/qtconcurrentiteratekernel.h:263
#_12 0x00007fffd4151ee8 in QtConcurrent::IterateKernel<QList<QgsGeometryCheck*>::iterator, void>::threadFunction (this=0x3f31020)
    at /usr/include/qt4/QtCore/qtconcurrentiteratekernel.h:225
#_13 0x00007ffff1fc1b85 in QtConcurrent::ThreadEngineBase::run() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_14 0x00007ffff1fc36bd in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_15 0x00007ffff1fcfd0b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_16 0x00007fffee753b50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#_17 0x00007fffeea4495d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#_18 0x0000000000000000 in ?? ()


@qgib
Copy link
Contributor Author

qgib commented Oct 6, 2015

Author Name: Salvatore Larosa (@slarosa)


Sandro Mani seems not to be into the "assigned to" list. How can I notify this to him?

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Giovanni Manghi (@gioman)


  • assigned_to_id was configured as Sandro Mani
  • fixed_version_id was configured as Future Release - High Priority

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Giovanni Manghi (@gioman)


These days I can only test master on Windows and I confirm the crash when trying to fix a simple polygon with 1 self-intersection when choosing "split feature into multi object feature".

On the other end if choosing "split feature in multiple single-object features" do no causes crash, but one of the two (supposedly) output polygons is lost.

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Giovanni Manghi (@gioman)


Salvatore Larosa wrote:

Sandro Mani seems not to be into the "assigned to" list. How can I notify this to him?

I have added to the list... but then it depends if he configured his account to receive notifications from tickets, so maybe is better to notify him directly too.

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Sandro Mani (Sandro Mani)


I got the notifications. Thanks for reporting the issues, I'll look into them.

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Sandro Mani (Sandro Mani)


@giovanni Manghi: I see a crash when I zoom on the canvas after the self-intersection fix is complete (i.e. when fix summary dialog is shown). This appears to be caused by corruption in the wkb string of the geometry, even though it looks correct as it is returned by QgsGeometryCollectionV2::asWkb - the corruption appears to happen later on in QgsMapToPixelSimplifier::simplifyWkbGeometry. Can you confirm that this is the same issue you are seeing?

Salvatore Larosa: Could you please specify which checks are active when you trigger the crash?

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Sandro Mani (Sandro Mani)


So the actual cause of the post-self-intersection fix crash I described above is that QgsMapToPixelSimplifier does not handle curved geometries correctly. Curved geometries arose because the self-intersection fix created new parts as CurvePolygons. I've changed this [1] and now if the original feature was a linear polygon, then the new part will also be one. This prevents the crash from happening when fixing linear polygons, but the issue with QgsMapToPixelSimplifier remains.

[1] manisandro@af98333

@qgib
Copy link
Contributor Author

qgib commented Oct 8, 2015

Author Name: Salvatore Larosa (@slarosa)


Sandro Mani wrote:

Salvatore Larosa: Could you please specify which checks are active when you trigger the crash?

Geometry validity:
Self intersection, Duplicate nodes ad Polygon with less 3 nodes.

Topology checks:
Check for duplicates, Check for features within other features

@qgib
Copy link
Contributor Author

qgib commented Oct 9, 2015

Author Name: Giovanni Manghi (@gioman)


Sandro Mani wrote:

@giovanni Manghi: I see a crash when I zoom on the canvas after the self-intersection fix is complete (i.e. when fix summary dialog is shown). This appears to be caused by corruption in the wkb string of the geometry, even though it looks correct as it is returned by QgsGeometryCollectionV2::asWkb - the corruption appears to happen later on in QgsMapToPixelSimplifier::simplifyWkbGeometry. Can you confirm that this is the same issue you are seeing?

Salvatore Larosa: Could you please specify which checks are active when you trigger the crash?

Screencast and sample data attached. Cheers!


  • 9160 was configured as test_gc.dbf.zip
  • 9159 was configured as gc.mp4

@qgib
Copy link
Contributor Author

qgib commented Oct 12, 2015

Author Name: Sandro Mani (Sandro Mani)


Could you please re-test against the latest master? It contains some Geometry Checker fixes as well as changes at QgsGeos level.

@qgib
Copy link
Contributor Author

qgib commented Oct 12, 2015

Author Name: Nyall Dawson (@nyalldawson)


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Oct 12, 2015

Author Name: Salvatore Larosa (@slarosa)


Works fine for me in current master. I leave the ticket opened for more feedback from Giovanni.

@qgib
Copy link
Contributor Author

qgib commented Oct 14, 2015

Author Name: Giovanni Manghi (@gioman)


Also fine here. Thanks!


  • status_id was changed from Feedback to Closed

@qgib
Copy link
Contributor Author

qgib commented Oct 14, 2015

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to fixed/implemented

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


On Windows 7 the 'Check Geometries' plugin may cause a crash when 'Topology checks' are activated. I've tested the .shp file uploaded by Salvatore Larosa and 'Check for duplicates' isn't working (see attachment). On Ubuntu 14.04 there is no crash but QGIS says 'Check error occurred' in a separate dialogue window.

QGIS 2.12.3


  • status_id was changed from Closed to Reopened
  • 9530 was configured as win7.png
  • 9531 was configured as ubuntu_14_04__1.png
  • 9532 was configured as ubuntu_14_04__2.png

@qgib
Copy link
Contributor Author

qgib commented Feb 3, 2016

Author Name: Sandro Mani (Sandro Mani)


The crash under windows needs to be investigated.

The dialog shown about check errors is expected: The layer contains issues which are preventing the duplicate check from working (specifically, because the geometry engine, GEOS, won't handle geometries with self intersections, and GEOS is being used to check for topology issues). So you'll need to fix those errors first, and then do the topology checks once those errors are fixed.

@qgib
Copy link
Contributor Author

qgib commented Feb 19, 2016

Author Name: Jürgen Fischer (@jef-n)


Reinhard Reiterer wrote:

On Windows 7 the 'Check Geometries' plugin may cause a crash when 'Topology checks' are activated. I've tested the .shp file uploaded by Salvatore Larosa and 'Check for duplicates' isn't working (see attachment). On Ubuntu 14.04 there is no crash but QGIS says 'Check error occurred' in a separate dialogue window.

Doesn't crash here on windows with master.

@qgib
Copy link
Contributor Author

qgib commented Mar 5, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


I did some testing and the "Geometry checker" often crashes when dealing with complex features. Seems it's a cross-platform issue. I've uploaded the stacktrace of a Ubuntu crash report.


  • 9643 was configured as stacktrace_qgis_2_14_ubuntu_14_04

@qgib
Copy link
Contributor Author

qgib commented Mar 5, 2016

Author Name: Sandro Mani (Sandro Mani)


If possible, please provide a dataset with which to reproduce and specify how you set up the geometry checker.

@qgib
Copy link
Contributor Author

qgib commented Mar 5, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


Hope this helps.

@ #16
Thanks for the detailed explanation.


  • 9645 was configured as geometry_checker_crash.zip

@qgib
Copy link
Contributor Author

qgib commented Mar 5, 2016

Author Name: Sandro Mani (Sandro Mani)


Thanks, can reproduce, will analyze.

@qgib
Copy link
Contributor Author

qgib commented Mar 5, 2016

Author Name: Sandro Mani (Sandro Mani)


Fix here: #2868

@qgib
Copy link
Contributor Author

qgib commented Mar 12, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


The fix seems to work. Unfortunately the 'Check geometries' plugin is still facing issues. I've uploaded the .shp files.


  • 9684 was configured as qgis-2.14.0_git20160309_107d30a_20trusty.zip

@qgib
Copy link
Contributor Author

qgib commented Mar 12, 2016

Author Name: Sandro Mani (Sandro Mani)


#2905

@qgib
Copy link
Contributor Author

qgib commented Mar 14, 2016

Author Name: Nyall Dawson (@nyalldawson)


PR merged, should be fixed in master and 2.14 now.


  • status_id was changed from Reopened to Closed

@qgib
Copy link
Contributor Author

qgib commented Mar 16, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


Is the fix #12965 already implemented? QGIS (1:2.14.0+git20160315+342a754+20trusty) is still crashing.

@qgib
Copy link
Contributor Author

qgib commented Mar 20, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


I've tested the 'Check Geometries' plugin on several layers and everything seems to work now :)

@qgib
Copy link
Contributor Author

qgib commented Mar 24, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


Hi Sandro, I've noticed another bug. When trying to fix the selected errors QGIS crashes again (see attachment).


  • 9754 was configured as qgis-2.14.0_git20160319_08a1b07_20trusty.zip
  • status_id was changed from Closed to Reopened

@qgib
Copy link
Contributor Author

qgib commented Mar 24, 2016

Author Name: Sandro Mani (Sandro Mani)


Wow, that was a nasty bug. Could you try the branch https://github.com/manisandro/QGIS/tree/geom_checker_fixes (last two commits are the relevant ones)? Thanks

@qgib
Copy link
Contributor Author

qgib commented Mar 24, 2016

Author Name: Sandro Mani (Sandro Mani)


Oh and you'll need to reduce the precision to 1E-6 for the test case you attached. Reason are GEOS precision issues.

@qgib
Copy link
Contributor Author

qgib commented Apr 8, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


Is there any way to implement the fix in the next master? I don't know how to install a branch.

@qgib
Copy link
Contributor Author

qgib commented Apr 8, 2016

Author Name: Sandro Mani (Sandro Mani)


Now merged in master

@qgib
Copy link
Contributor Author

qgib commented Apr 22, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


Thanks for your help, the 'Geometry Checker' is no longer crashing. However, fixing minimum area issues may be quite tricky if there are no neighboring polygons to merge with.


  • status_id was changed from Reopened to Closed

@qgib
Copy link
Contributor Author

qgib commented Jul 6, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


Is there anything I can do when the gap check reports a topology exception (see gap_check_topology_exception.png)? Is this a bug?


  • 10142 was configured as gap_check_topology_exception.png

@qgib
Copy link
Contributor Author

qgib commented Jul 6, 2016

Author Name: Sandro Mani (Sandro Mani)


It is unlikely a bug (in the QGIS code at least). Can you spot a faulty geometry at the position indicated?

@qgib
Copy link
Contributor Author

qgib commented Jul 7, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


The layer includes many sliver polygons, that the geometry checker can't fix. Maybe I'm doing something wrong?


  • 10143 was configured as post_no36.png

@qgib
Copy link
Contributor Author

qgib commented Jul 7, 2016

Author Name: Sandro Mani (Sandro Mani)


Please open a separate issue and attach the problematic data.

@qgib
Copy link
Contributor Author

qgib commented Jul 7, 2016

Author Name: Reinhard Reiterer (Reinhard Reiterer)


I can not attach the data as the shape files are proprietary :/

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins Crash/Data Corruption labels May 25, 2019
@qgib qgib added this to the Future Release - High Priority milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
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 Plugins
Projects
None yet
Development

No branches or pull requests

1 participant