This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core, iOS] Fix MGLOfflinePack invalidate crash #15582
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julianrex
added
iOS
Mapbox Maps SDK for iOS
crash
⚠️ DO NOT MERGE
Work in progress, proof of concept, or on hold
Core
The cross-platform C++ core, aka mbgl
labels
Sep 6, 2019
tmpsantos
reviewed
Sep 9, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OfflineDatabase LGTM
julianrex
force-pushed
the
jrex/15536-offline-pack-crash
branch
from
September 12, 2019 04:24
5f1a062
to
6b1df42
Compare
julianrex
requested review from
a team and
fabian-guerra
and removed request for
a team and
1ec5
September 12, 2019 13:10
julianrex
removed
the
⚠️ DO NOT MERGE
Work in progress, proof of concept, or on hold
label
Sep 12, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this. Overall tests LGTM. Just a question regarding thread safeness.
julianrex
force-pushed
the
jrex/15536-offline-pack-crash
branch
from
September 18, 2019 20:15
f3dff56
to
8d50706
Compare
julianrex
force-pushed
the
jrex/15536-offline-pack-crash
branch
from
September 18, 2019 20:50
8d50706
to
025017c
Compare
fabian-guerra
approved these changes
Sep 18, 2019
chloekraw
changed the title
Fix MGLOfflinePack invalidate crash
[core, iOS] Fix MGLOfflinePack invalidate crash
Nov 6, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
EDIT:
This PR fixes a crash in
invalidate
due to nil pointer access, and adds code to catch an unhandled exception that is yet to be fully investigated.The issue of accessing
MGLOfflineStorage
andMGLOfflinePack
from multiple threads is NOT covered by this PR, and will hopefully be addressed by a refactor.Until that point, it remains our recommendation that
MGLOfflineStorage
not be called from a background thread.Original post:
WIP branch investigating issues around #15536.
The cause of the crash looks like a null pointer access in
setOfflineRegionObserver
in-[MGLOfflinePack invalidate]
- triggered by 2 calls toinvalidate
, most likely on different threads.This PR fixes the null pointer access, but in the process of testing this, and testing the scenario in #15536 an exception fired (I was also seeing what looked like FileSource crashes when the test fails - possibly when
exit
is called by the test runner).This PR does NOT address any issues with accessing
MGLOfflinePack
andMGLOfflineStorage.packs
from multiple threads.Re: the exceptions, @tmpsantos as discussed earlier:
At a13dd1b - the test
test15536RemovePacksWhileReloading
will trigger an exception that's caught inCFRunLoopRun()
(RunLoop::run()
).The exception is
std::runtime_error("Malformed offline region definition");
thrown in offline.cpp. The region is""
, i.e. an empty string. I do not know why.What's going on here?
The subsequent commit 2143e77 adds a catch to
OfflineDatabase::getRegionDefinition
, and the test should complete.