comaps/comaps
42
1.9k
Fork
You've already forked comaps
161

Traffic: crashes while routing #2937

Closed
opened 2025年12月20日 18:51:56 +01:00 by mvglasow · 16 comments

I am getting sporadic crashes while routing, seemingly out of the blue.

No logcat yet, as these crashes always happened when I was busy driving.

I have not yet managed to reproduce them on an official build to rule out traffic features as the cause.

Tested on Android (LineageOS 20) with 426a9661 (traffic with d473361e5 merged).

Device is a Fairphone 4, which has a known bug where phantom touch events occur. Asides from Traffic, this is another possible cause of the bug (the thunderstorm of touch events which occasionally rains down on the screen and triggers random functions might upset the graphics engine or other components).

I am getting sporadic crashes while routing, seemingly out of the blue. No logcat yet, as these crashes always happened when I was busy driving. I have not yet managed to reproduce them on an official build to rule out traffic features as the cause. Tested on Android (LineageOS 20) with 426a9661 (traffic with d473361e5 merged). Device is a Fairphone 4, which has a known bug where phantom touch events occur. Asides from Traffic, this is another possible cause of the bug (the thunderstorm of touch events which occasionally rains down on the screen and triggers random functions might upset the graphics engine or other components).

IIRC you can just leave logging on indefinitely. I'm not sure if it prunes old logs or what but I'll tend to leave it on and it seems fine

IIRC you can just leave logging on indefinitely. I'm not sure if it prunes old logs or what but I'll tend to leave it on and it seems fine

Where do you download this traffic version?? I want to test here :)

Where do you download this traffic version?? I want to test here :)
Contributor
Copy link

Feature is not yet available, be patient 😉

Feature is not yet available, be patient 😉
Author
Member
Copy link

Yep, the log gets written to Android/data/app.comaps.*/files/logs/app.log. However, it gets cleared on app restart, which is a bummer if either the app restarts by itself, or if you restart it manually before copying away the log. If the app crashes while on the road, your options are to either go without navigation until you can pull over, make a backup of the log and only then restart the app, or restart the app instantly and lose all log information.

Because of that, I no longer have a log of the crash, I need to wait for another crash.

Also, the interesting question is how much gets logged in case of a crash – if the app gets killed before it manages to write its last log entries, that would be a bummer.

I noticed two things: no crashes in the official build, only the traffic branch is affected. Also, crashes seem to occur more frequently when using Qz with a TMC receiver – I suspect that is because messages arrive continuously, and information is more dynamic: locations change as queues grow or shrink, or the vehicle moves to a different reception area where it receives entirely new messages. The traffic server is somewhat more static in that respect. All of this points to the crash being somehow related to traffic, specifically message decoding or route recalculation.

Yep, the log gets written to `Android/data/app.comaps.*/files/logs/app.log`. However, it gets cleared on app restart, which is a bummer if either the app restarts by itself, or if you restart it manually before copying away the log. If the app crashes while on the road, your options are to either go without navigation until you can pull over, make a backup of the log and only then restart the app, or restart the app instantly and lose all log information. Because of that, I no longer have a log of the crash, I need to wait for another crash. Also, the interesting question is how much gets logged in case of a crash – if the app gets killed before it manages to write its last log entries, that would be a bummer. I noticed two things: no crashes in the official build, only the traffic branch is affected. Also, crashes seem to occur more frequently when using Qz with a TMC receiver – I suspect that is because messages arrive continuously, and information is more dynamic: locations change as queues grow or shrink, or the vehicle moves to a different reception area where it receives entirely new messages. The traffic server is somewhat more static in that respect. All of this points to the crash being somehow related to traffic, specifically message decoding or route recalculation.
Author
Member
Copy link

Just had a crash in the desktop version which might be related, though I’m not 100% sure. I had calculated a long route, and traffic was still decoding. Log output here:

