rinigus / osmscout-server

Maps server providing tiles, geocoder, and router
https://rinigus.github.io/osmscout-server
GNU General Public License v3.0
164 stars 28 forks source link

Crashes upon completing map download and then wont start #345

Closed joshbowyer closed 2 years ago

joshbowyer commented 3 years ago

I installed OSM Scout Server via Flatpak, and once a map download finishes the app crashes and wont start again. This is on Debian on armhf. The three messages I get when launching it from command line are:

Qt: Session management error: Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed

file:///usr/lib/qml/org/kde/kirigami.2/private/globaltoolbar/ToolBarPageHeader.qml:43:9: QML ActionToolBar: Binding loop detected for property "actions"

file:///usr/lib/qml/org/kde/kirigami.2/templates/SwipeListItem.qml:172:9: Unable to assign ElementLanguageSelector_QMLTYPE_146 to QQuickFlickable

If I delete Maps.OSM then it launches again, or even if I just delete the countries_requested.json (or countries_provided.json)

I also rsync'd my Maps.OSM dir from a working install, and it has the same issue.

rinigus commented 3 years ago

More data is needed. Try to get backtrace. See intro at https://www.figuiere.net/hub/blog/?2019/10/11/878-getting-a-stack-trace-out-of-a-flatpak

However, for me the following works to debug the server:

neophrema commented 3 years ago

I have actually exactly the same issues. Im on PostmarketOS, using the package provided by APK. I can subscribe and Download do Maps, im not sure, after the unpacking the server hangs. - As soon as I delete the Mapsfolder OSM-Scout-server starts again but, hey, without maps. Issues whichare shown in the Terminal, which I'm not sure about what it means:

$ osmscout-server
INFO: 21:41:13 Storage folder changed to /home/user/Maps.OSM
INFO: 21:41:13 Add country or feature to requested list: Address parsing language support
WARNING: 21:41:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 21:41:13 Missing data: Europe / Germany / Berlin (612,462,744)
INFO: 21:41:13 Missing data: Mapbox GL World overlay (20,762,624)
INFO: 21:41:13 Missing data: Mapbox GL fonts (75,730,947)
INFO: 21:41:13 Missing data: Mapnik World coastlines (746,707,956)
INFO: 21:41:13 Missing data: Address parsing language support (106,527,869)
INFO: 21:41:13 Add country or feature to requested list: Mapnik World coastlines
WARNING: 21:41:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 21:41:13 Missing data: Europe / Germany / Berlin (612,462,744)
INFO: 21:41:13 Missing data: Mapbox GL World overlay (20,762,624)
INFO: 21:41:13 Missing data: Mapbox GL fonts (75,730,947)
INFO: 21:41:13 Missing data: Mapnik World coastlines (746,707,956)
INFO: 21:41:13 Missing data: Address parsing language support (106,527,869)
INFO: 21:41:13 Add country or feature to requested list: Mapbox GL World overlay
WARNING: 21:41:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 21:41:14 Missing data: Europe / Germany / Berlin (612,462,744)
INFO: 21:41:14 Missing data: Mapbox GL World overlay (20,762,624)
INFO: 21:41:14 Missing data: Mapbox GL fonts (75,730,947)
INFO: 21:41:14 Missing data: Mapnik World coastlines (746,707,956)
INFO: 21:41:14 Missing data: Address parsing language support (106,527,869)
INFO: 21:41:14 Add country or feature to requested list: Mapbox GL fonts
WARNING: 21:41:14 No maps loaded: Missing Mapbox GL World overlay
INFO: 21:41:14 Missing data: Europe / Germany / Berlin (612,462,744)
INFO: 21:41:14 Missing data: Mapbox GL World overlay (20,762,624)
INFO: 21:41:14 Missing data: Mapbox GL fonts (75,730,947)
INFO: 21:41:14 Missing data: Mapnik World coastlines (746,707,956)
INFO: 21:41:14 Missing data: Address parsing language support (106,527,869)
INFO: 21:41:14 Available country or territory: Address parsing language support
INFO: 21:41:14 Available country or territory: Mapbox GL World overlay
INFO: 21:41:14 Available country or territory: Mapbox GL fonts
INFO: 21:41:14 Available country or territory: Mapnik World coastlines
INFO: 21:41:14 Available country or territory: Europe / Germany / Berlin
INFO: 21:41:14 Countries used in search: europe/germany/berlin 
Illegal instruction

