[postgis-devel] Failed assert in rt_raster_from_band

Jaime Casanova jaime.casanova at 2ndquadrant.com
Thu Jun 4 00:34:54 PDT 2020


Hi everyone,

i was running sqlsmith on postgresql with postgis enabled and got
failed assertion very quickly.

postgres version
--------------------------
 PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu,
compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit

postgis full version
--------------------------
 POSTGIS="2.5.4" [EXTENSION] PGSQL="120" GEOS="3.7.1-CAPI-1.11.1
27a5e771" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.4.0,
released 2018/12/14" LIBXML="2.9.4" LIBJSON="0.12.1"
LIBPROTOBUF="1.3.1" RASTER

btw, i was running this on a debian 10 machine

attached  are:
- a script to create a single postgis enabled table with some data
- the query that crashes
- gdb "bt full" output

Anything else I can do to help debug this?

-- 
Jaime Casanova                      www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
-------------- next part --------------
#0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
        set = {__val = {0, 94583955378400, 0, 140496725435607, 94587992244224, 94583955378400, 94583955378501, 94583955378400, 94583955378400, 94583955378512, 94583955378700, 
            94583955378400, 94583955378700, 0, 0, 0}}
        pid = <optimized out>
        tid = <optimized out>
        ret = <optimized out>
#1  0x00007fc7f1640535 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x56060b144ea0, sa_sigaction = 0x56060b144ea0}, sa_mask = {__val = {0, 303, 94583955378400, 0, 0, 0, 21474836480, 
              140730199141784, 140730199141632, 140496679386162, 140496679386162, 0, 17693867717872550656, 140496726520762, 0, 140496679386162}}, sa_flags = -441859500, 
          sa_restorer = 0x7fc7e5a97507}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007fc7f164040f in __assert_fail_base (fmt=0x7fc7eeaabc32 <error: Cannot access memory at address 0x7fc7eeaabc32>, assertion=0x7fc7e5a97507 "NULL != raster", 
    file=0x7fc7e5a9c254 "rt_raster.c", line=1443, function=<optimized out>) at assert.c:92
        str = 0x56060b144ea0 "@\351\r\v\006V"
        total = 4096
#3  0x00007fc7f164e102 in __GI___assert_fail (assertion=assertion at entry=0x7fc7e5a97507 "NULL != raster", file=file at entry=0x7fc7e5a9c254 "rt_raster.c", line=line at entry=1443, 
    function=function at entry=0x7fc7e5a9c520 <__PRETTY_FUNCTION__.44880> "rt_raster_from_band") at assert.c:101
No locals.
#4  0x00007fc7e5a840e5 in rt_raster_from_band (raster=<optimized out>, bandNums=bandNums at entry=0x7ffe4d876f24, count=count at entry=1) at rt_raster.c:1443
        rast = 0x0
        i = 0
        j = 0
        idx = <optimized out>
        flag = <optimized out>
        gt = {0, 0, 0, 0, 0, 0}
        __PRETTY_FUNCTION__ = "rt_raster_from_band"
#5  0x00007fc7e5a53d90 in RASTER_union_finalfn (fcinfo=0x7ffe4d876f80) at rtpg_mapalgebra.c:2905
        bandNums = {0}
        iwr = 0x56060b182dc0
        _rtn = 0x0
        _raster = 0x0
        pgraster = 0x0
        i = 0
        j = <optimized out>
        itrset = 0x56060b17eda0
        _band = <optimized out>
        noerr = 1
        status = <optimized out>
        pixtype = <optimized out>
        hasnodata = <optimized out>
        nodataval = 0
        __func__ = "RASTER_union_finalfn"
#6  0x000056060a3b8881 in finalize_windowaggregate (winstate=winstate at entry=0x56060b16efa0, peraggstate=peraggstate at entry=0x56060b1884b0, result=result at entry=0x56060b188cc8, 
    isnull=isnull at entry=0x56060b189218, perfuncstate=<optimized out>) at ./build/../src/backend/executor/nodeWindowAgg.c:625
        anynull = <optimized out>
        i = <optimized out>
        fcinfodata = {fcinfo = {flinfo = 0x56060b188520, context = 0x56060b16efa0, resultinfo = 0x0, fncollation = 0, isnull = false, nargs = 1, args = 0x7ffe4d876fa0}, 
          fcinfo_data = " \205\030\v\006V\000\000\240\357\026\v\006V", '\000' <repeats 16 times>, "\001\000\300-\030\v\006V", '\000' <repeats 18 times>, "\001\000\000\000q\000\000\000\211\002", '\000' <repeats 14 times>, "q", '\000' <repeats 15 times>, " p\207M\376\177\000\000\n\244K\n\006V\000\000\220p\207M\376\177\000\000\000\371\n\346\307\177\000\000\001\000\000\000\000\000\000\000\220\363\004\v\006V\000\000\000\366\270\345\307\177", '\000' <repeats 11 times>, "q\207M\376\177\000\000b\312K\n\006V\000\000\a", '\000' <repeats 11 times>, "p\000\000\000\067q\207M\376\177\000\000"...}
        fcinfo = 0x7ffe4d876f80
        numFinalArgs = <optimized out>
        oldContext = 0x56060b16ec50
