Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.45k stars 3.42k forks source link

Segmentation error at "Loading names index" #586

Closed thomersch closed 11 years ago

thomersch commented 11 years ago

Running debian updated to wheezy, all packages are up-to-date. 3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux

My installed libraries

ii  libboost-date-time1.49-dev         1.49.0-3.2                amd64        set of date-time libraries based on generic programming concepts
ii  libboost-date-time1.49.0           1.49.0-3.2                amd64        set of date-time libraries based on generic programming concepts
ii  libboost-dev                       1.49.0.1                  amd64        Boost C++ Libraries development files (default version)
ii  libboost-filesystem-dev            1.49.0.1                  amd64        filesystem operations (portable paths, iteration over directories, etc) in C++ (default version)
ii  libboost-filesystem1.49-dev        1.49.0-3.2                amd64        filesystem operations (portable paths, iteration over directories, etc) in C++
ii  libboost-filesystem1.49.0          1.49.0-3.2                amd64        filesystem operations (portable paths, iteration over directories, etc) in C++
ii  libboost-iostreams1.42.0           1.42.0-4                  amd64        Boost.Iostreams Library
ii  libboost-iostreams1.49.0           1.49.0-3.2                amd64        Boost.Iostreams Library
ii  libboost-python-dev                1.49.0.1                  amd64        Boost.Python Library development files (default version)
ii  libboost-python1.49-dev            1.49.0-3.2                amd64        Boost.Python Library development files
ii  libboost-python1.49.0              1.49.0-3.2                amd64        Boost.Python Library
ii  libboost-regex-dev                 1.49.0.1                  amd64        regular expression library for C++ (default version)
ii  libboost-regex1.49-dev             1.49.0-3.2                amd64        regular expression library for C++
ii  libboost-regex1.49.0               1.49.0-3.2                amd64        regular expression library for C++
ii  libboost-serialization1.49-dev     1.49.0-3.2                amd64        serialization library for C++
ii  libboost-serialization1.49.0       1.49.0-3.2                amd64        serialization library for C++
ii  libboost-system-dev                1.49.0.1                  amd64        Operating system (e.g. diagnostics support) library (default version)
ii  libboost-system1.49-dev            1.49.0-3.2                amd64        Operating system (e.g. diagnostics support) library
ii  libboost-system1.49.0              1.49.0-3.2                amd64        Operating system (e.g. diagnostics support) library
ii  libboost-thread-dev                1.49.0.1                  amd64        portable C++ multi-threading (default version)
ii  libboost-thread1.49-dev            1.49.0-3.2                amd64        portable C++ multi-threading
ii  libboost-thread1.49.0              1.49.0-3.2                amd64        portable C++ multi-threading
ii  libboost1.49-dev                   1.49.0-3.2                amd64        Boost C++ Libraries development files

After extracting and preparing the osm files I am trying to run osrm-routed. This fails at "Loading names index".

./osrm-routed

[server] starting up engines, saved at Fri Feb  8 17:25:42 2013
[server] http 1.1 compression handled by zlib version 1.2.7
[info Server/DataStructures/QueryObjectsStorage.cpp:26] loading graph data
[info Server/DataStructures/QueryObjectsStorage.cpp:34] Data checksum is 2465382090
. 10% . 20% . 30% . 40% . 50% . 60% . 70% . 80% . 90% . 100%
[info Server/DataStructures/QueryObjectsStorage.cpp:40] Loading Timestamp
[info Server/DataStructures/QueryObjectsStorage.cpp:52] Loading auxiliary information
[debug Server/DataStructures/../../DataStructures/NodeInformationHelpDesk.h:50] Loading node data
[debug Server/DataStructures/../../DataStructures/NodeInformationHelpDesk.h:59] Loading edge data
[debug Server/DataStructures/../../DataStructures/NodeInformationHelpDesk.h:65] Loaded 2643594 orig edges
[debug Server/DataStructures/../../DataStructures/NodeInformationHelpDesk.h:66] Opening NN indices
[info Server/DataStructures/QueryObjectsStorage.cpp:62] Loading names index
Segmentation fault

After that, I ran a stack trace and got the following:

write(1, "[info Server/DataStructures/Quer"..., 76[info Server/DataStructures/QueryObjectsStorage.cpp:62] Loading names index
) = 76
open("/home/osrm/planetfiles/sachsen.osrm.restrictions", O_RDONLY) = 8
read(8, "\24\10\0\0\30\217\306\17\256\7\305\17\361\377]\22\0\177\0\0\317\200\327\5\32TD\32\24TD\32"..., 8191) = 8191
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

I have the correct permissions set to /planetfiles/ and for sachsen.osrm.restrictions as well. At this point I have no idea what is causing the problem in there.

DennisOSRM commented 11 years ago

What does your server.ini look like?

DennisOSRM commented 11 years ago