So obviously something is missing;

Thanks, maybe this is a lead?

Edit1: If I disable Mapbox GL I end up with following error: WARNING: 22:05:19 No maps loaded: Missing Mapnik World coastlines

rinigus commented 3 years ago

The way the server loads its map databases leads top these "Missing" records. What counts are the messages in the end - "Available ...". Sorry for confusion, it was just easier to handle it that way.

I guess the same debug backtrace request holds here as well. Hard to figure out what is going on without any.

neophrema commented 3 years ago

I hope I found the requested log: gdb writes:

Starting program: /usr/bin/osmscout-server

Program received signal SIGILL, Illegal instruction.
0x0000fffff5abc4d0 in ?? ()
       from /lib/libcrypto.so.1.1

also is added:

#1 0x0000fffff7ffe000 in ?? ()
from /lib/ld-musl-aarch64.so1
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Does this conclude?
rinigus commented 3 years ago

must say that I don't know where is the issue coming from and that backtrace is not super-informative. Do you know whether it is a general issue on pmOS?

neophrema commented 3 years ago

What I did was starting gdb, typing

run osmscout-server

and thats the outcome.

If I start it regularily via Icon I see a spinning circle, "Initializing and waiting for connection with the server

  1. activate server via d-bus
  2. starting server
  3. server stopped"

Can I deliver something else? It might be related to alpine since they use a different crypto ++ musl; but I have only superficial knowledge on it. Any Idea where to look? I could install mobian and try if it works, then I would report to the postmarketos people.

rinigus commented 3 years ago

Don't know much about Alpine either. If you are in gbd, after crash, run bt.

dee-sea commented 3 years ago

Also on pmOS and having the same problem. Did you find a solution or can I help to investigate?

dee-sea commented 3 years ago

the backtrace in gdb gives:

0 0x0000fffff5abc4d0 in ?? () from /lib/libcrypto.so.1.1

1 0x0000fffff7ffe000 in ?? () from /lib/ld-musl-aarch64.so.1

rinigus commented 3 years ago

Not super-helpful, unfortunately. Could you check if other users have the same issue?

dee-sea commented 3 years ago

Unfortunately I' don't know other users. As that happens into libcrypto that has to have some links with openssl do you invovque open ssl somewhere in the code base? Is the communication between the client and the server ssl encrypted?

dee-sea commented 3 years ago

In the meantime I've recompiled osmscout and all the dependencies (valhala, mapbox and so on) from source and got the same result. That at least excludes some errors done by the packagers on the pmos side.

rinigus commented 3 years ago

