Postgresql

ST_GeomFromGeoJSON() 導致 postgres 崩潰

  • February 5, 2017

我遇到了一個我無法解決的奇怪問題。伺服器在執行一些與 postgis 相關的查詢時崩潰。經過一些調試,使用postgis提供的範例 ,似乎該函式導致伺服器崩潰。ST_GEOMFROMGeoJSON()

崩潰:

SELECT ST_AsText(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')) As wkt;

執行正常:

SELECT ST_AsText(
        ST_Transform(
              ST_GeomFromText('POLYGON((743238 2967416,743238 2967450,
                                        743265 2967450,743265.625 2967416,743238 2967416))',2249)
        ,4326)
       ) As wgs_geom; 

在查看日誌時,我發現這些與崩潰相關的條目:

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

搜尋網路並沒有產生解決方案。也許我不是在尋找正確的問題?

我試圖重新啟動伺服器,因為文件系統可能有一些故障,但沒有結果。伺服器本身是一台 Ubuntu 12.04 機器作為 VPS。postgresql 伺服器是 9.3.5 和 Postgis 2.1.4

更新

正如 Craig Ringer 建議的那樣,我使用 gdb 來查看程序崩潰時會發生什麼。這是第一個輸出:

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.

這也是以下的輸出postgis_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

我說有什麼不對vfprintf.c嗎?例如它不存在?

它說 LIBJSON=“UNKNOWN” 會產生影響嗎?

osgeo 票

我們崩潰問題的根源是庫版本不匹配。建構系統使用的是 0.9,但我在使用 0.11 的系統上進行部署。RPM 包僅將其要求聲明為“json-c”,沒有任何版本特異性。顯然json 不是正向二進制兼容的,所以打包者要小心:你必須在你的包依賴聲明中掛鉤你的 json-c 版本。

其次是

Resolution set to invalid
Status changed from new to closed
Closing because this is a build problem.

引用自:https://dba.stackexchange.com/questions/83264