mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
475 stars 133 forks source link

Failed to load source composite: Chain validation failed #1947

Closed AndriiYanechko closed 11 months ago

AndriiYanechko commented 1 year ago

Environment

Observed behavior and steps to reproduce

Application cannot load style (or initialize the map with provided style), but it happens time to time, I caught that today on my emulator, however on my real device everything works fine, but I see that some users facing same behaviour (I have firebase reports)

Expected behavior

Mapbox is able to apply the style and render the map

Notes / preliminary analysis

Logs:

[common]: Using Mapbox Common SDK v23.1.1(27a3c161b)
23:28:24.814  I  [maps-core]: Using Mapbox Core Maps SDK v10.9.0(10541225b5)
23:28:27.686  I  [MapboxReachability]: Application permission for ACCESS_NETWORK_STATE granted
23:28:27.701  W  [TelemetryUtils]: java.lang.SecurityException: getDataNetworkTypeForSubscriber
23:28:27.705  W  [config_service]: No configuration options found stored on the disk.
23:28:27.705  W  [config_service]: No configuration options found stored on the disk.
23:28:27.714  W  [config_service]: Update request 1 in progress
23:28:27.715  E  [maps-android\MapTelemetryImpl]: EventsServiceError: [code: EventsDisabled, message: Failed to send event: Events collection disabled]
23:28:27.716  I  [maps-android\ThreadChecker]: Unable to lookup build config of application. com.XXX.XXX
23:28:27.916  I  [maps-android\Mbgl-EGLConfigChooser]: In emulator: false
23:28:27.918  I  [maps-android\Mbgl-EGLConfigChooser]: In emulator: false
23:28:27.920  I  [maps-android\Mbgl-EglCore]: EGLContext created, client version 3
23:28:27.922  I  [maps-core]: Using OpenGL render backend
23:28:28.010  I  [maps-core]: {MapboxRenderThr}[General]: GPU Identifier: Android Emulator OpenGL ES Translator (Apple M1 Max)
23:28:32.074  I  [maps-android\Mbgl-RenderThread]: RenderThread : surface destroyed
23:28:33.534  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:33.535  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:34.594  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:34.594  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:36.763  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:36.763  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:37.148  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:37.149  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:37.149  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source smartbikeServiceArea: Chain validation failed
23:28:37.149  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:37.149  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: smartbikeServiceArea, tileID: null
23:28:37.149  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:37.151  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:37.151  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:38.245  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:38.245  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:38.256  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:38.256  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:38.257  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:38.257  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:40.334  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:40.334  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:40.347  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:40.347  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:40.360  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:40.360  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:40.709  I  [maps-android\Mbgl-RenderThread]: RenderThread : surface destroyed
23:28:44.524  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:44.524  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:44.524  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:44.525  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:44.525  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:44.525  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:48.420  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:48.420  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:48.434  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:48.434  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:49.563  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:49.564  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:49.611  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:49.611  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:49.611  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:49.611  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:50.645  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:50.645  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:51.682  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:51.682  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:51.692  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:51.692  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:52.744  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:52.744  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:55.874  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:55.874  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:28:55.875  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:28:55.876  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:28:56.831  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:28:56.832  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:29:03.981  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:29:03.981  E  [maps-core]: {iximobile.debug}[Style]: Failed to load source composite: Chain validation failed
23:29:03.981  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
23:29:03.982  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SOURCE, message: Failed to load source: Chain validation failed, sourceID: composite, tileID: null
23:29:04.910  E  [maps-core]: {iximobile.debug}[Style]: Failed to load sprite: Chain validation failed
23:29:04.911  E  [maps-android\Mbgl-StyleObserver]: OnMapLoadError: SPRITE, message: Failed to load sprite: Chain validation failed, sourceID: null, tileID: null
yunikkk commented 1 year ago

@AndriiYanechko are the logs from firebase similar to this one? From this emulator logcat it seems the date could be outdated, Chain validation failed usually means that. Other option is expired certificate but I assume it's not the case here.

AndriiYanechko commented 1 year ago

The date is correct, I know that the date could be an issue, so before launching the app I've adjusted the date settings to be in sync by gps and etc (all checks for automatic time adjusting).

Ok, even if we will assume that the root cause of the issue is in wrong date on the client device (I agree this is possible, since it happens only to the ~2-5% of the user), how do you imagine the fix for that, like put in the app dialog which states:

Sorry, our application cannot load the map, because your phone is 1 min later, please adjust the time and try again

It seems strange to me.

yunikkk commented 1 year ago

Ok, even if we will assume that the root cause of the issue is in wrong date on the client device (I agree this is possible, since it happens only to the ~2-5% of the user)

It's a typical reason for such SSL handshake certificate errors (if the certificate itself is indeed valid). It's pretty easy to catch on the emulator, that's why I've asked whether the firebase reports also contain Chain validation failed thus signalling about the same problem.

If it's indeed wrong date/time this means other https requests should fail on the device, then it's unclear how firebase was able to send reports to the endpoint. Maybe they were stored and sent after the time settings were restored to the correct.

If it's not then maybe some set of devices has wrong certificate setup. How many users do face the issue? Were there reports prior to 10.9.0?

Hard to say how to handle such exceptions in the SDK or app since handshake may fail due to different reasons, either server/device certificate is outdated/missing, wrong date on device etc. At the same time mapboxMap.loadStyle has onMapLoadErrorListener callback to indicate any error that can be used I suppose.

AndriiYanechko commented 1 year ago

Actually, I didn't get a report that includes Chain validation failed log from the Firebase, because I didn't log that, however I was showing the dialog to notify the user about error, but onMapLoadErrorListener has been invoked too many time and that was causing ANRs or crashes, I've removed the dialog in the hot-fix release and started investigation on why Mapbox cannot initialize itself properly and the only reason I find out - Chain validation failed. Probably, it will be better to return back to this issue when I'll collect more logs that are related to the Mapbox initialization issue (for that I'll add additional reporting of the any issue that was reported by the onMapLoadErrorListener).

In terms of affected users, you can take a look at the picture bellow, for the app auditory it's about 3-5%, but it's still pretty much:

Screenshot 2023-01-17 at 10 03 58 AM

yunikkk commented 1 year ago

@AndriiYanechko right, then we'll need to see why did the onMapLoadErrorListener was fired, there can be different reasons and specific one is needed to investigate further. 3-5% of affected users indeed seems pretty high, lets take another look when the the logs will be available.

behnawwm commented 11 months ago

Are there any updates on this issue?

baleboy commented 11 months ago

@AndriiYanechko were you able to collect more logs and/or is the error still being reported?

AndriiYanechko commented 11 months ago

Unfortunately, no, I don't see that issue anymore on production builds

baleboy commented 11 months ago

OK, since we know the reason for the "Chain validation failed" error I'm closing this, please file a new one if a new error log pops up.