prepair icon indicating copy to clipboard operation
prepair copied to clipboard

Segmentation Fault (core dumped) when running on large polygons

Open tronxd opened this issue 10 years ago • 12 comments

when running at your dataset (Data/CLC2006_180927.geojson) prepair --ogr CLC2006_180927.geojson I get a segmentation fault (core dumped) (small polygons are ok) DETAILS: branch: master: OS: RHEL 6.2 (Santiago) compiled by gcc 4.4.7 Boost 1.41.0 CGAL 4.6

tronxd avatar Apr 26 '15 12:04 tronxd

Thanks for the report! I'm quite busy at the moment, but I'll install Red Hat in a VM to debug it when I can.

However, my best guess would be that there is a problem with the GMP or MPFR libraries, which are needed for exact arithmetic. Did you compile them yourself or got them from a repository? In RPM perhaps?

kenohori avatar Apr 28 '15 18:04 kenohori

Hello Ken, These libraries were installed from a Yum repository.

tronxd avatar May 01 '15 15:05 tronxd

any ideas on this? i am also getting the same

aj7 avatar Jul 27 '17 14:07 aj7

Any updates on this issue? I'm having the same issue while trying to prepair polygons that span the entirety of the USA land boundary.

entranOA avatar Apr 05 '18 16:04 entranOA

Sorry, but it wasn't a trivial thing to debug and I've been busy with other projects. I'll have another look at it.

kenohori avatar Apr 05 '18 18:04 kenohori

Thank you! I was using the improvements-with-ogr branch.

entranOA avatar Apr 06 '18 20:04 entranOA

I ran into the same issue with the improvements-with-ogr branch, that it was producing a segmentation fault when processing large/complex polygons. After some investigation, it appeared the cause was a certain malloc call, which results in a stack overflow. I circumvented the issue by setting the core file size (I don't think core file size change is necessary, but haven't tried it without it) and the stack size to unlimited. I was able to process the polygons which were previously resulting in the aforementioned error.

1riggs avatar Jul 13 '18 21:07 1riggs

@AlexRiggs how did you increase the stack size to unlimited ? On ubuntu I tried using "ulimit -s", it didn't fix the problem, I don't know if it is the right command.

albanm avatar Sep 11 '18 08:09 albanm

@albanm the commands I used are as follows:

ulimit -c unlimited
ulimit -s unlimited
ulimit -a

the -a flag just displays the ulimit settings, use it to verify the changes. Hope this helps!

1riggs avatar Sep 11 '18 16:09 1riggs

Thanks! Unfortunately it seems that my problem is not related to the polygon size.

After closer inspection it happens on a small broken polygon (4 points including 2 duplicates).

albanm avatar Sep 11 '18 17:09 albanm

Ah that's a shame. You may have already thought of this but it may be easiest to load the polygon into QGIS or ArcGIS, select that specific polygon and repair it by hand or with one of the built-in repair tools. It sounds like it may just be a weird unhandled edge case for prepair.

If that doesn't work, the other thing you could try is running prepair with the bash C-debugger (gdb) and check the log files, might give you a more informative error than just Segmentation Fault.

Best of luck!

On Tue, Sep 11, 2018 at 11:04 AM, Alban Mouton [email protected] wrote:

Thanks! Unfortunately it seems that my problem is not related to the polygon size.

After closer inspection it happens on a small broken polygon (4 points including 2 duplicates).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tudelft3d/prepair/issues/18#issuecomment-420346958, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad6A0XkwJMzHiCM8sUcbPrgZgjQ2lhC-ks5uZ-0qgaJpZM4EI_ho .

1riggs avatar Sep 11 '18 17:09 1riggs

It is alright in the end, this polygon is actually impossible to repair in my opinion and it is just one in many in a large dataset. So I just catch the error, log it, consider that I did the best I could and go on to the next feature. I use prepair as well as turfjs' cleanCoords and rewind, and it seems that almost all features are clean afterwards.

albanm avatar Sep 11 '18 19:09 albanm