namesData=/home/osrm/planetfiles/sachsen.osrm.restrictions

should be

namesData=/home/osrm/planetfiles/sachsen.osrm.names

emiltin commented 11 years ago

osrm could perhaps check the extension of the files it loads

thomersch commented 11 years ago

Damn - the second I posted the last comment I realized that I chose the wrong server.ini. The correct one is of course

Threads = 1
IP = 0.0.0.0
Port = 5111

hsgrData=/home/osrm/planetfiles/sachsen.osrm.hsgr
nodesData=/home/osrm/planetfiles/sachsen.osrm.nodes
edgesData=/home/osrm/planetfiles/sachsen.osrm.edges
ramIndex=/home/osrm/planetfiles/sachsen.osrm.ramIndex
fileIndex=/home/osrm/planetfiles/sachsen.osrm.fileIndex
namesData=/home/osrm/planetfiles/sachsen.osrm.names

And the error I meant happens here:

[info Server/DataStructures/QueryObjectsStorage.cpp:62] Loading names index
[info Server/DataStructures/QueryObjectsStorage.cpp:80] All query data structures loaded
[handler] registering plugin hello
[handler] registering plugin locate
[handler] registering plugin nearest
[handler] registering plugin timestamp
[handler] registering plugin viaroute
[server] running and waiting for requests

Stacktrace

mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fd938646000
mprotect(0x7fd938646000, 4096, PROT_NONE) = 0
clone(child_stack=0x7fd938e45f70, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7fd938e469d0, tls=0x7fd938e46700, child_tidptr=0x7fd938e469d0) = 26106
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT QUIT TERM], NULL, 8) = 0
write(1, "[server] running and waiting for"..., 42[server] running and waiting for requests
) = 42
rt_sigtimedwait([INT QUIT TERM], NULL, NULL, 8 <unfinished ...>
+++ killed by SIGSEGV +++
DennisOSRM commented 11 years ago

I have a bunch of questions:

thomersch commented 11 years ago
DennisOSRM commented 11 years ago

Checkout the latest source from the develop branch and retry with that.

thomersch commented 11 years ago

I deleted all the files, pulled the "develop" branch, extracted and prepared the files, customized the server.ini and at least it fails at a different step

./osrm-routed

[server] starting up engines, saved at Tue Feb 12 20:01:56 2013
[server] http 1.1 compression handled by zlib version 1.2.7
[info Server/DataStructures/QueryObjectsStorage.cpp:26] loading graph data
[info Server/DataStructures/QueryObjectsStorage.cpp:34] Data checksum is 3347887039
[info Server/DataStructures/QueryObjectsStorage.cpp:52] Loading auxiliary information
[info Server/DataStructures/QueryObjectsStorage.cpp:62] Loading names index
[info Server/DataStructures/QueryObjectsStorage.cpp:80] All query data structures loaded
[handler] registering plugin hello
[handler] registering plugin locate
[handler] registering plugin nearest
[handler] registering plugin timestamp
[handler] registering plugin viaroute
Segmentation fault

Or with stacktrace

close(7)                                = 0
close(8)                                = 0
write(1, "[info Server/DataStructures/Quer"..., 89[info Server/DataStructures/QueryObjectsStorage.cpp:80] All query data structures loaded
) = 89
write(1, "[handler] registering plugin hel"..., 35[handler] registering plugin hello
) = 35
write(1, "[handler] registering plugin loc"..., 36[handler] registering plugin locate
) = 36
write(1, "[handler] registering plugin nea"..., 37[handler] registering plugin nearest
) = 37
write(1, "[handler] registering plugin tim"..., 39[handler] registering plugin timestamp
) = 39
write(1, "[handler] registering plugin via"..., 38[handler] registering plugin viaroute
) = 38
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault
thomersch commented 11 years ago

Can I provide you any further information or shall I try something else in order to get this thing running? Thanks in forward.

DennisOSRM commented 11 years ago

Not sure what the issue actually is as multiple systems just run fine here. Could you rebuild in debug mode with

scons --build=debug and run it in GDB. It shall provide you with a stack trace.

emiltin commented 11 years ago

you could also try running the cuke tests

thomersch commented 11 years ago

I have managed to solve the problem :) @DennisOSRM @emiltin thanks a lot for your assistance, it was very kind of you to help me.

For all who also encounter such problems as well: I had some mismatch with the libboost-libraries. I removed them via apt-get and perfomed a rm /usr/lib/libboost* Caution - if you break dependencies, some software may not run anymore!

After this I reinstalled all the libboost libraries as instructed in the installation manual. And boom, it worked.

For future development maybe you should consider checking the versions of loaded libraries. On some systems there are old files lying around in /usr/lib and some improper symlinks (which might happen on distribution upgrades etc.) which break OSRM without giving very useful error messages.

DennisOSRM commented 11 years ago

Thanks for the update.