[postgis-devel] Pstgis raster ST_SetValues crashes server, or is it GDAL?

Rémi Cura remi.cura at gmail.com
Tue Mar 11 09:50:28 PDT 2014


Hey,
it'n not about geometry, I'm thinking more of a memory bug.

Here is an example of the statement producing the alternate crash (first
execution : ok, second : crahs).

The funny thing is : in the minmax CTE, il I use the other select, it works
100% of time. Even more stranger, If I execute only the CTE (no raster
creation), results are also always correct.

The bug seems to happen when
1. using setvalues(addband(makeempty))
2. using a variable value for position in makeempty

Because it works once then crash, I would say that setvalues / gdal use
some kind of cache where clean up has been forgotten?

Cheers,
Rémi-C

WITH patch  AS (
        SELECT gid,patch AS pa
        FROM acquisition_tmob_012013.riegl_pcpatch_space
        WHERE gid = 361783 --big patch
        --WHERE gid = 360004 --little patch
    )
    ,minmax AS (
        SELECT rc_round(ST_XMin(pa::geometry), 0.02::double
precision)-1*0.02/2 AS ulx, rc_round(ST_YMin (pa::geometry), 0.02::double
precision)-1*0.02/2 AS uly
    --    SELECT rc_round(1913.5,0.02) AS ulx,  rc_round(20887.5,0.02) AS
uly
        FROM patch
    )
    ,agg AS (
        SELECT array_agg((geom,val)::geomval) AS arr
        FROM test_crash_raster_setvalues.geomval
    )
    SELECT -- o_r
        ST_SetValues(
            ST_AddBand(rast:=
                ST_MakeEmptyRaster(
                    51,51  --we round and make sure we always include any
points
                    ,upperleftx:=ulx
                    ,upperlefty:=uly
                        --translating of pixel_size/2 to have the point in
center of pixels
                    ,scalex:=0.02 , scaley:=0.02
                    , skewx:=0 ,skewy:=0
                    , srid:=932011 )
            ,index:=1
            ,pixeltype:='32BF'
            , initialvalue:='NaN'
            , nodataval:='NaN')

        ,1, arr,FALSE)
    FROM agg, patch,minmax


2014-03-10 19:51 GMT+01:00 Bborie Park <dustymugs at gmail.com>:

> Can't say for certain. ST_SetValues() itself doesn't use GDAL but the
> geometry in geomval would be rasterized using GDAL. Can you isolate the
> geometry causing the crash?
>
> -bborie
>
>
> On Mon, Mar 10, 2014 at 10:50 AM, Rémi Cura <remi.cura at gmail.com> wrote:
>
>> Hey List,
>> I encountered another annoying problem :
>> I can reproduce it 100%, but I failed to produce an isolated test case.
>>
>> Problem occurs when using the ST_SetValues function to populate a freshly
>> created raster band. It works the first time, then crashes the server (see
>> stack, log only says : segfault)
>>
>> Strange point is : It is a plpgsql I wrote wrapping st_setvalues that
>> crashes, and the same code doesn't crash outside a plpgsql function.
>>
>> Somebody would have any idea about that?
>>
>> Cheers,
>> Rémi-C
>>
>>
>> #0  0xb7216424 in __kernel_vsyscall ()
>> #1  0xb6b811df in raise () from /lib/i386-linux-gnu/libc.so.6
>> #2  0xb6b84825 in abort () from /lib/i386-linux-gnu/libc.so.6
>> #3  0x7355279f in CPLEmergencyError (pszMessage=0x73993800
>> "CPLGetTLSList(): pthread_setspecific() failed!") at cpl_error.cpp:314
>> #4  0x7355f8e6 in CPLGetTLSList () at cpl_multiproc.cpp:1582
>> #5  CPLGetTLSList () at cpl_multiproc.cpp:1563
>> #6  0x73560358 in CPLGetTLS (nIndex=5) at cpl_multiproc.cpp:1598
>> #7  0x735527b6 in CPLEmergencyError (pszMessage=0x73993800
>> "CPLGetTLSList(): pthread_setspecific() failed!") at cpl_error.cpp:298
>> #8  0x7355f8e6 in CPLGetTLSList () at cpl_multiproc.cpp:1582
>> #9  CPLGetTLSList () at cpl_multiproc.cpp:1563
>> #10 0x73560358 in CPLGetTLS (nIndex=14) at cpl_multiproc.cpp:1598
>> #11 0x7354fa62 in CPLGetConfigOption (pszKey=0x73992681
>> "GDAL_DISABLE_CPLLOCALEC", pszDefault=0x739bb70d "NO") at cpl_conv.cpp:1552
>> #12 0x73550f58 in CPLLocaleC::CPLLocaleC (this=0xbfbdddcc) at
>> cpl_conv.cpp:2405
>> #13 0x73513542 in GDALDriver::Create (this=0xb9227790,
>> pszFilename=0x73c33f2a "", nXSize=2, nYSize=2, nBands=0, eType=GDT_Byte,
>> papszOptions=0x0) at gdaldriver.cpp:128
>> #14 0x7351412f in GDALCreate (hDriver=0xb9227790, pszFilename=0x73c33f2a
>> "", nXSize=2, nYSize=2, nBands=0, eBandType=GDT_Byte, papszOptions=0x0) at
>> gdaldriver.cpp:254
>> #15 0x73c05d04 in rt_raster_gdal_rasterize (wkb=0xb916a858 "\001\001",
>> wkb_len=21, srs=0x0, num_bands=0, pixtype=0x0, init=0x0, value=0x0,
>> nodata=0x0, hasnodata=0x0, width=0x0,
>>     height=0x0, scale_x=0xbfbde068, scale_y=0xbfbde088, ul_xw=0x0,
>> ul_yw=0x0, grid_xw=0xbfbde060, grid_yw=0xbfbde078, skew_x=0xbfbde070,
>> skew_y=0xbfbde080, options=0x0)
>>     at rt_api.c:11313
>> #16 0x73bd37e8 in RASTER_setPixelValuesGeomval (fcinfo=0xb9295644) at
>> rt_pg.c:3729
>> #17 0xb73f3f90 in ?? ()
>> #18 0x73c85dd7 in ?? () from /usr/lib/postgresql/9.3/lib/plpgsql.so
>> #19 0x73c89be9 in ?? () from /usr/lib/postgresql/9.3/lib/plpgsql.so
>> #20 0x73c8b708 in ?? () from /usr/lib/postgresql/9.3/lib/plpgsql.so
>> #21 0x73c8c371 in plpgsql_exec_function () from
>> /usr/lib/postgresql/9.3/lib/plpgsql.so
>> #22 0x73c80334 in plpgsql_call_handler () from
>> /usr/lib/postgresql/9.3/lib/plpgsql.so
>> #23 0xb73f3f90 in ?? ()
>> #24 0xb73f8919 in ExecProject ()
>> #25 0xb73f8cec in ExecScan ()
>> #26 0xb740c45f in ExecCteScan ()
>> #27 0xb73f10b0 in ExecProcNode ()
>> #28 0xb73edfbe in standard_ExecutorRun ()
>> #29 0xb73ee07d in ExecutorRun ()
>> #30 0xb74e8013 in ?? ()
>> #31 0xb74e949e in PortalRun ()
>> #32 0xb74e5242 in PostgresMain ()
>> #33 0xb7298be8 in ?? ()
>> #34 0xb7499058 in PostmasterMain ()
>> #35 0xb7299bb9 in main ()
>>
>>
>>
>>
>>
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>>
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20140311/3e3b03cd/attachment.html>


More information about the postgis-devel mailing list