I(2) 1888.35669 map/traffic_manager.cpp:723 DecodeFirstMessage(): de.viznrw.traffic:r:LMS-BY/r_LMS-BY/1264375_D BY LMS-BY.1 : TraffMessage { id: de.viznrw.traffic:r:LMS-BY/r_LMS-BY/1264375_D BY LMS-BY.1, replaces: [ ], receiveTime: 2026年01月06日 05:03:44 UTC, updateTime: 2026年01月11日 06:13:40 UTC, expirationTime: 2026年01月11日 06:15:38 UTC, startTime: nullopt, endTime: nullopt, cancellation: 1, forecast: 0, location: nullopt, events: [ ] }
I(2) 1888.35755 map/traffic_manager.cpp:830 WaitForRequest(): feed queue not empty, returning immediately
I(2) 1888.35760 map/traffic_manager.cpp:781 ThreadRoutine(): active MWMs changed: 0 , poll needed: 0
I(2) 1888.35763 map/traffic_manager.cpp:797 ThreadRoutine(): 1 feed(s) in queue
I(2) 1888.39312 map/traffic_manager.cpp:718 DecodeFirstMessage(): message cz.rsd.commonti:s:294cfc48-c250-4451-b1e5-1190da242856 is already in cache, skipping
I(2) 1888.39318 map/traffic_manager.cpp:830 WaitForRequest(): feed queue not empty, returning immediately
I(2) 1888.39322 map/traffic_manager.cpp:781 ThreadRoutine(): active MWMs changed: 0 , poll needed: 0
I(2) 1888.39324 map/traffic_manager.cpp:797 ThreadRoutine(): 1 feed(s) in queue
I(1) 1888.42860 map/traffic_manager.cpp:213 OnChangeRoutingSessionState(): Routing session state changed from RouteRebuilding to RouteNotStarted
I(1) 1888.42865 map/traffic_manager.cpp:214 OnChangeRoutingSessionState(): Running on thread 136539091856576
I(1) 1888.42874 map/traffic_manager.cpp:248 OnChangeRoutingSessionState(): Router MWMs: [17: Austria_Salzburg Austria_Tyrol Austria_Upper Austria_Linz Austria_Upper Austria_Wels Czech_Jihovychod_Kraj Vysocina Czech_Jihozapad_Jihocesky kraj Czech_Severovychod_Kralovehradecky kraj Czech_Severovychod_Pardubicky kraj Germany_Free State of Bavaria_Upper Bavaria_East Lithuania_East Lithuania_West Poland_Greater Poland Voivodeship Poland_Lodz Voivodeship Poland_Lower Silesian Voivodeship Poland_Masovian Voivodeship Poland_Podlaskie Voivodeship Poland_Warmian-Masurian Voivodeship ]
Segmentation fault (core dumped)
Just had a crash in the desktop version which might be related, though I’m not 100% sure. I had calculated a long route, and traffic was still decoding. Log output here: ``` I(2) 1888.35669 map/traffic_manager.cpp:723 DecodeFirstMessage(): de.viznrw.traffic:r:LMS-BY/r_LMS-BY/1264375_D BY LMS-BY.1 : TraffMessage { id: de.viznrw.traffic:r:LMS-BY/r_LMS-BY/1264375_D BY LMS-BY.1, replaces: [ ], receiveTime: 2026年01月06日 05:03:44 UTC, updateTime: 2026年01月11日 06:13:40 UTC, expirationTime: 2026年01月11日 06:15:38 UTC, startTime: nullopt, endTime: nullopt, cancellation: 1, forecast: 0, location: nullopt, events: [ ] } I(2) 1888.35755 map/traffic_manager.cpp:830 WaitForRequest(): feed queue not empty, returning immediately I(2) 1888.35760 map/traffic_manager.cpp:781 ThreadRoutine(): active MWMs changed: 0 , poll needed: 0 I(2) 1888.35763 map/traffic_manager.cpp:797 ThreadRoutine(): 1 feed(s) in queue I(2) 1888.39312 map/traffic_manager.cpp:718 DecodeFirstMessage(): message cz.rsd.commonti:s:294cfc48-c250-4451-b1e5-1190da242856 is already in cache, skipping I(2) 1888.39318 map/traffic_manager.cpp:830 WaitForRequest(): feed queue not empty, returning immediately I(2) 1888.39322 map/traffic_manager.cpp:781 ThreadRoutine(): active MWMs changed: 0 , poll needed: 0 I(2) 1888.39324 map/traffic_manager.cpp:797 ThreadRoutine(): 1 feed(s) in queue I(1) 1888.42860 map/traffic_manager.cpp:213 OnChangeRoutingSessionState(): Routing session state changed from RouteRebuilding to RouteNotStarted I(1) 1888.42865 map/traffic_manager.cpp:214 OnChangeRoutingSessionState(): Running on thread 136539091856576 I(1) 1888.42874 map/traffic_manager.cpp:248 OnChangeRoutingSessionState(): Router MWMs: [17: Austria_Salzburg Austria_Tyrol Austria_Upper Austria_Linz Austria_Upper Austria_Wels Czech_Jihovychod_Kraj Vysocina Czech_Jihozapad_Jihocesky kraj Czech_Severovychod_Kralovehradecky kraj Czech_Severovychod_Pardubicky kraj Germany_Free State of Bavaria_Upper Bavaria_East Lithuania_East Lithuania_West Poland_Greater Poland Voivodeship Poland_Lodz Voivodeship Poland_Lower Silesian Voivodeship Poland_Masovian Voivodeship Poland_Podlaskie Voivodeship Poland_Warmian-Masurian Voivodeship ] Segmentation fault (core dumped) ```
Author
Member
Copy link

And another one:

