[postgis-users] MakePoint/GeometryFromText core dump

Chris LaReau lareau at korora.com
Sun May 1 16:56:53 PDT 2005


On Mon, May 02, 2005 at 01:07:15AM +0200, strk at refractions.net wrote:
> On Sun, May 01, 2005 at 02:07:55PM -0500, Chris LaReau wrote:
> > 
> > Greetings,
> > 
> > This is my first post to the list, but I've been toying around with
> > PostGIS for many months now, and I must say I'm very impressed with
> > it and find it very useful.
> > 
> > My problem: I just upgraded to postgresql-8.0.2, postgis-1.0.0,
> > geos-2.1.1, proj-4.4.9, and my old applications seem to be working
> > fine on my Fedora Core 3 / gcc 3.4.3 laptop. Then I built and ran
> > everything on our Red Hat 7.1 / gcc 2.96 server (the first time ever
> > running PostGIS or even PostgreSQL on this box, so I have no history
> > with it for comparison), and the MakePoint() / GeometryFromText()
> > functions cause postgres to dump core. I found a thread or two in
> > the archives about this problem, but didn't see that it had been
> > resolved or even reproduced. Unfortunately, I seem to have
> > discovered a good test case...  :-(
> 
> A good test case is a *fortune*.
> Can you send an .sql script known to reproduce the problem on
> your architecture ?
> --strk;

Sorry, the test case is actually there in my gdb and valgrind
examples, but without all the adornment it is this:

  SELECT GeometryFromText('POINT(-106 40.67)',-1);

For completeness, from an empty PostgreSQL/PostGIS install (where
$PREFIX is the postgres install prefix):

  createdb crash
  createlang plpgsql crash
  psql -d crash -f $PREFIX/share/postgresql/contrib/lwpostgis.sql
  psql -d crash -c "SELECT GeometryFromText('POINT(-106 40.67)',-1);"

The result of the last line is:

  server closed the connection unexpectedly
          This probably means the server terminated abnormally
          before or while processing the request.
  connection to server was lost

Cheers,

Chris LaReau
lareau at korora.com


> > What follows is a GDB stack trace, and also an attempt to reproduce
> > the problem under valgrind. I say "attempt" because postgres seems
> > to have some kind of (I would assume unrelated) issue with actually
> > getting up and running under valgrind, so it really wasn't much help
> > at all. I took a look at some of the code involved in the
> > GeometryFromText() crash and nothing really jumped out at me as
> > being problematic (though I have to say the comparison of a literal
> > -1 with an unsigned integer variable is a bit unsettling).
> > 
> > Any help with this would be most appreciated. I'll be happy to
> > provide any more information if I possibly can.
> > 
> > Cheers,
> > 
> > Chris LaReau
> > lareau at korora.com
> > 
> > 
> > 
> > #### gdb session ####
> > 
> > sh-2.05$ gdb run/bin/postgres                      
> > GNU gdb Red Hat Linux (5.2-2)
> > Copyright 2002 Free Software Foundation, Inc.
> > GDB is free software, covered by the GNU General Public License, and you are
> > welcome to change it and/or distribute copies of it under certain conditions.
> > Type "show copying" to see the conditions.
> > There is absolutely no warranty for GDB.  Type "show warranty" for details.
> > This GDB was configured as "i386-redhat-linux"...
> > (gdb) run -D postgresql/data incoasterpaedia
> > Starting program: /home/lareau/Korora/web/run/bin/postgres -D postgresql/data incoasterpaedia
> > LOG:  database system was shut down at 2005-05-01 04:19:19 CDT
> > LOG:  checkpoint record is at 0/186FBE4C
> > LOG:  redo record is at 0/186FBE4C; undo record is at 0/0; shutdown TRUE
> > LOG:  next transaction ID: 2170; next OID: 3048647
> > LOG:  database system is ready
> > DEBUG:  StartTransaction
> > DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 2170/1/0, nestlvl: 1, children: <>
> > DEBUG:  CommitTransaction
> > DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 2170/1/0, nestlvl: 1, children: <>
> > 
> > PostgreSQL stand-alone backend 8.0.2
> > backend> SELECT GeometryFromText('POINT(-106 40.6666666666667)',-1);
> > DEBUG:  StartTransaction
> > STATEMENT:  SELECT GeometryFromText('POINT(-106 40.6666666666667)',-1);
> > 
> > DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 2171/1/0, nestlvl: 1, children: <>
> > STATEMENT:  SELECT GeometryFromText('POINT(-106 40.6666666666667)',-1);
> > 
> > 
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x40c248ef in lwpoint_serialize_buf (point=0x8301a58, 
> >     buf=0x8301a34 "info_LWGEOM_from_text", retsize=0xbfffdab8) at lwpoint.c:44
> > 44              hasSRID = (point->SRID != -1);
> > (gdb) where
> > #0  0x40c248ef in lwpoint_serialize_buf (point=0x8301a58, 
> >     buf=0x8301a34 "info_LWGEOM_from_text", retsize=0xbfffdab8) at lwpoint.c:44
> > #1  0x40c23fe5 in lwgeom_serialize_buf (lwgeom=0x8301a58, 
> >     buf=0x8301a34 "info_LWGEOM_from_text", retsize=0xbfffdab8) at lwgeom.c:81
> > #2  0x40c2b57e in pglwgeom_serialize (in=0x8301a58) at lwgeom_pg.c:121
> > #3  0x40c2e1ca in LWGEOM_from_text (fcinfo=0xbfffdb40) at lwgeom_ogc.c:813
> > #4  0x0810334c in ExecMakeFunctionResult (fcache=0x82ffa18, 
> >     econtext=0x82ffb88, isNull=0xbfffdc7b "", isDone=0x0) at execQual.c:1042
> > #5  0x081050fb in ExecEvalExprSwitchContext (expression=0x82ffa18, 
> >     econtext=0x82ffb88, isNull=0xbfffdc7b "", isDone=0x0) at execQual.c:2781
> > #6  0x0813f9a0 in evaluate_expr (expr=0x82f7e60, result_type=3006102)
> >     at clauses.c:2479
> > #7  0x0813f120 in simplify_function (funcid=3006222, result_type=3006102, 
> >     args=0x82f7e10, allow_inline=1 '\001', context=0xbfffdf20)
> >     at clauses.c:2002
> > #8  0x0813e745 in eval_const_expressions_mutator (node=0x82f7c88, 
> >     context=0xbfffdf20) at clauses.c:1295
> > #9  0x08140769 in expression_tree_mutator (node=0x82f77a8, 
> >     mutator=0x813e67c <eval_const_expressions_mutator>, context=0xbfffdf20)
> >     at clauses.c:3210
> > #10 0x0813ef7b in eval_const_expressions_mutator (node=0x82f77a8, 
> >     context=0xbfffdf20) at clauses.c:1846
> > #11 0x0814086f in expression_tree_mutator (node=0x82f7758, 
> >     mutator=0x813e67c <eval_const_expressions_mutator>, context=0xbfffdf20)
> >     at clauses.c:3285
> > #12 0x0813ef7b in eval_const_expressions_mutator (node=0x82f7758, 
> >     context=0xbfffdf20) at clauses.c:1846
> > #13 0x0813e651 in eval_const_expressions (node=0x82f7758) at clauses.c:1201
> > #14 0x08137a6e in preprocess_expression (parse=0x82f7620, expr=0x82f7758, 
> >     kind=1) at planner.c:416
> > #15 0x08137816 in subquery_planner (parse=0x82f7620, tuple_fraction=0)
> >     at planner.c:241
> > #16 0x081376d3 in planner (parse=0x82f7620, isCursor=0 '\0', cursorOptions=0, 
> >     boundParams=0x0) at planner.c:130
> > #17 0x08168ba7 in pg_plan_query (querytree=0x82f7620, boundParams=0x0)
> >     at postgres.c:647
> > #18 0x08168c4e in pg_plan_queries (querytrees=0x82f7d58, boundParams=0x0, 
> >     needSnapshot=1) at postgres.c:715
> > #19 0x08168e6f in exec_simple_query (
> >     query_string=0x82f7250 "SELECT GeometryFromText('POINT(-106 40.", '6' <repeats 12 times>, "7)',-1);\n") at postgres.c:874
> > #20 0x0816b34e in PostgresMain (argc=4, argv=0x82adbc8, 
> >     username=0x82ae168 "postgres") at postgres.c:3007
> > #21 0x081194f5 in main (argc=4, argv=0x82adbc8) at main.c:334
> > #22 0x400f1336 in __libc_start_main (main=0x8119290 <main>, argc=4, 
> >     ubp_av=0xbfffe2c4, init=0x8073d68 <_init>, fini=0x81e1d00 <_fini>, 
> >     rtld_fini=0x4000d2fc <_dl_fini>, stack_end=0xbfffe2bc)
> >     at ../sysdeps/generic/libc-start.c:129
> > (gdb) p point
> > $1 = (LWPOINT *) 0x8301a58
> > (gdb) p *point
> > $2 = {type = 1 '\001', bbox = 0x0, SRID = 4294967295, point = 0x8301a70}
> > 
> > 
> > 
> > 
> > #### valgrind attempt ####
> > 
> > sh-2.05$ echo "SELECT GeometryFromText('POINT(-106 40.67)',-1);" | run/bin/valgrind -v --num-callers=10 --log-file=/tmp/gftlog run/bin/postgres -D postgresql/data incoasterpaedia
> > 
> > sh-2.05$ cat /tmp/gftlog.pid28555
> > ==28555== Memcheck, a memory error detector for x86-linux.
> > ==28555== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
> > ==28555== Using valgrind-2.4.0, a program supervision framework for x86-linux.
> > ==28555== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
> > ==28555== 
> > ==28555== My PID = 28555, parent PID = 28459.  Prog and args are:
> > ==28555==    run/bin/postgres
> > ==28555==    -D
> > ==28555==    postgresql/data
> > ==28555==    incoasterpaedia
> > ==28555== 
> > ==28555== Valgrind library directory: /home/lareau/Korora/web/run/lib/valgrind
> > ==28555== Command line
> > ==28555==    run/bin/postgres
> > ==28555==    -D
> > ==28555==    postgresql/data
> > ==28555==    incoasterpaedia
> > ==28555== Startup, with flags:
> > ==28555==    -v
> > ==28555==    --num-callers=10
> > ==28555==    --log-file=/tmp/gftlog
> > ==28555== Contents of /proc/version:
> > ==28555==   Linux version 2.4.9-31.3RS (root at rh72-build.rackspace.com) (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)) #1 Fri May 3 18:33:32 CDT 2002
> > ==28555== Reading syms from /home/lareau/Korora/web/run/bin/postgres (0x8048000)
> > ==28555== Reading syms from /lib/ld-2.2.4.so (0x1B8E4000)
> > ==28555== Reading syms from /home/lareau/Korora/web/run/lib/valgrind/stage2 (0xB0000000)
> > ==28555== Reading syms from /lib/ld-2.2.4.so (0xB1000000)
> > ==28555== Reading syms from /lib/libdl-2.2.4.so (0xB1020000)
> > ==28555== Reading syms from /lib/libc-2.2.4.so (0xB1024000)
> > ==28555== Reading syms from /home/lareau/Korora/web/run/lib/valgrind/vgskin_memcheck.so (0xB1300000)
> > ==28555== Reading suppressions file: /home/lareau/Korora/web/run/lib/valgrind/default.supp
> > ==28555== 
> > ==28555== Reading syms from /home/lareau/Korora/web/run/lib/valgrind/vg_inject.so (0x1B8FD000)
> > ==28555== Reading syms from /home/lareau/Korora/web/run/lib/valgrind/vgpreload_memcheck.so (0x1B900000)
> > ==28555== Reading syms from /usr/lib/libz.so.1.1.3 (0x1B912000)
> > ==28555==    object doesn't have any debug info
> > ==28555== Reading syms from /usr/lib/libreadline.so.4.2 (0x1B921000)
> > ==28555==    object doesn't have any debug info
> > ==28555== Reading syms from /lib/libtermcap.so.2.0.8 (0x1B94A000)
> > ==28555==    object doesn't have a symbol table
> > ==28555==    object doesn't have any debug info
> > ==28555== Reading syms from /lib/libcrypt-2.2.4.so (0x1B94F000)
> > ==28555== Reading syms from /lib/libresolv-2.2.4.so (0x1B97D000)
> > ==28555== Reading syms from /lib/libnsl-2.2.4.so (0x1B990000)
> > ==28555== Reading syms from /lib/libdl-2.2.4.so (0x1B9A8000)
> > ==28555== Reading syms from /lib/libm-2.2.4.so (0x1B9AD000)
> > ==28555== Reading syms from /lib/libc-2.2.4.so (0x1B9D0000)
> > ==28555== TRANSLATE: 0x1BA4C380 redirected to 0x1B903520
> > ==28555== TRANSLATE: 0x1BA4CF10 redirected to 0x1B903A70
> > ==28555== TRANSLATE: 0x1BA543C0 redirected to 0x1B904AC0
> > ==28555== TRANSLATE: 0x1BA4DDD8 redirected to 0x1B903ED0
> > ==28555== Reading syms from /lib/libnss_files-2.2.4.so (0x1BC0A000)
> > ==28555== TRANSLATE: 0x1BA52AFC redirected to 0x1B9046C4
> > ==28555== TRANSLATE: 0x1BA4D2E4 redirected to 0x1B903F84
> > ==28555== 
> > ==28555== Process terminating with default action of signal 6 (SIGABRT): dumping core
> > ==28555==    at 0x1B9FE921: kill (in /lib/libc-2.2.4.so)
> > ==28555==    by 0x1B9FFD07: abort (../sysdeps/generic/abort.c:88)
> > ==28555==    by 0x81C8120: errfinish (elog.c:451)
> > ==28555==    by 0x8098578: ReadControlFile (xlog.c:3211)
> > ==28555==    by 0x8098EF7: XLOGShmemInit (xlog.c:3457)
> > ==28555==    by 0x815F223: CreateSharedMemoryAndSemaphores (ipci.c:140)
> > ==28555==    by 0x81CF0C6: InitCommunication (postinit.c:188)
> > ==28555==    by 0x81CF0D6: BaseInit (postinit.c:210)
> > ==28555==    by 0x816AF3A: PostgresMain (postgres.c:2694)
> > ==28555==    by 0x81194F4: main (main.c:334)
> > ==28555== discard syms at 0x1BC0A000-0x1BC15000 in /lib/libnss_files-2.2.4.so due to munmap()
> > ==28555== 
> > ==28555== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 3)
> > --28555-- 
> > --28555-- supp:    3 _dl_start/ld-2.2.4.so(Cond)
> > --28555-- supp:   40 _dl_relocate_object/dl_main(Cond)
> > --28555-- supp:    3 _dl_relocate_object/libc-2.2.4.so/_dl_catch_error(Cond)
> > ==28555== malloc/free: in use at exit: 43943 bytes in 91 blocks.
> > ==28555== malloc/free: 213 allocs, 122 frees, 149593 bytes allocated.
> > ==28555== 
> > ==28555== searching for pointers to 91 not-freed blocks.
> > ==28555== checked 648620 bytes.
> > ==28555== 
> > ==28555== LEAK SUMMARY:
> > ==28555==    definitely lost: 1460 bytes in 35 blocks.
> > ==28555==      possibly lost: 0 bytes in 0 blocks.
> > ==28555==    still reachable: 42483 bytes in 56 blocks.
> > ==28555==         suppressed: 0 bytes in 0 blocks.
> > ==28555== Use --leak-check=full to see details of leaked memory.
> > --28555--     TT/TC: 0 tc sectors discarded.
> > --28555--            6691 tt_fast misses.
> > --28555-- translate: new     6445 (99118 -> 1489194; ratio 150:10)
> > --28555--            discard 115 (1405 -> 21840; ratio 155:10).
> > --28555-- chainings: 4389 chainings, 0 unchainings.
> > --28555--  dispatch: 38048993 jumps (bb entries); of them 1210293 (3%) unchained.
> > --28555--            761/10428 major/minor sched events.
> > --28555-- reg-alloc: 1043 t-req-spill, 269126+6669 orig+spill uis,
> > --28555--            33057 total-reg-rank
> > --28555--    sanity: 762 cheap, 31 expensive checks.
> > --28555--    ccalls: 27978 C calls, 54% saves+restores avoided (90542 bytes)
> > --28555--            36153 args, avg 0.86 setup instrs each (9828 bytes)
> > --28555--            0% clear the stack (83934 bytes)
> > --28555--            10177 retvals, 31% of reg-reg movs avoided (6222 bytes)
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list