#7  0x000056060a3bbbcd in eval_windowaggregates (winstate=0x56060b16efa0) at ./build/../src/backend/executor/nodeWindowAgg.c:992
        result = 0x56060b188cc8
        isnull = 0x56060b189218
        aggregatedupto_nonrestarted = <optimized out>
        econtext = 0x56060b16f490
        agg_row_slot = <optimized out>
        peraggstate = 0x56060b1884b0
        numaggs = 1
        wfuncno = <optimized out>
        numaggs_restart = <optimized out>
        i = <optimized out>
        oldContext = <optimized out>
        agg_winobj = <optimized out>
        temp_slot = <optimized out>
        peraggstate = <optimized out>
        wfuncno = <optimized out>
        numaggs = <optimized out>
        numaggs_restart = <optimized out>
        i = <optimized out>
        aggregatedupto_nonrestarted = <optimized out>
        oldContext = <optimized out>
        econtext = <optimized out>
        agg_winobj = <optimized out>
        agg_row_slot = <optimized out>
        temp_slot = <optimized out>
        __func__ = "eval_windowaggregates"
        __errno_location = <optimized out>
        __errno_location = <optimized out>
        ok = <optimized out>
        ret = <optimized out>
        result = <optimized out>
        isnull = <optimized out>
#8  ExecWindowAgg (pstate=0x56060b16efa0) at ./build/../src/backend/executor/nodeWindowAgg.c:2206
        winstate = 0x56060b16efa0
        econtext = 0x56060b16f490
        i = <optimized out>
        numfuncs = <optimized out>
        __func__ = "ExecWindowAgg"
#9  0x000056060a388ac3 in ExecProcNode (node=0x56060b16efa0) at ./build/../src/include/executor/executor.h:239
No locals.
#10 ExecutePlan (execute_once=<optimized out>, dest=0x56060b17d308, direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>, operation=CMD_SELECT, 
    use_parallel_mode=<optimized out>, planstate=0x56060b16efa0, estate=0x56060b16ed60) at ./build/../src/backend/executor/execMain.c:1646
        slot = <optimized out>
        current_tuple_count = 0
        slot = <optimized out>
        current_tuple_count = <optimized out>
#11 standard_ExecutorRun (queryDesc=0x56060b0fffa0, direction=<optimized out>, count=0, execute_once=<optimized out>) at ./build/../src/backend/executor/execMain.c:364
        estate = 0x56060b16ed60
        operation = CMD_SELECT
        dest = 0x56060b17d308
        sendTuples = <optimized out>
        oldcontext = 0x56060b0ffe90
        __func__ = "standard_ExecutorRun"
#12 0x000056060a4ee6ec in PortalRunSelect (portal=portal at entry=0x56060b022850, forward=forward at entry=true, count=0, count at entry=9223372036854775807, 
    dest=dest at entry=0x56060b17d308) at ./build/../src/backend/tcop/pquery.c:929
        queryDesc = 0x56060b0fffa0
        direction = <optimized out>
        nprocessed = <optimized out>
        __func__ = "PortalRunSelect"
#13 0x000056060a4efc68 in PortalRun (portal=portal at entry=0x56060b022850, count=count at entry=9223372036854775807, isTopLevel=isTopLevel at entry=true, 
    run_once=run_once at entry=true, dest=dest at entry=0x56060b17d308, altdest=altdest at entry=0x56060b17d308, completionTag=0x7ffe4d877930 "")
    at ./build/../src/backend/tcop/pquery.c:770
        save_exception_stack = 0x7ffe4d877b40
        save_context_stack = 0x0
        local_sigjmp_buf = {{__jmpbuf = {1, 639202057418084750, 94583953888272, 140730199144752, 94583954483280, 94583955903240, 639202057273381262, 6570304842336211342}, 
            __mask_was_saved = 0, __saved_mask = {__val = {2817148525, 0, 94583954494840, 94583954491632, 94583769792513, 94583955390096, 2, 140730199144750, 1, 112, 
                94583953881360, 2, 94583954483280, 140730199144624, 94583944138941, 2}}}}
        result = <optimized out>
        nprocessed = <optimized out>
        saveTopTransactionResourceOwner = 0x56060afe8400
        saveTopTransactionContext = 0x56060b060420
        saveActivePortal = 0x0
        saveResourceOwner = 0x56060afe8400
        savePortalContext = 0x0
        saveMemoryContext = 0x56060b060420
        __func__ = "PortalRun"
