[postgis-tickets] [PostGIS] #2732: gserialized_estimate crashes under mingw64 windows when compiled with --enabled-debug

PostGIS trac at osgeo.org
Sat May 10 06:55:53 PDT 2014


#2732: gserialized_estimate crashes under mingw64 windows when compiled with
--enabled-debug
------------------------------+---------------------------------------------
 Reporter:  robe              |       Owner:  pramsey      
     Type:  defect            |      Status:  new          
 Priority:  medium            |   Milestone:  PostGIS 2.1.3
Component:  postgis           |     Version:  2.1.x        
 Keywords:  windows, mingw64  |  
------------------------------+---------------------------------------------
 I think this is a similar issue to #2729 so probably some NULL string
 being trying to output in debug.

 I accidentally ran this query in my debug compiled install

 {{{
 POSTGIS="2.1.3dev r12523" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0,
 6 March 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.7.8"
 LIBJSON="UNKNOWN" (core procs from "2.1.3dev r12521" need upgrade) RASTER
 (raster procs from "2.1.3dev r12521" need upgrade) PostgreSQL 9.3.0 on
 x86_64-w64-mingw32, compiled by gcc.exe (rubenvb-4.8.0) 4.8.0, 64-bit
 }}}



 {{{
  SELECT pprint_addy(addy), st_astext(geomout), rating FROM
   geocode_intersection('Broadway', 'Houston St', 'NY', 'New York',
 '10012');
 }}}

 and got this back trace on crash:


 {{{
 (gdb) bt
 #0  0x000007fefd8e5a01 in strlen () from C:\Windows\system32\msvcrt.dll
 #1  0x000000000074df39 in fmtstr (target=0x23cc7a0, pointflag=<optimized
 out>, maxwidth=0, minlen=0, leftjust=0, value=0x0) at snprintf.c:779
 #2  dopr (target=target at entry=0x23cc7a0, format=0x30b144 "\" Oid(%d)",
 args=0x23cc8e8 "", args at entry=0x23cc8b8 "") at snprintf.c:714
 #3  0x000000000074e13f in pg_vsnprintf (str=<optimized out>,
 count=count at entry=1023, fmt=fmt at entry=0x30b118 "[%s:%s:%d] using relations
 \"%s\" Oid(%d), \"%s\" Oid(%d)", args=args at entry=0x23cc8b8 "") at
 snprintf.c:154
 #4  0x000000000057c0b1 in appendStringInfoVA (str=str at entry=0x23cc860,
 fmt=fmt at entry=0x30b118 "[%s:%s:%d] using relations \"%s\" Oid(%d), \"%s\"
 Oid(%d)", args=args at entry=0x23cc8b8 "") at stringinfo.c:137
 #5  0x000000000071607f in errmsg_internal (fmt=fmt at entry=0x6a00a700
 <my_finfo.69106+1076> "[%s:%s:%d] using relations \"%s\" Oid(%d), \"%s\"
 Oid(%d)") at elog.c:821
 #6  0x0000000069fa7538 in gserialized_gist_joinsel
 (fcinfo=fcinfo at entry=0x23cc960) at gserialized_estimate.c:1166
 #7  0x000000000071b9ab in DirectFunctionCall5Coll
 (func=func at entry=0x69fa7320 <gserialized_gist_joinsel>,
 collation=collation at entry=0, arg1=<optimized out>, arg2=<optimized out>,
 arg3=63487248, arg4=0, arg5=arg5 at entry=2) at fmgr.c:1133
 #8  0x0000000069faa775 in gserialized_gist_joinsel_2d (fcinfo=<optimized
 out>) at gserialized_estimate.c:1109
 #9  0x000000000071caef in OidFunctionCall5Coll (functionId=<optimized
 out>, collation=collation at entry=0, arg1=arg1 at entry=63400352,
 arg2=arg2 at entry=22743, arg3=arg3 at entry=63487248, arg4=arg4 at entry=0,
 arg5=arg5 at entry=37541248) at fmgr.c:1714
 #10 0x00000000005de350 in join_selectivity (root=root at entry=0x3c769a0,
 operatorid=operatorid at entry=22743, args=0x3c8bd10, inputcollid=0,
 jointype=jointype at entry=JOIN_INNER, sjinfo=sjinfo at entry=0x23cd580) at
 plancat.c:1082
 #11 0x00000000005abaf9 in clause_selectivity (root=root at entry=0x3c769a0,
 clause=0x3c8bc38, clause at entry=0x3c91b58, varRelid=varRelid at entry=0,
 jointype=jointype at entry=JOIN_INNER, sjinfo=sjinfo at entry=0x23cd580) at
 clausesel.c:659
 #12 0x00000000005abd68 in clauselist_selectivity (root=0x3c769a0,
 clauses=<optimized out>, varRelid=varRelid at entry=0,
 jointype=jointype at entry=JOIN_INNER, sjinfo=sjinfo at entry=0x23cd580) at
 clausesel.c:123
 #13 0x00000000005ac690 in calc_joinrel_size_estimate
 (root=root at entry=0x3c769a0, outer_rows=1, inner_rows=1,
 sjinfo=sjinfo at entry=0x23cd580, restrictlist=restrictlist at entry=0x3c98e38)
 at costsize.c:3645
 #14 0x00000000005b0578 in set_joinrel_size_estimates
 (root=root at entry=0x3c769a0, rel=rel at entry=0x3c98810,
 outer_rel=outer_rel at entry=0x3c975f0, inner_rel=inner_rel at entry=0x3c8f218,
 sjinfo=sjinfo at entry=0x23cd580, restrictlist=restrictlist at entry=0x3c98e38)
 at costsize.c:3531
 #15 0x00000000005e050a in build_join_rel (root=root at entry=0x3c769a0,
 joinrelids=joinrelids at entry=0x3c97460,
 outer_rel=outer_rel at entry=0x3c975f0, inner_rel=inner_rel at entry=0x3c8f218,
 sjinfo=0x23cd580, restrictlist_ptr=restrictlist_ptr at entry=0x23cd578) at
 relnode.c:426
 #16 0x00000000005b9c56 in make_join_rel (root=root at entry=0x3c769a0,
 rel1=rel1 at entry=0x3c975f0, rel2=rel2 at entry=0x3c8f218) at joinrels.c:634
 #17 0x00000000005ba579 in make_rels_by_clause_joins (other_rels=<optimized
 out>, old_rel=<optimized out>, root=<optimized out>) at joinrels.c:274
 #18 join_search_one_level (root=root at entry=0x3c769a0, level=level at entry=2)
 at joinrels.c:96
 #19 0x00000000005ab15f in standard_join_search (root=0x3c769a0,
 levels_needed=2, initial_rels=<optimized out>) at allpaths.c:1569
 #20 0x00000000005ab4e9 in make_one_rel (root=root at entry=0x3c769a0,
 joinlist=joinlist at entry=0x3c91f10) at allpaths.c:143
 #21 0x00000000005c6012 in query_planner (root=root at entry=0x3c769a0,
 tlist=tlist at entry=0x3c86580, tuple_fraction=tuple_fraction at entry=100,
 limit_tuples=100, qp_callback=qp_callback at entry=0x5c6bb0
 <standard_qp_callback>, qp_extra=qp_extra at entry=0x23cd930,
     cheapest_path=cheapest_path at entry=0x23cd920,
 sorted_path=sorted_path at entry=0x23cd928,
 num_groups=num_groups at entry=0x23cd918) at planmain.c:261
 #22 0x00000000005c72fd in grouping_planner (root=root at entry=0x3c769a0,
 tuple_fraction=100, tuple_fraction at entry=0) at planner.c:1207
 #23 0x00000000005c9bc9 in subquery_planner (glob=0xe0441e8,
 parse=0x3c62210, parent_root=parent_root at entry=0xdfe1f58,
 hasRecursion=<optimized out>, tuple_fraction=tuple_fraction at entry=0,
 subroot=subroot at entry=0x23cdb58) at planner.c:558
 #24 0x00000000005cea30 in SS_process_ctes (root=root at entry=0xdfe1f58) at
 subselect.c:1061
 #25 0x00000000005c96e1 in subquery_planner (glob=glob at entry=0xe0441e8,
 parse=parse at entry=0xdf2df60, parent_root=parent_root at entry=0x0,
 hasRecursion=hasRecursion at entry=0 '\000', tuple_fraction=0,
 subroot=subroot at entry=0x23cdc88) at planner.c:328
 #26 0x00000000005c9f02 in standard_planner (parse=0xdf2df60,
 cursorOptions=0, boundParams=0xda55dd8) at planner.c:209
 #27 0x0000000000640f59 in pg_plan_query (querytree=<optimized out>,
 cursorOptions=cursorOptions at entry=0,
 boundParams=boundParams at entry=0xda55dd8) at postgres.c:753
 #28 0x000000000064108b in pg_plan_queries
 (querytrees=querytrees at entry=0xdfe40a0, cursorOptions=0,
 boundParams=boundParams at entry=0xda55dd8) at postgres.c:812
 #29 0x0000000000705b76 in BuildCachedPlan
 (plansource=plansource at entry=0xdf11568, qlist=0xdfe40a0, qlist at entry=0x0,
 boundParams=boundParams at entry=0xda55dd8) at plancache.c:907
 #30 0x0000000000705db7 in GetCachedPlan
 (plansource=plansource at entry=0xdf11568,
 boundParams=boundParams at entry=0xda55dd8, useResOwner=useResOwner at entry=0
 '\000') at plancache.c:1166
 #31 0x000000000057a1fa in SPI_cursor_open_internal (name=name at entry=0x0,
 plan=plan at entry=0x23cdef0, paramLI=paramLI at entry=0xda55dd8,
 read_only=read_only at entry=1 '\001') at spi.c:1277
 #32 0x000000000057a70c in SPI_cursor_open_with_args (name=name at entry=0x0,
     src=src at entry=0xdd6a170 "\n    WITH \n      a1 AS (SELECT f.*,
 addr.fromhn, addr.tohn, addr.side , addr.zip\n
 FROM (SELECT * FROM featnames \n
 WHERE statefp = $1 AND ( lower(name) = $2   or  lower(fullname) LIKE
  $"..., nargs=<optimized out>, argtypes=0xdd6b1e0, Values=0xdd6b238,
 Nulls=0xdd6a098 "         ~\177\177\177\177\177\177A'☼\r", read_only=1
 '\001', cursorOptions=cursorOptions at entry=0) at spi.c:1171
 #33 0x000000006984d59e in exec_dynquery_with_params
 (estate=estate at entry=0x23ce360, dynquery=<optimized out>,
 params=<optimized out>, portalname=portalname at entry=0x0,
 cursorOptions=cursorOptions at entry=0) at pl_exec.c:6427
 #34 0x000000006984f325 in exec_stmt_dynfors (stmt=0xdb427e0,
 estate=0x23ce360) at pl_exec.c:3606
 #35 exec_stmt (stmt=0xdb427e0, estate=0x23ce360) at pl_exec.c:1454
 #36 exec_stmts (estate=0x23ce360, stmts=<optimized out>) at pl_exec.c:1345
 #37 0x0000000069851921 in exec_stmt_block (estate=0x0,
 estate at entry=0x23ce360, block=0xda53ee0) at pl_exec.c:1283
 #38 0x0000000069851b8d in plpgsql_exec_function (func=0xda29370,
 func at entry=0x23ce890, fcinfo=0x23ce890, fcinfo at entry=0x23ce5a8) at
 pl_exec.c:321
 #39 0x0000000069846dd8 in plpgsql_call_handler (fcinfo=0x23ce5a8) at
 pl_handler.c:129
 #40 0x000000000071d862 in fmgr_security_definer (fcinfo=0x200000000) at
 fmgr.c:975
 #41 0x000000000055ac5d in ExecMakeTableFunctionResult (funcexpr=0xdb21bd8,
 econtext=0xda49fa8, expectedDesc=0xda4b9f8, randomAccess=0 '\000') at
 execQual.c:2167
 #42 0x000000000056ed97 in FunctionNext (node=0xda49e90) at
 nodeFunctionscan.c:64
 #43 0x000000000055ce49 in ExecScanFetch (recheckMtd=0x56ed20
 <FunctionRecheck>, accessMtd=0x56ed30 <FunctionNext>, node=0xda49e90) at
 execScan.c:82
 #44 ExecScan (node=node at entry=0xda49e90,
 accessMtd=accessMtd at entry=0x56ed30 <FunctionNext>,
 recheckMtd=recheckMtd at entry=0x56ed20 <FunctionRecheck>) at execScan.c:167
 #45 0x000000000056edc3 in ExecFunctionScan (node=node at entry=0xda49e90) at
 nodeFunctionscan.c:107
 #46 0x0000000000555898 in ExecProcNode (node=node at entry=0xda49e90) at
 execProcnode.c:426
 #47 0x0000000000552a0c in ExecutePlan (dest=0xdb1b1d8,
 direction=<optimized out>, numberTuples=0, sendTuples=1 '\001',
 operation=CMD_SELECT, planstate=0xda49e90, estate=0xda49d78) at
 execMain.c:1470
 #48 standard_ExecutorRun (queryDesc=0xda2ea38, direction=<optimized out>,
 count=0) at execMain.c:306
 #49 0x00000000006441a6 in PortalRunSelect (portal=portal at entry=0xda35ca8,
 forward=forward at entry=1 '\001', count=count at entry=0,
 dest=dest at entry=0xda35ca8) at pquery.c:946
 #50 0x0000000000645876 in PortalRun (portal=0x23ceea0,
 portal at entry=0xda35ca8, count=0, count at entry=2147483647,
 isTopLevel=isTopLevel at entry=0 '\000', dest=0xda35ca8,
 dest at entry=0xdb1b1d8, altdest=altdest at entry=0xdb1b1d8,
 completionTag=0x23cf220 "",
     completionTag at entry=0x40000000088 <Address 0x40000000088 out of
 bounds>) at pquery.c:790
 #51 0x0000000000643146 in exec_simple_query (query_string=0x7fefd8e3fc0
 <msvcrt!__iob_func> "H\215\005\271ê\a") at postgres.c:1048
 #52 PostgresMain (argc=<optimized out>, argv=argv at entry=0x30aa68,
 dbname=0x17 <Address 0x17 out of bounds>, username=<optimized out>) at
 postgres.c:3985
 #53 0x00000000005f6b41 in BackendRun (port=0x23cf410) at postmaster.c:3999
 #54 SubPostmasterMain (argc=argc at entry=3, argv=argv at entry=0x2437de0) at
 postmaster.c:4504
 #55 0x000000000075fb29 in main (argc=3, argv=0x2437de0) at main.c:173
 }}}

 So gathering from the bt, I'm guessing the problem is in

 gserialized_estimate.c line 1166

 where we have:


 {{{
 POSTGIS_DEBUGF(3, "using relations \"%s\" Oid(%d), \"%s\" Oid(%d)",
                           get_rel_name(relid1), relid1,
 get_rel_name(relid2), relid2);
 }}}

 Presumably one of those inputs is returning a null pointer which is
 annoying windows.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2732>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list