I(2) 5278.12447 map/traffic_manager.cpp:723 DecodeFirstMessage(): lt.eismoinfo.trafficintensity:1885,p : TraffMessage { id: lt.eismoinfo.trafficintensity:1885,p, replaces: [ ], receiveTime: 2026年01月02日 00:00:00 UTC, updateTime: 2026年01月11日 15:00:00 UTC, expirationTime: 2026年01月11日 15:32:00 UTC, startTime: nullopt, endTime: nullopt, cancellation: 0, forecast: 0, location: TraffLocation { from: Point { coordinates: ms::LatLon(55.223522, 24.863277), distance: nullopt, junctionName: nullopt, junctionRef: nullopt }, at: nullopt, via: nullopt, to: Point { coordinates: ms::LatLon(55.224251, 24.847614), distance: 6.760000, junctionName: Paprėniškiai, junctionRef: nullopt }, notVia: nullopt, fuzziness: nullopt, country: LT, territory: nullopt, town: nullopt, roadClass: Primary, roadRef: 115, roadName: nullopt, origin: Molėtai, destination: Ukmergė, direction: nullopt, directionality: OneDirection, ramps: None }, events: [ TraffEvent { class: Congestion, type: CongestionNormalTraffic, length: nullopt, probability: nullopt, q_duration: nullopt, speed: 87 } ] }
I(2) 5278.12915 traffxml/traff_decoder.cpp:257 DecodeMessage(): Impact: optional(TrafficImpact { speedGroup: G5, maxspeed: 87, delayMins: 0 })
I(2) 5278.12939 traffxml/traff_decoder.cpp:1107 DecodeLocationDirection(): Calculating the route of direct length 997.782 m. checkpoints: Checkpoints(ms::LatLon(55.223522, 24.863277); ms::LatLon(55.224251, 24.847614); passed: 0) startDirection: m2::Point<d>(0, 0) router name: astar-bidirectional-Car
I(2) 5278.13102 routing/index_router.cpp:1106 MakeWorldGraph(): Avoid next roads: RoutingOptions: {}
I(8) 5279.07172 routing/async_router.cpp:215 LogCode(): Route found, elapsed seconds: 134.564
I(8) 5279.07180 routing/async_router.cpp:323 CalculateRoute(): ETA: 60613.8 sec.
I(1) 5279.09004 map/traffic_manager.cpp:213 OnChangeRoutingSessionState(): Routing session state changed from RouteRebuilding to RouteNotStarted
I(1) 5279.09012 map/traffic_manager.cpp:214 OnChangeRoutingSessionState(): Running on thread 129651287710912
I(1) 5279.09019 map/traffic_manager.cpp:248 OnChangeRoutingSessionState(): Router MWMs: [17: Austria_Salzburg Austria_Tyrol Austria_Upper Austria_Linz Austria_Upper Austria_Wels Czech_Jihovychod_Kraj Vysocina Czech_Jihozapad_Jihocesky kraj Czech_Severovychod_Kralovehradecky kraj Czech_Severovychod_Pardubicky kraj Germany_Free State of Bavaria_Upper Bavaria_East Lithuania_East Lithuania_West Poland_Greater Poland Voivodeship Poland_Lodz Voivodeship Poland_Lower Silesian Voivodeship Poland_Masovian Voivodeship Poland_Podlaskie Voivodeship Poland_Warmian-Masurian Voivodeship ]
I(1) 5279.09028 map/traffic_manager.cpp:258 OnChangeRoutingSessionState(): MWM set: [17: MwmId [Austria_Upper Austria_Linz, 250804] MwmId [Czech_Jihovychod_Kraj Vysocina, 250804] MwmId [Austria_Salzburg, 250804] MwmId [Poland_Podlaskie Voivodeship, 250804] MwmId [Poland_Masovian Voivodeship, 250804] MwmId [Czech_Severovychod_Pardubicky kraj, 250804] MwmId [Austria_Tyrol, 250804] MwmId [Poland_Lodz Voivodeship, 250804] MwmId [Poland_Lower Silesian Voivodeship, 250804] MwmId [Lithuania_West, 250804] MwmId [Poland_Greater Poland Voivodeship, 250804] MwmId [Germany_Free State of Bavaria_Upper Bavaria_East, 250804] MwmId [Czech_Severovychod_Kralovehradecky kraj, 250804] MwmId [Lithuania_East, 250804] MwmId [Poland_Warmian-Masurian Voivodeship, 250804] MwmId [Czech_Jihozapad_Jihocesky kraj, 250804] MwmId [Austria_Upper Austria_Wels, 250804] ]
Segmentation fault (core dumped)

So the crash likely happens during OnChangeRoutingSessionState(). In the first case, it got to at least to line 248; in the second case it ran beyond line 248 up to at least line 258. We might be looking at a race condition involving unsynchronized access to the same data here.

And another one: ``` I(2) 5278.12447 map/traffic_manager.cpp:723 DecodeFirstMessage(): lt.eismoinfo.trafficintensity:1885,p : TraffMessage { id: lt.eismoinfo.trafficintensity:1885,p, replaces: [ ], receiveTime: 2026年01月02日 00:00:00 UTC, updateTime: 2026年01月11日 15:00:00 UTC, expirationTime: 2026年01月11日 15:32:00 UTC, startTime: nullopt, endTime: nullopt, cancellation: 0, forecast: 0, location: TraffLocation { from: Point { coordinates: ms::LatLon(55.223522, 24.863277), distance: nullopt, junctionName: nullopt, junctionRef: nullopt }, at: nullopt, via: nullopt, to: Point { coordinates: ms::LatLon(55.224251, 24.847614), distance: 6.760000, junctionName: Paprėniškiai, junctionRef: nullopt }, notVia: nullopt, fuzziness: nullopt, country: LT, territory: nullopt, town: nullopt, roadClass: Primary, roadRef: 115, roadName: nullopt, origin: Molėtai, destination: Ukmergė, direction: nullopt, directionality: OneDirection, ramps: None }, events: [ TraffEvent { class: Congestion, type: CongestionNormalTraffic, length: nullopt, probability: nullopt, q_duration: nullopt, speed: 87 } ] } I(2) 5278.12915 traffxml/traff_decoder.cpp:257 DecodeMessage(): Impact: optional(TrafficImpact { speedGroup: G5, maxspeed: 87, delayMins: 0 }) I(2) 5278.12939 traffxml/traff_decoder.cpp:1107 DecodeLocationDirection(): Calculating the route of direct length 997.782 m. checkpoints: Checkpoints(ms::LatLon(55.223522, 24.863277); ms::LatLon(55.224251, 24.847614); passed: 0) startDirection: m2::Point<d>(0, 0) router name: astar-bidirectional-Car I(2) 5278.13102 routing/index_router.cpp:1106 MakeWorldGraph(): Avoid next roads: RoutingOptions: {} I(8) 5279.07172 routing/async_router.cpp:215 LogCode(): Route found, elapsed seconds: 134.564 I(8) 5279.07180 routing/async_router.cpp:323 CalculateRoute(): ETA: 60613.8 sec. I(1) 5279.09004 map/traffic_manager.cpp:213 OnChangeRoutingSessionState(): Routing session state changed from RouteRebuilding to RouteNotStarted I(1) 5279.09012 map/traffic_manager.cpp:214 OnChangeRoutingSessionState(): Running on thread 129651287710912 I(1) 5279.09019 map/traffic_manager.cpp:248 OnChangeRoutingSessionState(): Router MWMs: [17: Austria_Salzburg Austria_Tyrol Austria_Upper Austria_Linz Austria_Upper Austria_Wels Czech_Jihovychod_Kraj Vysocina Czech_Jihozapad_Jihocesky kraj Czech_Severovychod_Kralovehradecky kraj Czech_Severovychod_Pardubicky kraj Germany_Free State of Bavaria_Upper Bavaria_East Lithuania_East Lithuania_West Poland_Greater Poland Voivodeship Poland_Lodz Voivodeship Poland_Lower Silesian Voivodeship Poland_Masovian Voivodeship Poland_Podlaskie Voivodeship Poland_Warmian-Masurian Voivodeship ] I(1) 5279.09028 map/traffic_manager.cpp:258 OnChangeRoutingSessionState(): MWM set: [17: MwmId [Austria_Upper Austria_Linz, 250804] MwmId [Czech_Jihovychod_Kraj Vysocina, 250804] MwmId [Austria_Salzburg, 250804] MwmId [Poland_Podlaskie Voivodeship, 250804] MwmId [Poland_Masovian Voivodeship, 250804] MwmId [Czech_Severovychod_Pardubicky kraj, 250804] MwmId [Austria_Tyrol, 250804] MwmId [Poland_Lodz Voivodeship, 250804] MwmId [Poland_Lower Silesian Voivodeship, 250804] MwmId [Lithuania_West, 250804] MwmId [Poland_Greater Poland Voivodeship, 250804] MwmId [Germany_Free State of Bavaria_Upper Bavaria_East, 250804] MwmId [Czech_Severovychod_Kralovehradecky kraj, 250804] MwmId [Lithuania_East, 250804] MwmId [Poland_Warmian-Masurian Voivodeship, 250804] MwmId [Czech_Jihozapad_Jihocesky kraj, 250804] MwmId [Austria_Upper Austria_Wels, 250804] ] Segmentation fault (core dumped) ``` So the crash likely happens during `OnChangeRoutingSessionState()`. In the first case, it got to at least to line 248; in the second case it ran beyond line 248 up to at least line 258. We might be looking at a race condition involving unsynchronized access to the same data here.
Author
Member
Copy link

