Opened 9 years ago
Closed 9 years ago
#3146 closed defect (fixed)
ST_EffectiveArea possible 32-bit crasher
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 2.2.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
Doing garden crash test on my 32-bit PostgreSQL 9.4 EDB, this crashes
SELECT ST_SetEffectiveArea(foo1.the_geom, 20.1, 5) As result FROM ((SELECT ST_GeomFromText('LINESTRING(1 2, 1 2)',4326) As the_geom UNION ALL SELECT ST_MakeLine('SRID=4326;POINT(1 2)'::geometry, 'SRID=4326;POINT EMPTY'::geometry) As the_geom ) ) As foo1 LIMIT 3;
It might just be a 32-bit crasher on my 9.5 instance works okay, but I haven't tested against 64-bit 9.4 EDB install to be sure it's not a VC/mingw64 thing.
My 64-bit install is also a bit older. This I tested under:
POSTGIS="2.2.0dev r13601" GEOS="3.5.0dev-CAPI-1.9.0 r4054" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24" LIBXML="2.7.8" LIBJSON="0.12" RASTER;PostgreSQL 9.4.2, compiled by Visual C++ build 1800, 32-bit
Change History (8)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Hold on this could be a false alarm. Just realized it doesn't crash on my mingw32 only version, but my mingw32 is 9.4rc1 (and my vc EDB 32-bit is 9.4.2), so could be just incompatibility here with running a compiled 9.4rc1 on a 9.4.2.
comment:3 by , 9 years ago
If it crashes on ST_SetEffectiveArea it would be very interesting to know if it also crashes on ST_SimplifyVW. It is the same function but with different defaults.
comment:4 by , 9 years ago
Hmm well still crashes and yes crashes on ST_SimplifyVW.
SELECT ST_SimplifyVW(foo1.the_geom, 20.1) As result FROM ((SELECT ST_GeomFromText('LINESTRING(1 2, 1 2)',4326) As the_geom UNION ALL SELECT ST_MakeLine('SRID=4326;POINT(1 2)'::geometry, 'SRID=4326;POINT EMPTY'::geometry) As the_geom ) ) As foo1 LIMIT 3;
This is one of those annoying bugs I can only exercise under VC++ build and only on the 32-bit one at that.
Here is the backtrace for the ST_SimplifyVW call crash:
(gdb) bt #0 0x006da63b in postgres!pfree () #1 0x708bfd03 in destroy_effectivearea (ea=0x310eca8) at effectivearea.c:30 #2 0x708c02de in ptarray_set_effective_area (inpts=<optimized out>, avoid_collaps=avoid_collaps@entry=2, set_area=set_area@entry=0, trshld=trshld@entry=20.100000000000001) at effectivearea.c:431 #3 0x708c0616 in lwline_set_effective_area (trshld=20.100000000000001, set_area=0, iline=0x310ec30) at effectivearea.c:452 #4 lwgeom_set_effective_area (igeom=igeom@entry=0x310ec30, set_area=set_area@entry=0, trshld=trshld@entry=20.100000000000001) at effectivearea.c:533 #5 0x70883db9 in LWGEOM_SetEffectiveArea (fcinfo=0x310cfbc) at lwgeom_functions_analytic.c:97 #6 0x004e70e4 in postgres!ExecProject () #7 0x004e93c3 in postgres!ExecProject () #8 0x004e588f in postgres!ExecProject () #9 0x004f8420 in postgres!ExecResult () #10 0x004e33e8 in postgres!ExecProcNode () #11 0x004f4661 in postgres!ExecLimit () #12 0x004e3596 in postgres!ExecProcNode () #13 0x004e28ce in postgres!EvalPlanQualEnd () #14 0x004e0bf6 in standard_ExecutorRun () #15 0x005f4bbb in postgres!PortalRunFetch () #16 0x005f4542 in postgres!PortalRun () #17 0x005f27f9 in postgres!get_stats_option_name () #18 0x005f0f4a in postgres!PostgresMain () #19 0x005a33a0 in postgres!ShmemBackendArrayAllocation () #20 0x00000001 in ?? () #21 0x00eae008 in ?? () #22 0x005a08c1 in postgres!SubPostmasterMain () #23 0x00510610 in postgres!main ()
comment:5 by , 9 years ago
Well teh good news is I can only trigger the issue with a 1-pointed linestring. The 2-pointed duplicated point one doesn't error out. Here is the offending query in it's simplest form:
SELECT ST_SimplifyVW('0102000020E610000001000000000000000000F03F0000000000000040'::geometry,20.1);
comment:6 by , 9 years ago
I'm on it. I also realized I haven't guarded from 1-point linestrings. So I am just running the checks and I will commit.
It is a little surprising that it works on other platforms. But 1-point linestrings certainly makes things unstable in there.
points have to turn in the door, and so should 1-point linestrings, or even 2-point linestrings since they cannot be simplified.
comment:8 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
yap that fixed it. No more garden crashers for my 32-bit.
Just tested on my 64-bit VC EDB 9.4, and that one doesn't crash so this may be another 32-bit specific issue.