package (#21) - pgRouting on NetBSD 4.0 (sparc) (#118) - Message List

pgRouting on NetBSD 4.0 (sparc)

Hello,

I'm testing pgRouting on NetBSD 4.0 (HyperSparc?/SMP, 512 MB) and I obtain a "signal 11" (segmentation fault) when I try to use :

routing=# select shortest_path_astar(

'select gid::int4 as id, source::int4, target::int4, length::double precision as cost, x1, y1, x2, y2, reverse_length::double precision as reverse_cost from streets_68420_edges', 138, 255, false, true);

... NOTICE: Conting tuples number

NOTICE: Path count 48 NOTICE: Strange stuff doing

NOTICE: Trying to allocate some memory

NOTICE: Before allocation

NOTICE: After allocation

NOTICE: Heap making

server closed the connection unexpectedly

This probably means the server terminated abnormally before or while processing the request.

The connection to the server was lost. Attempting reset: Failed. !>

Segfault is returned by line 553 in astar.c file. I don't know how fix this bug. Path computation works fine and sometimes, pgRouting does not crash and returns data to psql.

PostgreSQL log file contains : LOG: server process (PID 11565) was terminated by signal 11 LOG: terminating any other active server processes FATAL: the database system is in recovery mode LOG: all server processes terminated; reinitializing LOG: database system was interrupted at 2008-02-26 09:27:51 CET LOG: checkpoint record is at 2/2FD03048 LOG: redo record is at 2/2FD03048; undo record is at 0/0; shutdown TRUE LOG: next transaction ID: 0/12848; next OID: 34432 LOG: next MultiXactId?: 1; next MultiXactOffset?: 0 LOG: database system was not properly shut down; automatic recovery in progress LOG: record with zero length at 2/2FD03098 LOG: redo is not required LOG: database system is ready

I use a out of the box PostgreSQL server (8.2.6) : riemann:/home/pgrouting/data > LANG=C psql -d routing Welcome to psql 8.2.6, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms

\h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit

routing=# SELECT postgis_full_version();

postgis_full_version


POSTGIS="1.3.2" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS

(1 row)

routing=#

postgres writes a core file. When I open this file with gdb, I obtain : ... (gdb) backtrace #0 0x208518f4 in memcpy () from /usr/lib/libc.so.12 #1 0x000422a0 in heap_formtuple () #2 0x20d12c1c in shortest_path_astar ()

at /home/pgrouting/src/pgrouting/core/src/astar.c:548

#3 0x0010bcfc in ExecMakeFunctionResult? () #4 0x0010a328 in ExecProject? () #5 0x00119df8 in ExecResult? () #6 0x00109a7c in ExecProcNode? () #7 0x00108a88 in ExecutorRun? () #8 0x00198fa8 in PortalRunSelect? () #9 0x0019a1e0 in PortalRun? () #10 0x00195bf0 in exec_simple_query () #11 0x00197334 in PostgresMain? () #12 0x0016c730 in ServerLoop? () #13 0x0016d3f4 in PostmasterMain? () #14 0x0012914c in main () #15 0x00040638 in _start ()

Thus, I have added :

printf("Values : %p\n", values); printf("Nulls : %p\n", nulls); printf("%d %d %f\n", path[call_cntr].vertex_id, path[call_cntr].edge_id, path[call_cntr].cost);

before tuple = heap_formtuple(tuple_desc, values, nulls); and I obtain :

NOTICE: Heap making Values : 0x3ec018 Nulls : 0x3ec030 138 118 158.112807 LOG: server process (PID 8880) was terminated by signal 11

Heap_formtuple arguments seem to be correct. I don't know how check tuple_desc.

I'm sure that this postgresql server works fine (no disk or memory trouble). PostgreSQL only crashes when I use a pgRouting function. pgRouting was built with :

riemann:/home/pgrouting/data > gcc -v Using built-in specs. Target: sparc--netbsdelf Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc4/configure --enable-long-long --disable-multilib --enable-threads --disable-symvers --build=i386-unknown-netbsdelf4.99.3 --host=sparc--netbsdelf --target=sparc--netbsdelf Thread model: posix gcc version 4.1.2 20061021 prerelease (NetBSD nb3 20061125) riemann:/home/pgrouting/data > g++ -v Using built-in specs. Target: sparc--netbsdelf Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc4/configure --enable-long-long --disable-multilib --enable-threads --disable-symvers --build=i386-unknown-netbsdelf4.99.3 --host=sparc--netbsdelf --target=sparc--netbsdelf Thread model: posix gcc version 4.1.2 20061021 prerelease (NetBSD nb3 20061125) riemann:/home/pgrouting/data >

PostgreSQL and all other required tools were built with the same compiler.

Can someone help me ?

Thanks in advance,

JKB

  • Message #433

    BUG FOUND AND FIXED :

    There are _four_ fields in path_result. Thus you have to initialize _four_ columns and not _three_. You have to fix palloc() too.

    DBG("After allocation\n");

    values[0] = call_cntr; nulls[0] = ' '; values[1] = Int32GetDatum(path[call_cntr].vertex_id); nulls[1] = ' '; values[2] = Int32GetDatum(path[call_cntr].edge_id); nulls[2] = ' '; values[3] = Float8GetDatum(path[call_cntr].cost); nulls[3] = ' ';

    DBG("Heap making\n");

    You have to fix all routines. I think that postgis prototypes has changed.

    Regards,

    JKB

    • Message #437

      Hi,

      I have a problem with you fix.

      I applied the changes you suggested and it was working with x86 and gcc. I even commited it to SVN, but after some testing time I found out that all algorithms now crash from time to time. So, I rolled back to the previous version.

      I added the block you suggested to the souce code and commented it out with some description.

      I think it needs more debugging.

      Thanks anyway.

      • Message #442

        Hello,

        I don't understand. I use this patch since three weeks without trouble. Note that I only fix dijkstra.c and shortest_path_astar.c. I have uploaded my tree and you can download it at  http://www.systella.fr/~bertrand/pgRouting-JKB.tgz

        It was tested with : postgis-1.3.2 postgresql 8.2 and 8.3

        on Linux i386, amd64, sparc64 and NetBSD 4.0 sparc32

        Regards,

        JKB

      • Message #443

        Hello,

        I don't understand. I use this patch since three weeks without trouble. Note that I only fix dijkstra.c and shortest_path_astar.c. I have uploaded my tree and you can download it at  http://www.systella.fr/~bertrand/pgRouting-JKB.tgz

        It was tested with : postgis-1.3.2 postgresql 8.2 and 8.3

        on Linux i386, amd64, sparc64 and NetBSD 4.0 sparc32

        Regards,

        JKB