woodbri / osrm-tools

Tools to extract postgresql database into OSRM normalized files, and postgresql function to access OSRM Server.
BSD 2-Clause "Simplified" License
30 stars 6 forks source link

Connection Lost using osrm-tools #11

Closed paulobraga closed 9 years ago

paulobraga commented 9 years ago

Hello, I am trying to use osrm_tools in order to access osrm api through sql functions.

I already did

CREATE EXTENSION osrm;
I ran
\df osrm_*;
and got all the osrm functions; I started the osrm-routed in port 5000 and can sucessfully access it through the browser and get results;

But using osrm-tools, for example:

select * from osrm_locate(lat, lon);
I get
"The connection to the server was lost. Attempting reset: Failed."

I am using a virtual machine running ubuntu server 14.04.

route=# select version();
                                               version                                                
------------------------------------------------------------------------------------------------------
 PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)

route=# 
woodbri commented 9 years ago

This works for me,

osrm_test=# select * from osrm_locate(-34.897730,-56.124100);
   m_lat    |   m_lon
------------+------------
 -34.898194 | -56.123845
(1 row)

osrm_test=# select version();
                                                  version                       
------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.2.9 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit
(1 row)

I have not tried to run this under 14.04 or a newer version of postgresql. If you want to do some debugging try making a script like the following. change the database to your database and the server paths for your system.

sudo apt-get install valgrind

if you don't have it installed.

#!/bin/bash

sudo service postgresql stop

echo "select * from  from osrm_locate(lat, lon)" | sudo -u postgres valgrind --leak-check=yes -v --undef-value-errors=yes --track-origins=yes --log-file=valgrindlog /usr/lib/postgresql/9.3/bin/postgres --single -D /etc/postgresql/9.3/main/ osrm_test

sudo service postgresql start

Run that and post the contents of "valgrindlog" as a comment on this ticket.

paulobraga commented 9 years ago

That's what my script looks like:


vagrant@packer-virtualbox-iso:~$ cat debug_osrm.sh 
#!/bin/bash
sudo service postgresql stop
echo "select * from osrm_locate(-25.95967, 32.58219)" | sudo -u postgres valgrind --leak-check=yes -v --undef-value-errors=yes --track-origins=yes --log-file=valgrind/valgrindlog /usr/lib/postgresql/9.3/bin/postgres --single -D /etc/postgresql/9.3/main/ route
sudo service postgresql start

Running the script I got:


Last login: Thu Jan  1 19:51:53 2015 from 10.0.2.2
vagrant@packer-virtualbox-iso:~$ ./debug_osrm.sh 
 * Stopping PostgreSQL 9.3 database server                                                                                                      [ OK ] 
[sudo] password for vagrant: 
PostgreSQL stand-alone backend 9.3.5
backend>         1: m_lat       (typeid = 701, len = 8, typmod = -1, byval = t)
         2: m_lon       (typeid = 701, len = 8, typmod = -1, byval = t)
        ----
         1: m_lat = "-25.959677"        (typeid = 701, len = 8, typmod = -1, byval = t)
         2: m_lon = "32.582428" (typeid = 701, len = 8, typmod = -1, byval = t)
        ----
backend>  * Starting PostgreSQL 9.3 database server 

the valgrindlog file looks like this:


