I’m running into a strange problem which I can’t solve. The server crashes when executing some postgis related queries.
After some debugging, using the examples provided by postgis, it appears the ST_GEOMFROMGeoJSON()
function causes to server to crash.
Crashes:
SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) As wkt;
Operates normal:
SELECT ST_AsText(
ST_Transform(
ST_GeomFromText('POLYGON((743238 2967416,743238 2967450,
743265 2967450,743265.625 2967416,743238 2967416))',2249)
,4326)
) As wgs_geom;
When looking into the log I find these entries related to the crash:
2014-11-21 11:27:46 CET LOG: server process (PID 2377) was terminated by signal 11: Segmentation fault
2014-11-21 11:27:46 CET DETAIL: Failed process was running: SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) As wkt;
2014-11-21 11:27:46 CET LOG: terminating any other active server processes
2014-11-21 11:27:46 CET WARNING: terminating connection because of crash of another server process
2014-11-21 11:27:46 CET DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2014-11-21 11:27:46 CET HINT: In a moment you should be able to reconnect to the database and repeat your command.
2014-11-21 11:27:46 CET LOG: all server processes terminated; reinitializing
2014-11-21 11:27:46 CET LOG: database system was interrupted; last known up at 2014-11-21 11:24:11 CET
2014-11-21 11:27:46 CET LOG: database system was not properly shut down; automatic recovery in progress
2014-11-21 11:27:46 CET LOG: record with zero length at 18/34BCAD4
2014-11-21 11:27:46 CET LOG: redo is not required
2014-11-21 11:27:46 CET LOG: database system is ready to accept connections
2014-11-21 11:27:46 CET LOG: autovacuum launcher started
Searching the web did not yield into a solution. Maybe I´m not searching for the right problem?
I tried to restart the server as maybe the filesystem has some faults, without results.
The server itself is a Ubuntu 12.04 machine as a VPS.
The postgresql server is 9.3.5 and Postgis 2.1.4
Update
As Craig Ringer suggested I used gdb to see what happens when the process crashes. This is the first 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.
Also this is the output ofpostgis_full_verion()
:
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" TOPOLOGY RASTER
Am I right to say something is wrong with vfprintf.c
? eg it does not exists?
It says LIBJSON=”UNKNOWN” could that be of influence?