Help wanted: Symptoms indicate unsynchronized access, but I have no idea which threads and data structures are involved. We are talking about a very sporadic error which may take some time to reproduce. Helgrind slows down the code massively (rendering it near-unusable). Even in theory, without proper IDE integration I have no idea how to translate addresses from Helgrind into data structures in the code. Can anyone help with these things?

Help wanted: Symptoms indicate unsynchronized access, but I have no idea which threads and data structures are involved. We are talking about a very sporadic error which may take some time to reproduce. Helgrind slows down the code massively (rendering it near-unusable). Even in theory, without proper IDE integration I have no idea how to translate addresses from Helgrind into data structures in the code. Can anyone help with these things?
pastk changed title from (削除) Crashes while routing (削除ここまで) to Traffic: crashes while routing 2026年02月22日 00:23:21 +01:00
Author
Member
Copy link

For the crash between lines 248–258, this is the affected code:

LOG(LINFO, ("Router MWMs:", mwmNames));
std::set<MwmSet::MwmId> mwms;
for (auto const & mwmName : mwmNames)
{
 MwmSet::MwmId mwmId = m_dataSource.GetMwmIdByCountryFile(platform::CountryFile(mwmName));
 if (mwmId.IsAlive())
 mwms.insert(mwmId);
}
LOG(LINFO, ("MWM set:", mwms));