vagrant@packer-virtualbox-iso:~/valgrind$ cat valgrindlog 
==3267== Memcheck, a memory error detector
==3267== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==3267== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==3267== Command: /usr/lib/postgresql/9.3/bin/postgres --single -D /etc/postgresql/9.3/main/ route
==3267== Parent PID: 3266
==3267== 
--3267-- 
--3267-- Valgrind options:
--3267--    --leak-check=yes
--3267--    -v
--3267--    --undef-value-errors=yes
--3267--    --track-origins=yes
--3267--    --log-file=valgrind/valgrindlog
--3267-- Contents of /proc/version:
--3267--   Linux version 3.13.0-24-generic (buildd@batsu) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014
--3267-- Arch and hwcaps: AMD64, amd64-rdtscp-sse3
--3267-- Page sizes: currently 4096, max supported 4096
--3267-- Valgrind library directory: /usr/lib/valgrind
--3267-- Reading syms from /usr/lib/postgresql/9.3/bin/postgres
--3267--   Considering /usr/lib/postgresql/9.3/bin/postgres ..
--3267--   .. CRC mismatch (computed 070d2bf9 wanted 3b5844a8)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/ld-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/ld-2.19.so ..
--3267--   .. CRC mismatch (computed 4cbae35e wanted 8d683c31)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux
--3267--   Considering /usr/lib/valgrind/memcheck-amd64-linux ..
--3267--   .. CRC mismatch (computed 37cdde19 wanted adc367dd)
--3267--    object doesn't have a symbol table
--3267--    object doesn't have a dynamic symbol table
--3267-- Scheduler: using generic scheduler lock implementation.
--3267-- Reading suppressions file: /usr/lib/valgrind/default.supp
==3267== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-3267-by-postgres-on-???
==3267== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-3267-by-postgres-on-???
==3267== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-3267-by-postgres-on-???
==3267== 
==3267== TO CONTROL THIS PROCESS USING vgdb (which you probably
==3267== don't want to do, unless you know exactly what you're doing,
==3267== or are doing some strange experiment):
==3267==   /usr/lib/valgrind/../../bin/vgdb --pid=3267 ...command...
==3267== 
==3267== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==3267==   /path/to/gdb /usr/lib/postgresql/9.3/bin/postgres
==3267== and then give GDB the following command
==3267==   target remote | /usr/lib/valgrind/../../bin/vgdb --pid=3267
==3267== --pid is optional if only one valgrind process is running
==3267== 
--3267-- REDIR: 0x4019ca0 (strlen) redirected to 0x38068331 (???)
--3267-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so
--3267--   Considering /usr/lib/valgrind/vgpreload_core-amd64-linux.so ..
--3267--   .. CRC mismatch (computed 329d6860 wanted c0186920)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
--3267--   Considering /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so ..
--3267--   .. CRC mismatch (computed 1fb85af8 wanted 2e9e3c16)
--3267--    object doesn't have a symbol table
==3267== WARNING: new redirection conflicts with existing -- ignoring it
--3267--     old: 0x04019ca0 (strlen              ) R-> (0000.0) 0x38068331 ???
--3267--     new: 0x04019ca0 (strlen              ) R-> (2007.0) 0x04c2e1a0 strlen
--3267-- REDIR: 0x4019a50 (index) redirected to 0x4c2dd50 (index)
--3267-- REDIR: 0x4019c70 (strcmp) redirected to 0x4c2f2f0 (strcmp)
--3267-- REDIR: 0x401a9c0 (mempcpy) redirected to 0x4c31da0 (mempcpy)
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.1
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libpam.so.0.83.1
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libssl.so.1.0.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
--3267--   Considering /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3 ..
--3267--   .. CRC mismatch (computed e608eb2d wanted 8bd2a4a3)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libcom_err.so.2.1
--3267--   Considering /lib/x86_64-linux-gnu/libcom_err.so.2.1 ..
--3267--   .. CRC mismatch (computed c8224b1b wanted 4ffc15c0)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
--3267--   Considering /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2 ..
--3267--   .. CRC mismatch (computed 0808fb7b wanted c3ed3adb)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libdl-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libdl-2.19.so ..
--3267--   .. CRC mismatch (computed c1315e8c wanted 37097b60)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libdl-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /lib/x86_64-linux-gnu/libm-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libm-2.19.so ..
--3267--   .. CRC mismatch (computed 0ebccb69 wanted 44d41128)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libm-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.8.3
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libc-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libc-2.19.so ..
--3267--   .. CRC mismatch (computed dcf17485 wanted ea12409d)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /lib/x86_64-linux-gnu/libz.so.1.2.8
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/liblzma.so.5.0.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libaudit.so.1.0.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
--3267--   Considering /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1 ..
--3267--   .. CRC mismatch (computed 32a9532f wanted c4494603)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
--3267--   Considering /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1 ..
--3267--   .. CRC mismatch (computed e27d2a9e wanted bc9a55dc)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libkeyutils.so.1.4
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libresolv-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libresolv-2.19.so ..
--3267--   .. CRC mismatch (computed 5c733db8 wanted 30cd2eee)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libresolv-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /lib/x86_64-linux-gnu/libpthread-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libpthread-2.19.so ..
--3267--   .. CRC mismatch (computed d7f7b713 wanted 28afece6)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0 ..
--3267--   .. CRC mismatch (computed e35294d4 wanted 2caddf91)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libgnutls.so.26.22.6
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libgcrypt.so.11.8.2
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0 ..
--3267--   .. CRC mismatch (computed d6b9b8d7 wanted b56e8fd2)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0 ..
--3267--   .. CRC mismatch (computed 6983274d wanted d2be6069)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0 ..
--3267--   .. CRC mismatch (computed 8852f8fc wanted b9f884df)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0 ..
--3267--   .. CRC mismatch (computed 6d50061f wanted 89db6712)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0 ..
--3267--   .. CRC mismatch (computed 9db4a0ee wanted 215492f5)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libtasn1.so.6.2.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libgpg-error.so.0.10.0
--3267--   Considering /lib/x86_64-linux-gnu/libgpg-error.so.0.10.0 ..
--3267--   .. CRC mismatch (computed fe28a920 wanted 24f96a1d)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0 ..
--3267--   .. CRC mismatch (computed b3dc6177 wanted 6ae7fe8e)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0 ..
--3267--   .. CRC mismatch (computed d4674ade wanted 47c60510)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
--3267--   Considering /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0 ..
--3267--   .. CRC mismatch (computed 2410d401 wanted 67df4c0a)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libcrypt-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libcrypt-2.19.so ..
--3267--   .. CRC mismatch (computed 9558285e wanted ec70842c)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libcrypt-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
--3267--   Considering /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1 ..
--3267--   .. CRC mismatch (computed cbfcaa4a wanted 2012f49a)
--3267--    object doesn't have a symbol table
--3267-- REDIR: 0x68e07e0 (strcasecmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68e2ad0 (strncasecmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68dffb0 (memcpy@GLIBC_2.2.5) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68dc960 (strncmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68df9e0 (bcmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68daaf0 (strcmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x695c4e0 (__memcpy_chk) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68e51b0 (memcpy@@GLIBC_2.14) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68de200 (strncpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68dbf80 (strcpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68da8a0 (index) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68dc920 (strncat) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68de8c0 (strspn) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68da6a0 (strcat) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x695c530 (__memmove_chk) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68de530 (strpbrk) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68df450 (strstr) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68e0630 (stpcpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
--3267-- REDIR: 0x68de240 (rindex) redirected to 0x4c2da30 (rindex)
--3267-- REDIR: 0x68dc540 (strlen) redirected to 0x4c2e0e0 (strlen)
--3267-- REDIR: 0x68d61d0 (malloc) redirected to 0x4c2ab10 (malloc)
--3267-- REDIR: 0x68e5200 (__GI_memcpy) redirected to 0x4c2fc90 (__GI_memcpy)
--3267-- REDIR: 0x68dab30 (__GI_strcmp) redirected to 0x4c2f200 (__GI_strcmp)
--3267-- REDIR: 0x68dbfc0 (__GI_strcpy) redirected to 0x4c2e2a0 (__GI_strcpy)
--3267-- REDIR: 0x68eb6a0 (__GI_strncpy) redirected to 0x4c2e4d0 (__GI_strncpy)
--3267-- REDIR: 0x68e7540 (strchrnul) redirected to 0x4c319b0 (strchrnul)
--3267-- REDIR: 0x688e800 (putenv) redirected to 0x4c32520 (putenv)
--3267-- REDIR: 0x68da8d0 (__GI_strchr) redirected to 0x4c2db90 (__GI_strchr)
--3267-- REDIR: 0x68dc700 (strnlen) redirected to 0x4c2e080 (strnlen)
--3267-- REDIR: 0x68dc9b0 (__GI_strncmp) redirected to 0x4c2e930 (__GI_strncmp)
--3267-- REDIR: 0x68d6970 (realloc) redirected to 0x4c2ce10 (realloc)
--3267-- REDIR: 0x68df690 (memchr) redirected to 0x4c2f390 (memchr)
--3267-- REDIR: 0x68d6870 (free) redirected to 0x4c2bd80 (free)
--3267-- REDIR: 0x68e0670 (__GI_stpcpy) redirected to 0x4c30da0 (__GI_stpcpy)
--3267-- REDIR: 0x688edb0 (unsetenv) redirected to 0x4c325c0 (unsetenv)
--3267-- REDIR: 0x68eb7a0 (__strcmp_sse2_unaligned) redirected to 0x4c2f1b0 (strcmp)
--3267-- REDIR: 0x68dee90 (__GI_strstr) redirected to 0x4c32030 (__strstr_sse2)
--3267-- REDIR: 0x68d6ca0 (calloc) redirected to 0x4c2cbf0 (calloc)
--3267-- Reading syms from /lib/x86_64-linux-gnu/libnss_compat-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libnss_compat-2.19.so ..
--3267--   .. CRC mismatch (computed f379a8ef wanted 04dce491)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libnss_compat-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /lib/x86_64-linux-gnu/libnsl-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libnsl-2.19.so ..
--3267--   .. CRC mismatch (computed ea6302f9 wanted daf19eb9)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libnsl-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /lib/x86_64-linux-gnu/libnss_nis-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libnss_nis-2.19.so ..
--3267--   .. CRC mismatch (computed 8cddb751 wanted d4c1aeab)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libnss_nis-2.19.so ..
--3267--   .. CRC is valid
--3267-- Reading syms from /lib/x86_64-linux-gnu/libnss_files-2.19.so
--3267--   Considering /lib/x86_64-linux-gnu/libnss_files-2.19.so ..
--3267--   .. CRC mismatch (computed 76d67c28 wanted 59ea999f)
--3267--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libnss_files-2.19.so ..
--3267--   .. CRC is valid
--3267-- REDIR: 0xffffffffff600400 (???) redirected to 0x3806831d (???)
--3267-- REDIR: 0x68e0040 (memset) redirected to 0x4c31350 (memset)
--3267-- REDIR: 0x695c780 (__strcpy_chk) redirected to 0x4c31a30 (__strcpy_chk)
--3267-- REDIR: 0x68eba50 (__memcpy_sse2_unaligned) redirected to 0x4c2f6b0 (memcpy@@GLIBC_2.14)
--3267-- REDIR: 0x68dfe20 (__GI_memmove) redirected to 0x4c31660 (__GI_memmove)
--3267-- REDIR: 0xffffffffff600000 (???) redirected to 0x38068313 (???)
--3267-- REDIR: 0x68e51f0 (__memcpy_chk_sse2) redirected to 0x4c31e90 (__memcpy_chk)
--3267-- REDIR: 0x68de8f0 (__GI_strspn) redirected to 0x4c32220 (strspn)
--3267-- REDIR: 0x68dfa20 (__GI_memcmp) redirected to 0x4c30b80 (__GI_memcmp)
==3267== Syscall param write(buf) points to uninitialised byte(s)
==3267==    at 0x693F2F0: __write_nocancel (syscall-template.S:81)
==3267==    by 0x68CCA82: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
==3267==    by 0x68CDF5B: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
==3267==    by 0x68CD120: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1332)
==3267==    by 0x68C28EC: fwrite (iofwrite.c:43)
==3267==    by 0x464664: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x46483F: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x467AFE: RelationCacheInitializePhase3 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FF44: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==  Address 0x40265fa is not stack'd, malloc'd or (recently) free'd
==3267==  Uninitialised value was created by a heap allocation
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x490E7F: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x491889: palloc0 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x45EBB5: InitCatCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x46A3CB: InitCatalogCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FA01: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
==3267== Syscall param write(buf) points to uninitialised byte(s)
==3267==    at 0x693F2F0: __write_nocancel (syscall-template.S:81)
==3267==    by 0x68CCA82: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
==3267==    by 0x68CDF5B: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
==3267==    by 0x68CD7DF: _IO_file_close_it@@GLIBC_2.2.5 (fileops.c:165)
==3267==    by 0x68C158F: fclose@@GLIBC_2.2.5 (iofclose.c:59)
==3267==    by 0x37DD40: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x4648C7: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x467AFE: RelationCacheInitializePhase3 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FF44: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==  Address 0x402606a is not stack'd, malloc'd or (recently) free'd
==3267==  Uninitialised value was created by a heap allocation
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x490E7F: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x491889: palloc0 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x45EBB5: InitCatCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x46A3CB: InitCatalogCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FA01: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
--3267-- Reading syms from /usr/lib/postgresql/9.3/lib/osrm-1.1.so
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /lib/x86_64-linux-gnu/libjson-c.so.2.0.0
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/libidn.so.11.6.11
--3267--   Considering /usr/lib/x86_64-linux-gnu/libidn.so.11.6.11 ..
--3267--   .. CRC mismatch (computed 0e88c96f wanted 634ebbd2)
--3267--    object doesn't have a symbol table
--3267-- Reading syms from /usr/lib/x86_64-linux-gnu/librtmp.so.0
--3267--    object doesn't have a symbol table
--3267-- REDIR: 0x68e7330 (rawmemchr) redirected to 0x4c319f0 (rawmemchr)
--3267-- REDIR: 0x68e2b30 (__strncasecmp_sse2) redirected to 0x4c2eb60 (strncasecmp)
--3267-- REDIR: 0x68e0840 (__strcasecmp_sse2) redirected to 0x4c2ea80 (strcasecmp)
--3267-- REDIR: 0x68e0850 (__GI___strcasecmp_l) redirected to 0x4c2ee20 (__GI___strcasecmp_l)
--3267-- Discarding syms at 0xaead3b0-0xaeb32fe in /lib/x86_64-linux-gnu/libnss_compat-2.19.so due to munmap()
--3267-- Discarding syms at 0xb2d21a0-0xb2d86da in /lib/x86_64-linux-gnu/libnss_nis-2.19.so due to munmap()
--3267-- Discarding syms at 0xb0ba160-0xb0c6ea3 in /lib/x86_64-linux-gnu/libnsl-2.19.so due to munmap()
--3267-- Discarding syms at 0xb4de2a0-0xb4e4f63 in /lib/x86_64-linux-gnu/libnss_files-2.19.so due to munmap()
==3267== 
==3267== HEAP SUMMARY:
==3267==     in use at exit: 1,410,411 bytes in 881 blocks
==3267==   total heap usage: 1,955 allocs, 1,074 frees, 4,163,813 bytes allocated
==3267== 
==3267== Searching for pointers to 881 not-freed blocks
==3267== Checked 2,761,904 bytes
==3267== 
==3267== 30 bytes in 1 blocks are definitely lost in loss record 38 of 147
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x68DC2B9: strdup (strdup.c:42)
==3267==    by 0x4A4150: set_pglocale_pgservice (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x1962E9: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
==3267== 36 bytes in 1 blocks are definitely lost in loss record 43 of 147
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x68DC2B9: strdup (strdup.c:42)
==3267==    by 0x4A4105: set_pglocale_pgservice (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x1962E9: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
==3267== 2,162 (168 direct, 1,994 indirect) bytes in 1 blocks are definitely lost in loss record 108 of 147
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x48E4D9: save_ps_display_args (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x1962D1: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
==3267== LEAK SUMMARY:
==3267==    definitely lost: 234 bytes in 3 blocks
==3267==    indirectly lost: 1,994 bytes in 20 blocks
==3267==      possibly lost: 0 bytes in 0 blocks
==3267==    still reachable: 1,408,183 bytes in 858 blocks
==3267==         suppressed: 0 bytes in 0 blocks
==3267== Reachable blocks (those to which a pointer was found) are not shown.
==3267== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3267== 
==3267== ERROR SUMMARY: 32 errors from 5 contexts (suppressed: 0 from 0)
==3267== 
==3267== 2 errors in context 1 of 5:
==3267== Syscall param write(buf) points to uninitialised byte(s)
==3267==    at 0x693F2F0: __write_nocancel (syscall-template.S:81)
==3267==    by 0x68CCA82: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
==3267==    by 0x68CDF5B: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
==3267==    by 0x68CD7DF: _IO_file_close_it@@GLIBC_2.2.5 (fileops.c:165)
==3267==    by 0x68C158F: fclose@@GLIBC_2.2.5 (iofclose.c:59)
==3267==    by 0x37DD40: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x4648C7: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x467AFE: RelationCacheInitializePhase3 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FF44: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==  Address 0x402606a is not stack'd, malloc'd or (recently) free'd
==3267==  Uninitialised value was created by a heap allocation
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x490E7F: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x491889: palloc0 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x45EBB5: InitCatCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x46A3CB: InitCatalogCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FA01: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
==3267== 
==3267== 27 errors in context 2 of 5:
==3267== Syscall param write(buf) points to uninitialised byte(s)
==3267==    at 0x693F2F0: __write_nocancel (syscall-template.S:81)
==3267==    by 0x68CCA82: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1261)
==3267==    by 0x68CDF5B: _IO_do_write@@GLIBC_2.2.5 (fileops.c:538)
==3267==    by 0x68CD120: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1332)
==3267==    by 0x68C28EC: fwrite (iofwrite.c:43)
==3267==    by 0x464664: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x46483F: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x467AFE: RelationCacheInitializePhase3 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FF44: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==  Address 0x40265fa is not stack'd, malloc'd or (recently) free'd
==3267==  Uninitialised value was created by a heap allocation
==3267==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3267==    by 0x490E7F: ??? (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x491889: palloc0 (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x45EBB5: InitCatCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x46A3CB: InitCatalogCache (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x47FA01: InitPostgres (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x39DDDB: PostgresMain (in /usr/lib/postgresql/9.3/bin/postgres)
==3267==    by 0x196478: main (in /usr/lib/postgresql/9.3/bin/postgres)
==3267== 
==3267== ERROR SUMMARY: 32 errors from 5 contexts (suppressed: 0 from 0)
woodbri commented 9 years ago

Thank you for running that and posting the results. Unfortunately, none of the errors reported are significant nor are they related to the osrm-tools code. And running this under valgrind did not crash. It is possible to attach the backend process to gdb and then run your query from another window and get a stack trace when it crashes see this page if your interested in getting the gdb backtrace and posting it. http://trac.osgeo.org/postgis/wiki/DevWikiGettingABackTrace

paulobraga commented 9 years ago

hello, I attached the pid of my database connection to the gdb and ran the crashed query.

In gdb window I got:


[New Thread 0x7f7bb1156700 (LWP 2329)]
[Thread 0x7f7bb1156700 (LWP 2329) exited]
Program received signal SIGSEGV, Segmentation fault.
osrm_locate (fcinfo=) at osrm.c:1268
1268        result = HeapTupleGetDatum( tuple );

Note: I didn't build postgres in debug mode as the link you put says. I will do it the post here. Is the information above helpful?

woodbri commented 9 years ago

It looks like you are not running under a recent version of the code. The line above in the current master is at line 1382. So you might try

git clone https://github.com/woodbri/osrm-tools.git
cd osrm-tools/postgresql
make
sudo make install

then in your database:

drop extension osrm;
create extension osrm;
select ....;

and see if you have better luck with that.

paulobraga commented 9 years ago

I did what you said and it's working now.

did you change anything in the code? the osrm extension I was using was from the repository cloned 2 months ago.

Thanks

woodbri commented 9 years ago

I had lots of changes that I had collect in my working directory. I obviously changed stuff, because the line numbering was way off. But I work on so many projects that I forget where I am sometimes. When I have time a check all the project dirs and push changes that I'm holding locally after do some quick sanity checks to be sure things are working. My guess is someone else reported an issue and while cleaning that up I fixed other related issues. Anyway thank you for your effort to report stuff and I'm glad you have something that works for you. Closing this ticket.