#14 0x000056060a4ebabc in exec_simple_query (
    query_string=0x56060af8fa20 "select  \n      public.st_union(\n        cast(cast(null as raster) as raster),\n        cast(sample_12.gid as int4)) over (partition by sample_12.hip2 order by sample_12.hip2) as c5 \n  from \n    public."...) at ./build/../src/backend/tcop/postgres.c:1215
        parsetree = 0x56060af913e0
        portal = 0x56060b022850
        snapshot_set = <optimized out>
        commandTag = <optimized out>
        completionTag = "\000\000\000\000\002\000\000\000\t", '\000' <repeats 16 times>, "\203\213z\000\000\000\000Q\000\000\000\000\000\000\000\340z\207M\376\177\000\000 \372\370\n\006V\000\000\070h\376\n\006V\000"
        querytree_list = <optimized out>
        plantree_list = <optimized out>
        receiver = 0x56060b17d308
        format = 0
        dest = DestRemote
        oldcontext = 0x56060b060420
        parsetree_list = 0x56060af91430
        parsetree_item = 0x56060af91410
        save_log_statement_stats = false
        was_logged = false
        use_implicit_block = false
        msec_str = "\000\000\000\000\002\000\000\000\t", '\000' <repeats 16 times>, "\203\213z\000\000\000"
        __func__ = "exec_simple_query"
#15 0x000056060a4ed4be in PostgresMain (argc=<optimized out>, argv=argv at entry=0x56060afe6990, dbname=<optimized out>, username=<optimized out>)
    at ./build/../src/backend/tcop/postgres.c:4247
        query_string = 0x56060af8fa20 "select  \n      public.st_union(\n        cast(cast(null as raster) as raster),\n        cast(sample_12.gid as int4)) over (partition by sample_12.hip2 order by sample_12.hip2) as c5 \n  from \n    public."...
        firstchar = <optimized out>
        input_message = {
          data = 0x56060af8fa20 "select  \n      public.st_union(\n        cast(cast(null as raster) as raster),\n        cast(sample_12.gid as int4)) over (partition by sample_12.hip2 order by sample_12.hip2) as c5 \n  from \n    public."..., len = 248, maxlen = 1024, cursor = 248}
        local_sigjmp_buf = {{__jmpbuf = {140730199145216, 639202057558593934, 1, 94583954237496, 140730199146080, 94583954207936, 639202057451639182, 6570304840499761550}, 
            __mask_was_saved = 1, __saved_mask = {__val = {0, 140730199154375, 140730199154330, 140730199154642, 0, 139637976727552, 94583954207936, 140730199145488, 
                17693867717872550656, 140730199145648, 94583944247327, 206158430256, 140730199145672, 140730199145472, 17693867717872550656, 94583953857040}}}}
        send_ready_for_query = false
        disable_idle_in_transaction_timeout = false
        __func__ = "PostgresMain"
#16 0x000056060a473208 in BackendRun (port=0x56060afdf4c0, port=0x56060afdf4c0) at ./build/../src/backend/postmaster/postmaster.c:4448
        av = 0x56060afe6990
        maxac = <optimized out>
        ac = 1
        i = 1
        av = <optimized out>
        maxac = <optimized out>
        ac = <optimized out>
        i = <optimized out>
        __func__ = "BackendRun"
        __errno_location = <optimized out>
        __errno_location = <optimized out>
        __errno_location = <optimized out>
#17 BackendStartup (port=0x56060afdf4c0) at ./build/../src/backend/postmaster/postmaster.c:4139
        bn = <optimized out>
        pid = <optimized out>
        bn = <optimized out>
        pid = <optimized out>
        __func__ = "BackendStartup"
        __errno_location = <optimized out>
        __errno_location = <optimized out>
        save_errno = <optimized out>
        __errno_location = <optimized out>
        __errno_location = <optimized out>
#18 ServerLoop () at ./build/../src/backend/postmaster/postmaster.c:1704
        port = 0x56060afdf4c0
        i = <optimized out>
        rmask = {fds_bits = {32, 0 <repeats 15 times>}}
        selres = <optimized out>
        now = <optimized out>
        readmask = {fds_bits = {56, 0 <repeats 15 times>}}
        nSockets = 6
        last_lockfile_recheck_time = 1591255331
        last_touch_time = 1591255331
        __func__ = "ServerLoop"
#19 0x000056060a47412f in PostmasterMain (argc=5, argv=0x56060af89930) at ./build/../src/backend/postmaster/postmaster.c:1377
        opt = <optimized out>
        status = <optimized out>
        userDoption = <optimized out>
        listen_addr_saved = <optimized out>
        i = <optimized out>
        output_config_variable = <optimized out>
        __func__ = "PostmasterMain"
#20 0x000056060a1ddeed in main (argc=5, argv=0x56060af89930) at ./build/../src/backend/main/main.c:228
No locals.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crashing_query.sql
Type: application/sql
Size: 248 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20200604/c4246e8b/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asterism.sql.gz
Type: application/gzip
Size: 463713 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20200604/c4246e8b/attachment-0001.gz>


More information about the postgis-devel mailing list