The only operation on non-local variables is the call to m_dataSource.GetMwmIdByCountryFile(). Though we should only be performing read operations here, and spontaneously I can’t think of any reason any other thread would be attempting a write operation on related structures at the same time. (Write operations would be most likely to occur when loading, unloading, adding or updating MWMs, neither of which should have happened at that time (CoMaps had fully started up and no map downloads were active).

For the crash between lines 248–258, this is the affected code: LOG(LINFO, ("Router MWMs:", mwmNames)); std::set<MwmSet::MwmId> mwms; for (auto const & mwmName : mwmNames) { MwmSet::MwmId mwmId = m_dataSource.GetMwmIdByCountryFile(platform::CountryFile(mwmName)); if (mwmId.IsAlive()) mwms.insert(mwmId); } LOG(LINFO, ("MWM set:", mwms)); The only operation on non-local variables is the call to `m_dataSource.GetMwmIdByCountryFile()`. Though we should only be performing read operations here, and spontaneously I can’t think of any reason any other thread would be attempting a write operation on related structures at the same time. (Write operations would be most likely to occur when loading, unloading, adding or updating MWMs, neither of which should have happened at that time (CoMaps had fully started up and no map downloads were active).
Author
Member
Copy link

Plus, GetMwmIdByCountryFile() calls locks a mutex before calling its implementation, which is an argument against it being the culprit.

Plus, `GetMwmIdByCountryFile()` calls locks a mutex before calling its implementation, which is an argument against it being the culprit.
Author
Member
Copy link

Output from another crash, this time past line 258, captured with gdb -q -batch -ex "run" -ex "bt" --args ~/src/omim-build-release/CoMaps:

I(1) 204.27330 map/traffic_manager.cpp:213 OnChangeRoutingSessionState(): Routing session state changed from RouteRebuilding to RouteNotStarted
I(1) 204.27337 map/traffic_manager.cpp:214 OnChangeRoutingSessionState(): Running on thread 140737253072064
I(1) 204.27613 map/traffic_manager.cpp:248 OnChangeRoutingSessionState(): Router MWMs: [16: Czech_Jihozapad_Jihocesky kraj Czech_Severovychod_Liberecky kraj Czech_Stredni Cechy_East Czech_Stredni Cechy_West Germany_Free State of Bavaria_Lower Bavaria Germany_Free State of Bavaria_Upper Bavaria_East Germany_Free State of Bavaria_Upper Bavaria_Munchen Lithuania_East Lithuania_West Poland_Greater Poland Voivodeship Poland_Kuyavian-Pomeranian Voivodeship Poland_Lower Silesian Voivodeship Poland_Lubusz Voivodeship Poland_Warmian-Masurian Voivodeship Russia_Kaliningrad Oblast ���[��WW��3W�oland Voivodeship ]
I(1) 204.27621 map/traffic_manager.cpp:258 OnChangeRoutingSessionState(): MWM set: [14: MwmId [Poland_Greater Poland Voivodeship, 251217] MwmId [Poland_Kuyavian-Pomeranian Voivodeship, 251217] MwmId [Czech_Jihozapad_Jihocesky kraj, 251217] MwmId [Poland_Warmian-Masurian Voivodeship, 251217] MwmId [Poland_Lower Silesian Voivodeship, 251217] MwmId [Lithuania_East, 251217] MwmId [Lithuania_West, 251217] MwmId [Germany_Free State of Bavaria_Lower Bavaria, 251217] MwmId [Poland_Lubusz Voivodeship, 251217] MwmId [Czech_Stredni Cechy_West, 251217] MwmId [Czech_Severovychod_Liberecky kraj, 251217] MwmId [Germany_Free State of Bavaria_Upper Bavaria_Munchen, 251217] MwmId [Germany_Free State of Bavaria_Upper Bavaria_East, 251217] MwmId [Czech_Stredni Cechy_East, 251217] ]
I(2) 204.27626 map/traffic_manager.cpp:869 WaitForRequest(): timeout: 0 active MWMs changed: 1 test mode: 0
I(2) 204.27628 map/traffic_manager.cpp:781 ThreadRoutine(): active MWMs changed: 1 , poll needed: 0
Thread 13 "CoMaps" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffca7fc6c0 (LWP 107544)]
0x000055555590d864 in routing::AbsentRegionsFinder::GetAllRegions(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) ()
#0 0x000055555590d864 in routing::AbsentRegionsFinder::GetAllRegions(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) ()
#1 0x000055555590f40e in routing::AsyncRouter::CalculateRoute() ()
#2 0x000055555590fd2e in routing::AsyncRouter::ThreadFunc() ()
#3 0x0000555555c791d2 in threads::SimpleThread::ThreadFunc(std::function<void ()>&&) ()
#4 0x0000555555921d42 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::function<void ()>&&), std::_Bind<void (routing::AsyncRouter::*(routing::AsyncRouter*))()> > > >::_M_run() ()
#5 0x00007ffff5aecdb4 in ??? () at /lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff569caa4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
#7 0x00007ffff5729c6c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

The thread that triggered the segmentation fault is not the thread in which OnChangeRoutingSessionState() runs (see second line of log output and , which explains why log output differs each time. (This time we even have log output beyond line 258.)

Looking at the stack trace, I would suspect the thread that crashes to be some router thread (either the router thread, or a router thread spawned by the decoder – need to analyze the inner workings of the decoder to tell for sure).

The function in which the segfault occurred is routing::AbsentRegionsFinder::GetAllRegions().

I am also seeing some corruption on the other thread in the log output (at 204.27613), not sure if it is relevant here.

Output from another crash, this time past line 258, captured with `gdb -q -batch -ex "run" -ex "bt" --args ~/src/omim-build-release/CoMaps`: ``` I(1) 204.27330 map/traffic_manager.cpp:213 OnChangeRoutingSessionState(): Routing session state changed from RouteRebuilding to RouteNotStarted I(1) 204.27337 map/traffic_manager.cpp:214 OnChangeRoutingSessionState(): Running on thread 140737253072064 I(1) 204.27613 map/traffic_manager.cpp:248 OnChangeRoutingSessionState(): Router MWMs: [16: Czech_Jihozapad_Jihocesky kraj Czech_Severovychod_Liberecky kraj Czech_Stredni Cechy_East Czech_Stredni Cechy_West Germany_Free State of Bavaria_Lower Bavaria Germany_Free State of Bavaria_Upper Bavaria_East Germany_Free State of Bavaria_Upper Bavaria_Munchen Lithuania_East Lithuania_West Poland_Greater Poland Voivodeship Poland_Kuyavian-Pomeranian Voivodeship Poland_Lower Silesian Voivodeship Poland_Lubusz Voivodeship Poland_Warmian-Masurian Voivodeship Russia_Kaliningrad Oblast ���[��WW��3W�oland Voivodeship ] I(1) 204.27621 map/traffic_manager.cpp:258 OnChangeRoutingSessionState(): MWM set: [14: MwmId [Poland_Greater Poland Voivodeship, 251217] MwmId [Poland_Kuyavian-Pomeranian Voivodeship, 251217] MwmId [Czech_Jihozapad_Jihocesky kraj, 251217] MwmId [Poland_Warmian-Masurian Voivodeship, 251217] MwmId [Poland_Lower Silesian Voivodeship, 251217] MwmId [Lithuania_East, 251217] MwmId [Lithuania_West, 251217] MwmId [Germany_Free State of Bavaria_Lower Bavaria, 251217] MwmId [Poland_Lubusz Voivodeship, 251217] MwmId [Czech_Stredni Cechy_West, 251217] MwmId [Czech_Severovychod_Liberecky kraj, 251217] MwmId [Germany_Free State of Bavaria_Upper Bavaria_Munchen, 251217] MwmId [Germany_Free State of Bavaria_Upper Bavaria_East, 251217] MwmId [Czech_Stredni Cechy_East, 251217] ] I(2) 204.27626 map/traffic_manager.cpp:869 WaitForRequest(): timeout: 0 active MWMs changed: 1 test mode: 0 I(2) 204.27628 map/traffic_manager.cpp:781 ThreadRoutine(): active MWMs changed: 1 , poll needed: 0 Thread 13 "CoMaps" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffca7fc6c0 (LWP 107544)] 0x000055555590d864 in routing::AbsentRegionsFinder::GetAllRegions(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) () #0 0x000055555590d864 in routing::AbsentRegionsFinder::GetAllRegions(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) () #1 0x000055555590f40e in routing::AsyncRouter::CalculateRoute() () #2 0x000055555590fd2e in routing::AsyncRouter::ThreadFunc() () #3 0x0000555555c791d2 in threads::SimpleThread::ThreadFunc(std::function<void ()>&&) () #4 0x0000555555921d42 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::function<void ()>&&), std::_Bind<void (routing::AsyncRouter::*(routing::AsyncRouter*))()> > > >::_M_run() () #5 0x00007ffff5aecdb4 in ??? () at /lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff569caa4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447 #7 0x00007ffff5729c6c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 ``` The thread that triggered the segmentation fault is not the thread in which `OnChangeRoutingSessionState()` runs (see second line of log output and , which explains why log output differs each time. (This time we even have log output beyond line 258.) Looking at the stack trace, I would suspect the thread that crashes to be some router thread (either **the** router thread, or a router thread spawned by the decoder – need to analyze the inner workings of the decoder to tell for sure). The function in which the segfault occurred is `routing::AbsentRegionsFinder::GetAllRegions()`. I am also seeing some corruption on the other thread in the log output (at 204.27613), not sure if it is relevant here.
Author
Member
Copy link

AsyncRouter::ThreadFunc() is the thread routine for AsyncRouter::m_thread, which is initialized in the AsyncRouter constructor.

AsyncRouter is a wrapper class to run routing routines in a different thread. It encapsulates an IRouter (or subclass) instance and runs it in a separate worker thread to calculate the route.

RoutingTraffDecoder encapsulates an IRouter directly, running the router on the traffic worker thread.

All of this indicates the segfault occurs on the router thread.

Since I remember there being some issues with crashes while routing, I did some research and the only one I found was #2131. However, it does not look related.

I do notice that routing::AbsentRegionsFinder::GetAllRegions() is indirectly called from two places (not counting tests):

routing::AbsentRegionsFinder::GetAllRegions(...)
 routing::AbsentRegionsFinder::GetAbsentRegions(...)
 routing::AsyncRouter::CalculateRoute() // without arguments
 routing::AsyncRouter::GetAllRegions(...)
 routing::RoutingSession::GetAllRegions(...)
 TrafficManager::OnChangeRoutingSessionState(...)

So the routing thread is inside routing::AsyncRouter::GetAllRegions(), and the UI thread is inside a function which may also call routing::AsyncRouter::GetAllRegions().

That call happens in traffic_manager.cpp:241. The two functions in between in the call stack do nothing apart from verifying that the class instance is not null before calling its method.

Th next place where something happens is routing::AsyncRouter::GetAllRegions(). It checks if it has a router thread, which should only be the case when called from the router. If so, it retrieves the regions from the thread and caches them. If not, it returns the cached regions.

The corruption in the set of MWMs I am seeing above indicates unsynchronized access to the list of regions. Indeed, the structure is not protected in any way. So I guess that’s the error.

`AsyncRouter::ThreadFunc()` is the thread routine for `AsyncRouter::m_thread`, which is initialized in the `AsyncRouter` constructor. `AsyncRouter` is a wrapper class to run routing routines in a different thread. It encapsulates an `IRouter` (or subclass) instance and runs it in a separate worker thread to calculate the route. `RoutingTraffDecoder` encapsulates an `IRouter` directly, running the router on the traffic worker thread. All of this indicates the segfault occurs on the router thread. Since I remember there being some issues with crashes while routing, I did some research and the only one I found was #2131. However, it does not look related. I do notice that `routing::AbsentRegionsFinder::GetAllRegions()` is indirectly called from two places (not counting tests): ``` routing::AbsentRegionsFinder::GetAllRegions(...) routing::AbsentRegionsFinder::GetAbsentRegions(...) routing::AsyncRouter::CalculateRoute() // without arguments routing::AsyncRouter::GetAllRegions(...) routing::RoutingSession::GetAllRegions(...) TrafficManager::OnChangeRoutingSessionState(...) ``` So the routing thread is inside `routing::AsyncRouter::GetAllRegions()`, and the UI thread is inside a function which may also call `routing::AsyncRouter::GetAllRegions()`. That call happens in `traffic_manager.cpp:241`. The two functions in between in the call stack do nothing apart from verifying that the class instance is not null before calling its method. Th next place where something happens is `routing::AsyncRouter::GetAllRegions()`. It checks if it has a router thread, which should only be the case when called from the router. If so, it retrieves the regions from the thread and caches them. If not, it returns the cached regions. The corruption in the set of MWMs I am seeing above indicates unsynchronized access to the list of regions. Indeed, the structure is not protected in any way. So I guess that’s the error.
Author
Member
Copy link

Fixed synchronization in 10ed4682c (turns out the mutex was already there, comments and everything, I just forgot to actually lock it before accessing the member it was meant to protect). Currently running some lab tests. Closing this for now, with the option to reopen, should it turn out that issues still persist (due to the sporadic nature of the bug, it is hard to prove with certainty that it is resolved).

Fixed synchronization in 10ed4682c (turns out the mutex was already there, comments and everything, I just forgot to actually lock it before accessing the member it was meant to protect). Currently running some lab tests. Closing this for now, with the option to reopen, should it turn out that issues still persist (due to the sporadic nature of the bug, it is hard to prove with certainty that it is resolved).
Author
Member
Copy link

Still getting segfaults in routing::AbsentRegionsFinder::GetAllRegions(), need to investigate further.

Still getting segfaults in `routing::AbsentRegionsFinder::GetAllRegions()`, need to investigate further.
Author
Member
Copy link

Not 100% sure if that is an issue, but access to AbsentRegionsFinder::m_routerThread is also unsynchronized.

Just to be sure, I am protecting the entire function bodies of GenerateAbsentRegions() and GetAllRegions() with the mutex. That would protect access to any and all non-const members of AbsentRegionsFinder – at the cost of potentially locking up the UI thread, should it call GetAllRegions() while the router is also calling it (and waiting for the router thread to finish).

The only way for the UI thread to call GetAllRegions() is from TrafficManager::OnChangeRoutingSessionState(), which only happens for certain state transitions – namely those which indicate the router (and thus the router thread) has finished. So I’m not expecting that to cause any issues in practice.

Not 100% sure if that is an issue, but access to `AbsentRegionsFinder::m_routerThread` is also unsynchronized. Just to be sure, I am protecting the entire function bodies of `GenerateAbsentRegions()` and `GetAllRegions()` with the mutex. That would protect access to any and all non-`const` members of `AbsentRegionsFinder` – at the cost of potentially locking up the UI thread, should it call `GetAllRegions()` while the router is also calling it (and waiting for the router thread to finish). The only way for the UI thread to call `GetAllRegions()` is from `TrafficManager::OnChangeRoutingSessionState()`, which only happens for certain state transitions – namely those which indicate the router (and thus the router thread) has finished. So I’m not expecting that to cause any issues in practice.
Author
Member
Copy link

Implemented in 6eb30a43

Implemented in 6eb30a43
Author
Member
Copy link

I tested on a longer road trip over the past few days and did not experience any further crashes. This issue seems fixed.

I tested on a longer road trip over the past few days and did not experience any further crashes. This issue seems fixed.
Sign in to join this conversation.
traffic
main
test/2026.07.11
pastk-core-check-updates-always
carplay-dashboard-support
test/2026.07.11-ios
routing-options-banner
generate-260711-test
generator_triangles_packed
matheusgomesms-road-shields
nav-arrow-color
gedankenstuecke-20260709-resolve_translate2
generate-260709-test
modes-ui
zy-mwm-monitoring
zyphlar-patch-3
zyphlar-patch-1
pastk-core-fix-new-poi-crash-TEST
generate-260705-test
pastk-mapgen-pr-4162
style/format-ci-enforcement
x7z4w-patch-1
yannikbloscheck-modes
test/2026.07.02-2
test/2026.07.02
generate-260628-test
zy-mapgen-wildcard
hbond/address-format
generate-260615-temp
zy-windows-app
traffic
cherry-pick-pr-11661
generate-260606-temp
generate-260606-test
release/2026.06.05
hbond/live-notification
pastk-pr-4405
generate-260603
generate-260530-temp
test/2026.05.29
zy-drape-documentation
generate-260527-test
test/2026.05.22
generate-260521-test
highway-construction
zy-mwm-safemode
release/2026.05.06
pastk-android-indep-map-updates
generate-260504
pastk-mapgen-TEST
pastk-test-2026年05月01日-fixed
pastk-mapgen-planet-update-buff
zy-mwm-intent
test/2026.05.01
generate-260430-test
jb_no_tag
pastk-TEST-ios-countries-signature
generate-260428
patepelo-club
release/2026.04.23
pastk-indep-map-updates-TEST
generate-260421
test/2026.04.19
zy-mwm-routing
generate-260414-test
zy-cicd
release/2026.04.07
pastk-alpha
x7z4w/x7z4w-border
generate-260405
jb_drv_opt
zy-subway-last-good
pastk-mapgen-TMP-wiki-lang
test/2026.04.03
generate-260401-test
pastk-mapgen-TEST-fix-categories-matching
release/2026.03.23
generate-260321
test/2026.03.19
yannikbloscheck-remove-english-as-default
generate-260316-test
yannikbloscheck-simplify-poi-checking
yannikbloscheck-ios-remove-unused-graphics
release/2026.03.09
generate-260307
jb_rw_st
test/2026.03.02
matheusgomesms-stop-signs
generate-260302-test
pastk-TEST-isolines
pastk-TEST-tiger
zy-runner-tools
pastk-TMP-mapgen-test
pastk-TMP-mapgen-debug
release/2026.02.23
pastk-styles-toll-booth-vis
generate-260221
test/2026.02.17
pastk-TMP-indep-map-updates
transit
generate-260215-test
pastk-mapgen-subways-clone
zy-mwm-docs
release/2026.02.09
generate-260207
zy-mwm-pano
zy-countries-versioning
noelclick-allow-remote-countries-txt
test/2026.02.03
generate-260202-debug-test
generate-260201-test
yannikbloscheck-ios-downloader-to-swiftui
release/2026.01.24
jb_3d_layer
jb_dlt_list
hbond-confirm-editor-pending
generate-260122
test/2026.01.20
generate-260118-test
zy-panoramax
zy-pano-build
zy-live-location
pastk-mapgen-pbf-update-verbose
test/2026.01.09
test/next
release/2026.01.08
generate-260106
test/2026.01.03
pastk-om-route-building-buttons
generate-260101-test
zyphlar-patch-5
test/2025.12.29
pastk-TMP-disable-fr1
release/2025.12.28
generate-251227
release/2025.12.19
generate-251217
test/2025.12.17
zy-panoramax-selector
test/2025.12.11
release/2025.12.11
generate-251209
test/2025.12.05
generate-251205-test
generate-251203
generate-next
release/2025.11.25
release/2025.11.19
generate-251116
test/2025.11.15
generate-251112-test
yannikbloscheck-more-cuisines
x7z4w-traffic
release/2025.11.07
generate-251104
release/2025.11.01
release/2025.10.16-fdroid
x7z4w-patch-4
release/2025.10.16
release/2025.10.09
release/2025.10.08
release/2025.10.02
generate-250906
pastk-mapgen-world-detail-optimize
generate-250902-test
release/2025.08.31
map-per-pedestrian-area
test/2025.08.24
test/2025.08.22
generate-250822
pastk-ios-reformat
release/2025.08.13
pastk-om-batch-31-android-bm-colors
pastk-gplay-metadata
release/2025.07.23
hb0nd-layers-leftbutton
generate-250804
fix-ci
test/2025.08.03
pastk-android-GS-cert-fix
always-update-fast
test/2025.07.20
test/2025.07.10
release/2025.06.30
test/2025.06.27
release/2025.06.25-apple
release/2025.06.22
pastk-gen-isolines
test/2025.06.19
test/2025.06.16
test/2025.06.12
release/2025.06.10
test/2025.06.08
release/2025.06.01
zyphlar-patch-2
delete_passed_intermediate_points
v2026.06.05-11
v2026.05.06-11
v2026.04.23-19
v2026.04.07-8
v2026.03.23-5
v2026.03.09-18
v2026.02.23-9
v2026.02.23-8
v2026.02.23-6
v2026.02.09-4-Linux
v2026.02.09-4
v2026.01.29-2-Linux
v2026.01.24-05
v2026.01.24-5
v2026.01.08-11
v2025.12.28-2
v2025.12.19-11
v2025.12.11-2
v2025.11.25-4
v2025.11.19-2
v2025.11.07-2
v2025.11.01-7
v2025.10.20-1
v2025.10.16-1
v2025.10.09-3
v2025.10.08-3
v2025.10.02-2
v2025.08.31-15
v2025.08.13-8
2025年08月10日-linux
2025年08月08日-2-android
2025年07月23日-4-android
2025年07月23日-2-android
2025年06月30日-22-android
2025年06月25日-1-apple
2025年06月22日-5-android
2025年06月10日-4-android
2025年06月01日-6-android
squashed-history
Labels
Clear labels
accessibility
Visual contrast, screen readers, etc.
addresses
Related to addresses, post codes, city/town/village borders
AI-assisted
AI-assisted PRs or issues
Android
Android app
Android Auto
Android Auto integration
Android Automotive
Android Automotive app
api
Deeplinks and URLs handled by the API
app stores
Google Play, App Store, F-Droid, Obtanium, Huawei Gallery, Acressent, Flathub, IzzyOnDroid, etc.
battery & performance
Performance and battery consumption-related problems and optimisations
borders
Related to borders between countries / regions
bug
Something is not working
build
building of apps
CarPlay
CarPlay integration
community
Community relations
contribution welcome
Contributions are very welcome, get started here
core
C++ core of the app
crash
Crash reporting
cycling
Specific to using a bicycle or similar vehicles
desktop
Qt desktop app incl. designer
devops
directions
Voice and visual turn-by-turn directions
docs
Documentation
downloader
Map downloader
drape
The C++ map rendering engine
driving
Specific to driving a car or similar vehicles
duplicate
This issue or pull request already exists
editor
Built-in OSM editor
elevation
Contour lines, elevation profiles, ...
enhancement
New feature
EPIC
A big idea or a piece of work that requires a lot of effort to implement
F-Droid
F-Droid platform
favorites
Places and GPS tracks
feature parity
A feature is implemented on one platform, but not on another
fonts
Fonts
good first issue
Interested in contributing? Get started here
help wanted
Need some help
icons
Map features icons
invalid
Something is wrong
iOS
iOS app
legal
Legal aspects
linux phone
LibreM, PinePhone and other mobile linuxes
location
Via GPS, network, etc.
macOS
Emulated iOS App or Qt Desktop App specifically related to macOS
map data
Related to OpenStreetMap data
mapgen needed
map generation is needed for PR to take full effect
maps compat
compatibility of newer maps with older apps; issues and PRs breaking or fixing compatibility
maps generator
Maps generator
navigation
The navigation turn-by-turn app mode
need feedback
Further information is requested
needs design
not planned
This is not planned at the moment
OM
Related to or references Organic Maps
opening hours
Related to Business Hours, off time, holidays, seasonal
outdoor
Hiking, backcountry cycling, 4WD, etc.
POI info
Various feature attributes usually displayed on the place page
priority
High
Seriously affects a lot of users or breaks the app severely
priority
Low
Not urgent or only happens in rare cases
priority
Medium
Happens enough to be a concern, but not app-breaking
privacy
Privacy aspects
public feedback needed
Experimental changes which requite explicit public feedback before continuing with them
public transport
Specific to public transport (busses, trams, subways, trains etc.)
question
Questions and Discussions
raw idea
Needs more discussion or to be further elaborated
refactoring
Improving the structure or simplifying the code, improving maintainability
regional
Different depending on the country or region
regression
Regression in the app
releases
Release management
route planning
Preview and plan your route
routing
Routing engine
search
Search inside of the app
security
Security improvements
source data
Related to OSM, SRTM, Tiger etc.
styles
Map styling, incl. mapping OSM tags
subway
The special subway layer
task
Internal things that have a clear way for implementation
tests
Unit tests
track recording
Track recording
traffic
Traffic information (still under development)
translations
Translations and all other kinds of localisation
TTS
Text-to-Speech
UI
User interface
UX
User experience
wait for upstream
Waiting for something to be done upstream
walking
Specific to walking
Wikipedia
Related to the embedded Wikipedia articles
Windows
Windows related
world map
The world overview map
No labels
accessibility
addresses
AI-assisted
Android
Android Auto
Android Automotive
api
app stores
battery & performance
borders
bug
build
CarPlay
community
contribution welcome
core
crash
cycling
desktop
devops
directions
docs
downloader
drape
driving
duplicate
editor
elevation
enhancement
EPIC
F-Droid
favorites
feature parity
fonts
good first issue
help wanted
icons
invalid
iOS
legal
linux phone
location
macOS
map data
mapgen needed
maps compat
maps generator
navigation
need feedback
needs design
not planned
OM
opening hours
outdoor
POI info
priority
High
priority
Low
priority
Medium
privacy
public feedback needed
public transport
question
raw idea
refactoring
regional
regression
releases
route planning
routing
search
security
source data
styles
subway
task
tests
track recording
traffic
translations
TTS
UI
UX
wait for upstream
walking
Wikipedia
Windows
world map
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
comaps/comaps#2937
Reference in a new issue
comaps/comaps
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?