[postgis-tickets] [PostGIS] #3395: PostGIS 2.2.0 upgrade issue

PostGIS trac at osgeo.org
Mon Jan 11 14:25:29 PST 2016


#3395: PostGIS 2.2.0 upgrade issue
----------------------+---------------------------
  Reporter:  peters   |      Owner:  pramsey
      Type:  defect   |     Status:  reopened
  Priority:  medium   |  Milestone:  PostGIS 2.2.1
 Component:  postgis  |    Version:  2.2.x
Resolution:           |   Keywords:
----------------------+---------------------------
Changes (by norbyte):

 * status:  closed => reopened
 * resolution:  worksforme =>


Comment:

 I have the same issue with upgrading PostGIS 2.1.8 to 2.2.1.

 PostgreSQL 9.4.5, PostGIS version: POSTGIS="2.1.8 r13780"
 GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL
 1.11.2, released 2015/02/10" LIBXML="2.9.1" RASTER

 New version: POSTGIS="2.2.1 r14555" GEOS="3.5.0-CAPI-1.9.0 r4084"
 PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.2, released 2015/02/10"
 LIBXML="2.9.1" LIBJSON="0.11" RASTER

 When trying to upgrade PostGIS the query hangs with 100% cpu usage and I
 get the following output:
 {{{
 xxxx=# alter extension postgis update to '2.2.1';
 WARNING:  'postgis.backend' is already set and cannot be changed until you
 reconnect
 CONTEXT:  SQL statement "SELECT                  postgis_lib_version()"
 PL/pgSQL function postgis_major_version_check() line 21 at SQL statement
 }}}

 Stack trace of the hung backend:

 {{{
 #0  rt_set_handlers (allocator=0x7f69628c0410 <rt_pg_alloc>,
 reallocator=0x7f69628c0430 <rt_pg_realloc>, deallocator=0x7f69628c0420
 <rt_pg_free>, error_handler=0x7f69628c0a40 <rt_pg_error>,
     info_handler=0x7f69628c09a0 <rt_pg_debug>,
 warning_handler=0x7f69628c0900 <rt_pg_notice>) at rt_context.c:169
 #1  0x00007f69582c76e9 in init_rt_allocator (size=3904) at rt_api.c:881
 #2  0x00007f69582cf5da in rt_raster_gdal_drivers
 (drv_count=drv_count at entry=0x7fff637188b4, cancc=cancc at entry=0 '\000') at
 rt_api.c:8975
 #3  0x00007f69582a41d3 in rtpg_assignHookGDALEnabledDrivers () at
 rt_pg.c:172
 #4  _PG_init () at rt_pg.c:291
 #5  0x0000000000799d5a in internal_load_library
 (libname=libname at entry=0x3ab1c50 "/usr/pgsql-9.5/lib/rtpostgis-2.1.so") at
 dfmgr.c:280
 #6  0x000000000079a573 in load_external_function
 (filename=filename at entry=0x3ab1b90 "$libdir/rtpostgis-2.1",
 funcname=funcname at entry=0x3ab1b60 "RASTER_lib_version",
     signalNotFound=signalNotFound at entry=1 '\001',
 filehandle=filehandle at entry=0x7fff63718a68) at dfmgr.c:109
 #7  0x000000000079b275 in fmgr_info_C_lang (procedureTuple=0x36800f8,
 finfo=0x3aafc80, functionId=17689) at fmgr.c:351
 #8  fmgr_info_cxt_security (functionId=functionId at entry=17689,
 finfo=finfo at entry=0x3aafc80, mcxt=mcxt at entry=0x3ac7ff0,
 ignore_security=ignore_security at entry=0 '\000') at fmgr.c:282
 #9  0x000000000079b537 in fmgr_info_cxt
 (functionId=functionId at entry=17689, finfo=finfo at entry=0x3aafc80,
 mcxt=mcxt at entry=0x3ac7ff0) at fmgr.c:172
 #10 0x00000000005b170f in init_fcache (foid=17689, input_collation=0,
 fcache=fcache at entry=0x3aafc60, fcacheCxt=0x3ac7ff0,
 needDescForSets=needDescForSets at entry=1 '\001') at execQual.c:1328
 #11 0x00000000005b52a0 in ExecEvalFunc (fcache=0x3aafc60,
 econtext=0x3ab0470, isNull=0x7fff63718bd4 "", isDone=0x0) at
 execQual.c:2393
 #12 0x00000000005b5ecc in ExecEvalExprSwitchContext
 (expression=expression at entry=0x3aafc60, econtext=<optimized out>,
 isNull=isNull at entry=0x7fff63718bd4 "", isDone=isDone at entry=0x0) at
 execQual.c:4391
 #13 0x0000000000636e8b in evaluate_expr (expr=<optimized out>,
 result_type=result_type at entry=25, result_typmod=result_typmod at entry=-1,
 result_collation=result_collation at entry=100) at clauses.c:4643
 #14 0x0000000000639a76 in evaluate_function (func_tuple=0x36800f8,
 context=0x7fff63718f60, funcvariadic=0 '\000', args=0x0, input_collid=0,
 result_collid=100, result_typmod=-1, result_type=25,
     funcid=17689) at clauses.c:4203
 #15 simplify_function (funcid=17689, result_type=25, result_typmod=-1,
 result_collid=result_collid at entry=100, input_collid=input_collid at entry=0,
 args_p=args_p at entry=0x7fff63718d70,
     funcvariadic=funcvariadic at entry=0 '\000',
 process_args=process_args at entry=1 '\001',
 allow_non_const=allow_non_const at entry=1 '\001',
 context=context at entry=0x7fff63718f60) at clauses.c:3842
 #16 0x0000000000638cc4 in eval_const_expressions_mutator (node=0x3aac2f0,
 context=0x7fff63718f60) at clauses.c:2520
 #17 0x00000000005e8893 in expression_tree_mutator
 (node=node at entry=0x3aac2a0, mutator=mutator at entry=0x638420
 <eval_const_expressions_mutator>, context=context at entry=0x7fff63718f60) at
 nodeFuncs.c:2789
 #18 0x0000000000638820 in eval_const_expressions_mutator (node=0x3aac2a0,
 context=0x7fff63718f60) at clauses.c:3492
 #19 0x00000000005e872b in expression_tree_mutator
 (node=node at entry=0x3aac250, mutator=mutator at entry=0x638420
 <eval_const_expressions_mutator>, context=context at entry=0x7fff63718f60) at
 nodeFuncs.c:2684
 #20 0x0000000000638820 in eval_const_expressions_mutator (node=0x3aac250,
 context=context at entry=0x7fff63718f60) at clauses.c:3492
 #21 0x000000000063a8af in eval_const_expressions
 (root=root at entry=0x3aac400, node=<optimized out>) at clauses.c:2362
 #22 0x0000000000625cb5 in preprocess_expression
 (root=root at entry=0x3aac400, expr=<optimized out>, kind=kind at entry=1) at
 planner.c:720
 #23 0x000000000062a5d3 in subquery_planner (glob=glob at entry=0x3aac370,
 parse=parse at entry=0x3aac110, parent_root=parent_root at entry=0x0,
 hasRecursion=hasRecursion at entry=0 '\000', tuple_fraction=0,
     subroot=subroot at entry=0x7fff63719070) at planner.c:444
 #24 0x000000000062ac2b in standard_planner (parse=0x3aac110,
 cursorOptions=0, boundParams=0x0) at planner.c:229
 #25 0x00000000006a98fc in pg_plan_query (querytree=<optimized out>,
 cursorOptions=cursorOptions at entry=0, boundParams=boundParams at entry=0x0) at
 postgres.c:809
 #26 0x00000000006a99f4 in pg_plan_queries
 (querytrees=querytrees at entry=0x3aac0c0, cursorOptions=0,
 boundParams=boundParams at entry=0x0) at postgres.c:868
 #27 0x0000000000784c66 in BuildCachedPlan
 (plansource=plansource at entry=0x3a74070, qlist=0x3aac0c0, qlist at entry=0x0,
 boundParams=boundParams at entry=0x0) at plancache.c:938
 #28 0x0000000000784f11 in GetCachedPlan (plansource=0x3a74070,
 boundParams=boundParams at entry=0x0, useResOwner=<optimized out>) at
 plancache.c:1152
 #29 0x00000000005d59f2 in SPI_plan_get_cached_plan (plan=<optimized out>)
 at spi.c:1705
 #30 0x00007f6965e8b526 in exec_simple_check_plan (expr=0x3aa9948) at
 pl_exec.c:6538
 #31 exec_prepare_plan (expr=expr at entry=0x3aa9948,
 cursorOptions=cursorOptions at entry=0, estate=0x7fff63719710) at
 pl_exec.c:3484
 #32 0x00007f6965e8e738 in exec_stmt_execsql
 (estate=estate at entry=0x7fff63719710, stmt=stmt at entry=0x3aa9a28) at
 pl_exec.c:3516
 #33 0x00007f6965e8fc67 in exec_stmt (stmt=0x3aa9a28,
 estate=0x7fff63719710) at pl_exec.c:1544
 #34 exec_stmts (estate=0x7fff63719710, stmts=<optimized out>) at
 pl_exec.c:1439
 #35 0x00007f6965e91949 in exec_stmt_block
 (estate=estate at entry=0x7fff63719710, block=block at entry=0x3aaa2d0) at
 pl_exec.c:1238
 #36 0x00007f6965e8f82f in exec_stmt (stmt=0x3aaa2d0,
 estate=0x7fff63719710) at pl_exec.c:1472
 #37 exec_stmts (estate=0x7fff63719710, stmts=<optimized out>) at
 pl_exec.c:1439
 #38 0x00007f6965e91aa8 in exec_stmt_block
 (estate=estate at entry=0x7fff63719710, block=0x3aab110) at pl_exec.c:1377
 #39 0x00007f6965e91cd1 in plpgsql_exec_function
 (func=func at entry=0x3ac86e0, fcinfo=fcinfo at entry=0x3aa3f80,
 simple_eval_estate=simple_eval_estate at entry=0x0) at pl_exec.c:426
 #40 0x00007f6965e86d07 in plpgsql_call_handler (fcinfo=0x3aa3f80) at
 pl_handler.c:253
 #41 0x00000000005b1ae2 in ExecMakeFunctionResultNoSets (fcache=0x3aa3f10,
 econtext=0x3aa3d20, isNull=0x3aa4898 "p\315\365\002", isDone=<optimized
 out>) at execQual.c:2019
 #42 0x00000000005b741d in ExecTargetList (isDone=0x7fff63719a24,
 itemIsDone=0x3aa49b0, isnull=<optimized out>, values=0x3aa4880,
 econtext=0x3aa3d20, targetlist=0x3aa4980) at execQual.c:5365
 #43 ExecProject (projInfo=<optimized out>,
 isDone=isDone at entry=0x7fff63719a24) at execQual.c:5580
 #44 0x00000000005ca7c2 in ExecResult (node=node at entry=0x3aa3c10) at
 nodeResult.c:155
 #45 0x00000000005b09d8 in ExecProcNode (node=node at entry=0x3aa3c10) at
 execProcnode.c:385
 #46 0x00000000005adb90 in ExecutePlan (dest=0xbcfe60 <donothingDR>,
 direction=<optimized out>, numberTuples=0, sendTuples=1 '\001',
 operation=CMD_SELECT, planstate=0x3aa3c10, estate=0x3aa3b00)
     at execMain.c:1549
 #47 standard_ExecutorRun (queryDesc=0x3a6fae0, direction=<optimized out>,
 count=0) at execMain.c:337
 #48 0x00007f69eb577065 in pgss_ExecutorRun (queryDesc=0x3a6fae0,
 direction=ForwardScanDirection, count=0) at pg_stat_statements.c:881
 #49 0x00000000005681ae in execute_sql_string (filename=<optimized out>,
     sql=0x28f0f60 "\n-- - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - -\n-- \n----\n-- PostGIS - Spatial Types for
 PostgreSQL\n-- http://postgis.net\n--\n-- Copyright (C) 2011 Regina Obe
 <lr at pcorp.us>\n--\n"...) at extension.c:736
 #50 execute_extension_script (extensionOid=extensionOid at entry=16702,
 control=control at entry=0x284cf88, from_version=from_version at entry=0x284c750
 "2.1.8", version=version at entry=0x284cda8 "2.2.1",
     requiredSchemas=requiredSchemas at entry=0x0,
 schemaName=schemaName at entry=0x28ee8c8 "public", schemaOid=<optimized out>)
 at extension.c:904
 #51 0x00000000005688ad in ApplyExtensionUpdates
 (extensionOid=extensionOid at entry=16702, pcontrol=pcontrol at entry=0x284c4d0,
 initialVersion=initialVersion at entry=0x284c750 "2.1.8",
     updateVersions=<optimized out>) at extension.c:2875
 #52 0x000000000056acaf in ExecAlterExtensionStmt
 (stmt=stmt at entry=0x28a9998) at extension.c:2722
 #53 0x00000000006af83a in ProcessUtilitySlow
 (parsetree=parsetree at entry=0x28a9998,
 queryString=queryString at entry=0x28a8ec0 "alter extension postgis update to
 '2.2.1';", context=<optimized out>,
     params=params at entry=0x0,
 completionTag=completionTag at entry=0x7fff6371a8e0 "", dest=0x28a9cd8) at
 utility.c:1285
 #54 0x00000000006aeab1 in standard_ProcessUtility (parsetree=0x28a9998,
 queryString=0x28a8ec0 "alter extension postgis update to '2.2.1';",
 context=<optimized out>, params=0x0, dest=0x28a9cd8,
     completionTag=0x7fff6371a8e0 "") at utility.c:892
 #55 0x00007f69eb578fc1 in pgss_ProcessUtility (parsetree=0x28a9998,
 queryString=0x28a8ec0 "alter extension postgis update to '2.2.1';",
 context=PROCESS_UTILITY_TOPLEVEL, params=0x0, dest=0x28a9cd8,
     completionTag=0x7fff6371a8e0 "") at pg_stat_statements.c:990
 #56 0x00000000006ac471 in PortalRunUtility (portal=0x2841620,
 utilityStmt=0x28a9998, isTopLevel=<optimized out>, dest=0x28a9cd8,
 completionTag=0x7fff6371a8e0 "") at pquery.c:1183
 #57 0x00000000006ad005 in PortalRunMulti (portal=portal at entry=0x2841620,
 isTopLevel=isTopLevel at entry=1 '\001', dest=dest at entry=0x28a9cd8,
 altdest=altdest at entry=0x28a9cd8,
     completionTag=completionTag at entry=0x7fff6371a8e0 "") at pquery.c:1314
 #58 0x00000000006adaac in PortalRun (portal=portal at entry=0x2841620,
 count=count at entry=9223372036854775807, isTopLevel=isTopLevel at entry=1
 '\001', dest=dest at entry=0x28a9cd8,
     altdest=altdest at entry=0x28a9cd8,
 completionTag=completionTag at entry=0x7fff6371a8e0 "") at pquery.c:812
 #59 0x00000000006ab883 in exec_simple_query (query_string=0x28a8ec0 "alter
 extension postgis update to '2.2.1';") at postgres.c:1104
 #60 PostgresMain (argc=<optimized out>, argv=argv at entry=0x2828210,
 dbname=0x28280c0 "xxxx", username=<optimized out>) at postgres.c:4030
 #61 0x0000000000468f61 in BackendRun (port=0x284ec30) at postmaster.c:4237
 #62 BackendStartup (port=0x284ec30) at postmaster.c:3913
 #63 ServerLoop () at postmaster.c:1684
 #64 0x0000000000655626 in PostmasterMain (argc=argc at entry=3,
 argv=argv at entry=0x2827270) at postmaster.c:1292
 #65 0x0000000000469b8e in main (argc=3, argv=0x2827270) at main.c:223
 }}}

 One strange thing I noticed in the stack trace is that the backend tries
 to load a function from PostGIS 2.1 at frame #5
 ("/usr/pgsql-9.5/lib/rtpostgis-2.1.so"), however at frame #1 the
 init_rt_allocator() function in rtpostgis-2.1.so ends up calling the
 rt_set_handlers() (IP 0x7f69582a41d3) of rtpostgis-2.2.so!
 {{{
 0x00007f69628c0310  0x00007f6962925318  Yes
 /usr/pgsql-9.5/lib/rtpostgis-2.2.so
 0x00007f69582a1ae0  0x00007f6958301b28  Yes
 /usr/pgsql-9.5/lib/rtpostgis-2.1.so
 }}}

 It seems to me that loading both rtpostgis-2.1.so and rtpostgis-2.2.so
 causes some kind of problem with library initialization?

--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/3395#comment:3>
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