Opened 10 years ago
Closed 10 years ago
#3002 closed defect (invalid)
ST_GeomFromGeoJSON() Causes postgres to crash
Reported by: | vannut | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.6 |
Component: | postgis | Version: | 2.1.x |
Keywords: | Cc: |
Description
When executing a query which uses 'ST_GeomFromGeoJSON()' the backend crashes and you need to reconnect.
This simple query crashes: SELECT ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}'));
When using gdb to track whats going on, I can see this in the output:
Program received signal SIGSEGV, Segmentation fault. 0xb70dda59 in _IO_vfprintf_internal (s=0xbfde7150, format=<optimized out>, ap=0xbfde7298 "") at vfprintf.c:1630 1630 vfprintf.c: No such file or directory.
I'm using postgis 2.1.4 r12966 and a postgresql 9.3.5 server.
Change History (13)
comment:1 by , 10 years ago
comment:3 by , 10 years ago
addr_test_94=# SELECT ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}'); st_geomfromgeojson -------------------------------------------- 01010000009279E40F061E48C0F2B0506B9A1F3440 (1 row) addr_test_94=# select version(); version ------------------------------------------------------------------------------------------------------- PostgreSQL 9.4rc1 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit (1 row) addr_test_94=# select postgis_full_version(); POSTGIS="2.2.0dev r13129" GEOS="3.4.3dev-CAPI-1.8.3 r4029" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" RASTER (1 row)
comment:4 by , 10 years ago
The postgis version-string is different; it appears the libjson is not present.
POSTGIS="2.1.4 r12966" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER
How can I resolve that?
comment:5 by , 10 years ago
Mine works fine too running on windows 9.3 64-bit.
SELECT ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}'); st_geomfromgeojson -------------------------------------------- 01010000009279E40F061E48C0F2B0506B9A1F3440 (1 row)
{{{SELECT postgis_full_version(); POSTGIS="2.1.4 r12966" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.0, released 2014/04/16" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER
SELECT version();
version
PostgreSQL 9.3.5, compiled by Visual C++ build 1600, 64-bit
}}}
Regarding the LIBJSON version not showing, PostGIS only shows the JSON version if you are running LIBJSON 0.11 and above as I recall so the fact it doesn't show is not an issue. You probably do want to check what version yours was compiled with.
Actually I'm not even sure if we show the libjson version in PostGIS 2.1 for any version of LIBJSON (I think we do, but mine doesn't but my json version might be too low). Brian is cheating cause he's running a development version of both PostgreSQL and PostGIS
comment:6 by , 10 years ago
I've just experienced a crash on centos 6, with json-c 0.11. My local json-c on OSX is listed as 0.12 with a date appended to it, and darkblueb is listed as 0.11.99, which indicates to me that both of us are running pre-release tips of json rather than a real release. Not sure why robe would get a free pass from this bug, but maybe her version is actually to *old* to show the issue up. I'm going to try and get a from-source build failing (my test was on the rpm packages for opengeo suite) so I can find this.
comment:7 by , 10 years ago
I installed json-c via apt-get. If I look at the version installed, it is:
Version: 0.11-4+deb.sury.org~precise+1
Strange that this happens.
comment:8 by , 10 years ago
The root our *our* crash problem was library version mismatch. The build system was using 0.9, but I was deploying on a system with 0.11. The RPM packages only declared their requirement as "json-c" without any version specificity. Apparently json is not forward binary compatible, so packagers beware: you have to peg your json-c version in your package dependency declarations.
comment:9 by , 10 years ago
My version is a) too old maybe. I should test on my 2.2 install which I do have json 0.12 installed
Most likely though, I never have more than one JSON in my environment path ao I don't think I would ever run into the issue. Also my json is compiled in statically into the postgis dll.
It hought 0.9 wass under a different name thought no — issn't that why wwe do that json-c dance when going from 0.9 to 0.10 or was I mistaken.
comment:10 by , 10 years ago
I have the same problem with: Postgis 2.1.4 Postgresql 9.3.5 CentOS 6.5 x64
The package json-c is installed but I have a segmentation fault error when I execute the example query
comment:11 by , 10 years ago
As noted, this seems to be more of an environment problem than a PostGIS problem. If you build against an old json-c and run against a new one (or vice versa) things will go awry.
comment:12 by , 10 years ago
Milestone: | PostGIS 2.1.5 → PostGIS 2.1.6 |
---|
comment:13 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closing because this is a build problem.
Hm, I'm not able to replicate, you example works fine for me. What platform are you on?