https is used to download maps, but not for communication between server and a client (those are via http://localhost). So, you could try to see whether you can catch something in https://github.com/rinigus/osmscout-server/blob/master/server/src/filedownloader.cpp

As you have compiled yourself, maybe you could make a debug version as well? Then in gdb, try to get backtrace for all threads

dee-sea commented 3 years ago

Ho, and btw, I don't know if your aware of it but the header files of boost have changed and I had to change some files in the pkg-mapnik repo to have it to compile with boost 1.75. mostly changing includes of gil/gil_all.h to point gil.h.

Something like :

if BOOST_VERSION >= 106900

include <boost/gil.hpp>

else

include <boost/gil/gil_all.hpp>

endif

But I'm completely out of scope. Sorry

dee-sea commented 3 years ago

And downloading of files seems to work. I will try to help investigating further and I'll let you know if I find what's the point.

dee-sea commented 3 years ago

I've just installed the flatpak of osmscout-server and puremaps and it seems to work. At least it dont crash. but I did not fins how to download the maps with it???

rinigus commented 3 years ago

Hmm, maps download should be the same way as on other install of osm scout server. How did you download before?

RapidRotator commented 2 years ago

At the request of @rinigus: omscout-server on Pinephone does not fail when it was installed used flatpak.

craftyguy commented 2 years ago

The SIGILL in libcrypto can be ignored, that's from a runtime test in openssl (see the FAQ here: https://www.openssl.org/docs/faq.html#PROG)

craftyguy commented 2 years ago

osmscout does crash for me with a SIGILL from kyotocabinet...

(gdb) r
Starting program: /usr/bin/osmscout-server

Program received signal SIGILL, Illegal instruction.
0x0000fffff5a63530 in ?? () from /lib/libcrypto.so.1.1
(gdb) c
Continuing.
[New LWP 26597]
[New LWP 26598]
[Detaching after fork from child process 26603]
INFO: 23:21:13 Storage folder changed to /home/clayton/Maps.OSM
INFO: 23:21:13 Add country or feature to requested list: Address parsing language support
WARNING: 23:21:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 23:21:13 Missing data: Mapbox GL World overlay (20,873,216)
INFO: 23:21:13 Missing data: Mapbox GL fonts (75,730,947)
INFO: 23:21:13 Missing data: North America / US / Oregon (781,883,936)
INFO: 23:21:13 Missing data: North America / US / Washington (916,538,551)
INFO: 23:21:13 Missing data: Address parsing language support (106,527,869)
WARNING: 23:21:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 23:21:13 Missing data: Mapbox GL World overlay (20,873,216)
INFO: 23:21:13 Missing data: Mapbox GL fonts (75,730,947)
INFO: 23:21:13 Missing data: North America / US / Oregon (781,883,936)
INFO: 23:21:13 Missing data: North America / US / Washington (916,538,551)
INFO: 23:21:13 Missing data: Address parsing language support (106,527,869)
INFO: 23:21:13 Add country or feature to requested list: Mapbox GL World overlay
WARNING: 23:21:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 23:21:13 Missing data: Mapbox GL World overlay (20,873,216)
INFO: 23:21:13 Missing data: Mapbox GL fonts (75,730,947)
INFO: 23:21:13 Missing data: North America / US / Oregon (781,883,936)
INFO: 23:21:13 Missing data: North America / US / Washington (916,538,551)
INFO: 23:21:13 Missing data: Address parsing language support (106,527,869)
INFO: 23:21:13 Add country or feature to requested list: Mapbox GL fonts
WARNING: 23:21:13 No maps loaded: Missing Mapbox GL World overlay
INFO: 23:21:13 Missing data: Mapbox GL World overlay (20,873,216)
INFO: 23:21:13 Missing data: Mapbox GL fonts (75,730,947)
INFO: 23:21:13 Missing data: North America / US / Oregon (781,883,936)
INFO: 23:21:13 Missing data: North America / US / Washington (916,538,551)
INFO: 23:21:13 Missing data: Address parsing language support (106,527,869)
WARNING: 23:21:14 Missing dataset for North America / US / Washington: Missing geocoder-nlp dataset
WARNING: 23:21:14 Missing dataset for North America / US / Washington: Missing country-specific Mapbox GL dataset
WARNING: 23:21:14 Missing dataset for North America / US / Washington: Missing Valhalla tiles
INFO: 23:21:14 Available country or territory: Address parsing language support
INFO: 23:21:14 Available country or territory: Mapbox GL World overlay
INFO: 23:21:14 Available country or territory: Mapbox GL fonts
INFO: 23:21:14 Available country or territory: North America / US / Oregon
INFO: 23:21:14 Countries used in search: north-america/us/oregon

Thread 1 "osmscout-server" received signal SIGILL, Illegal instruction.
0x0000fffff754dd40 in kyotocabinet::AtomicInt64::set(long) () from /usr/lib/libkyotocabinet.so.16
(gdb) bt
#0  0x0000fffff754dd40 in kyotocabinet::AtomicInt64::set(long) () from /usr/lib/libkyotocabinet.so.16
#1  0x0000aaaaaaae4d94 in kyotocabinet::HashDB::load_meta() ()
#2  0x0000aaaaaaaed3d0 in kyotocabinet::HashDB::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) ()
#3  0x0000aaaaaab1bf00 in ?? ()
#4  0x0000aaaaaaadfbf8 in ?? ()
#5  0x0000aaaaaaacce78 in ?? ()
#6  0x0000fffff65716bc in void doActivate<false>(QObject*, int, void**) () from /usr/lib/libQt5Core.so.5
#7  0x0000aaaaaab22f04 in ?? ()
#8  0x0000aaaaaaaf81ac in ?? ()
#9  0x0000aaaaaaafb148 in ?? ()
#10 0x0000aaaaaaac850c in ?? ()
#11 0x0000fffff7f731c0 in libc_start_main_stage2 (main=0xaaaaaaac73d4, argc=1, argv=0xfffffffff718) at src/env/__libc_start_main.c:94
#12 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

I don't have symbols for kyotocabinet or osmscout server, so that backtrace probably isn't super useful... it'll be a few days before I am able to collect that.

I can reproduce this every time I try to download the maps @ north-america/us/oregon, on pmOS.

rinigus commented 2 years ago

I have just tried on PC and cannot reproduce the crash with north-america/us/oregon . All I can suggest is to try to remove the current maps and download them again.

craftyguy commented 2 years ago

All I can suggest is to try to remove the current maps and download them again.

@rinigus ya that's how I reproduced it :)

Ok, seems like I should try to get symbols for kyotocabinet, etc and see if I can get anything more useful out of gdb.

rinigus commented 2 years ago

@craftyguy: did you manage to reproduce it on PC?

craftyguy commented 2 years ago

@rinigus sorry it too me a while, but I tried reproducing this on an x86_64 system also running Alpine Linux, and it seems like I'm not able to reproduce it there... But it's very reproducible on my aarch64 system...

tl;dr: kyotocabinet is being compiled with an unsupported instruction (which is what sigill is telling us, heh) for my aarch64 processor. that project needs to be built with ./configure --disable-opt

│  > 0xfffff754dd40 <_ZN12kyotocabinet11AtomicInt643setEl>           swpa    x1, x0, [x0]                                                                                                                                                                                                                                                                                   │
│    0xfffff754dd44 <_ZN12kyotocabinet11AtomicInt643setEl+4>         dmb     ish                                                                                                                                                                                                                                                                                            │                                                                                                                                                                                                                                                           │........
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
native LWP 22962 In: kyotocabinet::AtomicInt64::set                                                                                                                                                                                                                                                                                                 
(gdb) bt
#0  0x0000fffff754dd40 in kyotocabinet::AtomicInt64::set(long) () from /usr/lib/libkyotocabinet.so.16
....
(gdb) disas 0xfffff754dd40

swpa was added for ARMv8.1 and later, the imx8 and Allwinner A64 Cortex-A53 CPUs are ARMv8, according to wikipedia, which suggests swpa is not supported on those CPUs.

It looks like kyotocabinet enables -march=native by default in its configure script, so my guess is that the Alpine Linux aarch64 builders are >= ARMv8.1, causing swpa to be used. Luckily the project has a --disable-opt flag that removes the -march=native usage. I submitted a patch to Alpine to use this option, which should (hopefully) fix the issue there: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/33353

For other distros, they'll need to use that option when building kyotocabinet if the aarch64 builders have a newer ISA than target CPUs (like the cortex-A53...)

thanks @mattst88 for helping me navigate gdb :D

rinigus commented 2 years ago

I wonder whether we can close the issue over here and let distributions to handle it correctly.

PureTryOut commented 2 years ago

It's not a bug in osmscout-server so I'd say it can be closed. At least on Alpine Linux/postmarketOS the issue is fixed now.