Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NullPointerException com.rnmapbox.rnmbx.utils.ViewTagResolver #3343

Open
JClackett opened this issue Jan 26, 2024 · 6 comments
Open
Labels
bug 🪲 Something isn't working

Comments

@JClackett
Copy link

JClackett commented Jan 26, 2024

Mapbox Implementation

Mapbox

Mapbox Version

11.0.0

Platform

Android

@rnmapbox/maps version

10.1.5

expo version

50.0.3

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

Only when deployed, the app sometimes crashes on android with this:

java.lang.NullPointerException: null
    at com.rnmapbox.rnmbx.utils.ViewTagResolver.getManager(ViewTagResolver.kt:51)
    at com.rnmapbox.rnmbx.utils.ViewTagResolver.withViewResolved$lambda$4(ViewTagResolver.kt:58)
    at com.rnmapbox.rnmbx.utils.ViewTagResolver.$r8$lambda$ZFXWzquiK28lSR5tbH0BihabahM
    at com.rnmapbox.rnmbx.utils.ViewTagResolver$$ExternalSyntheticLambda0.run
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8757)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Expected behavior

Not crash

Notes / preliminary analysis

Really not sure, after the app crashed and reopening it works again

Additional links and references

No response

@JClackett JClackett added the bug 🪲 Something isn't working label Jan 26, 2024
@mfazekas
Copy link
Contributor

See #3243, can't really do much with it without a way to reproduce the issue

@jacobhummel
Copy link

@mfazekas We started seeing this issue a lot in production after upgrading Expo 48 -> 49 and @rnmapbox/maps 10.0.10 -> 10.1.8 simultaneously (so I can't say 100% it's just the mapbox change). Our app crash rate went from under 2% to around 8% from this one crash. It seems to intermittently occur when a user is using the app for a while in the background and re-opens it. It crashes immediately on app re-open.

@vineyardbovines
Copy link

We're experiencing the same issue. While it's very hard to reproduce- it seems like this issue is related.

@FrederickEngelhardt
Copy link
Contributor

FrederickEngelhardt commented Aug 10, 2024

Google play console testing shows it on a Motorola api 30. All of my devices on api34 do not have this issue and this is on a Rn74 app.

Seems to happen immediately on launch of the map. The error was caught in google's automated testing pipeline.

For context, my app launches with the map almost immediately after requesting for tileserver urls and related data.

My app does not include expo. So pretty sure it's unrelated to expo, but could be related to react-native version and how modules are initialized.

Screenshot_20240809_172332_Chrome.jpg

FATAL EXCEPTION: main
Process: <yourapp>, PID: 19862
java.lang.NullPointerException
	at com.rnmapbox.rnmbx.components.mapview.y.H0(SourceFile:27)
	at com.rnmapbox.rnmbx.components.mapview.NativeMapViewModule$n.a(SourceFile:12)
	at com.rnmapbox.rnmbx.components.mapview.NativeMapViewModule$n.invoke(SourceFile:3)
	at ha.r.h(SourceFile:34)
	at ha.r.a(SourceFile:1)
	at ha.p.run(SourceFile:1)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(SourceFile:1)
	at android.os.Looper.loop(Looper.java:240)
	at android.app.ActivityThread.main(ActivityThread.java:8000)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 

@Gp2mv3
Copy link
Contributor

Gp2mv3 commented Sep 4, 2024

Hello,
I see the same error in my Android vitals.
I'm using RN 0.74.0 and rnMapbox 10.1.29.

Maybe this trace can help too:

Exception java.lang.NullPointerException:
  at com.rnmapbox.rnmbx.components.camera.CameraUpdateQueue.execute (CameraUpdateQueue.kt:62)
  at com.rnmapbox.rnmbx.components.camera.RNMBXCamera.updateCamera (RNMBXCamera.kt:205)
  at com.rnmapbox.rnmbx.components.camera.RNMBXCamera.access$setHasSentFirstRegion$p (RNMBXCamera.kt:41)
  at com.rnmapbox.rnmbx.components.camera.RNMBXCamera.access$updateCamera (RNMBXCamera.kt:41)
  at com.rnmapbox.rnmbx.components.camera.RNMBXCamera$addToMap$1.invoke (RNMBXCamera.kt:104)
  at com.rnmapbox.rnmbx.components.camera.RNMBXCamera$addToMap$1.invoke (RNMBXCamera.kt:101)
  at com.rnmapbox.rnmbx.components.mapview.RNMBXLifeCycle.afterAttachFromLooper (RNMBXMapView.kt:178)
  at com.rnmapbox.rnmbx.components.mapview.RNMBXMapView.onAttachedToWindow$lambda$26 (RNMBXMapView.kt:1479)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8918)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:608)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)

Any clue ?

@nixolas1
Copy link

nixolas1 commented Sep 25, 2024

We're getting it on Expo 51, RN 0.74.5, "@rnmapbox/maps": "^10.1.31", RNMapboxMapsVersion: "11.6.0",
When the app initializes, in with devserver. Often 50% chance when reloading app from dev server.


09-25 10:24:33.201 22341 22341 E DevLauncher: Exception in native call from JS
09-25 10:24:33.201 22341 22341 E DevLauncher: java.lang.NullPointerException
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver.getManager(ViewTagResolver.kt:54)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver.tagAssigned$lambda$2(ViewTagResolver.kt:33)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver.$r8$lambda$fFgiZ0J-rbxO4IwNPQ2Xls8C8z4(Unknown Source:0)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver$$ExternalSyntheticLambda1.run(Unknown Source:6)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at android.os.Handler.handleCallback(Handler.java:958)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at android.os.Looper.loopOnce(Looper.java:230)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at android.os.Looper.loop(Looper.java:319)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at android.app.ActivityThread.main(ActivityThread.java:8919)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at java.lang.reflect.Method.invoke(Native Method)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
09-25 10:24:33.201 22341 22341 E DevLauncher: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

And the parent error catcher:

09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: Unhandled SoftException
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: com.facebook.react.bridge.ReactNoCrashSoftException: Cannot get UIManager because the context doesn't contain an active CatalystInstance.
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:76)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:46)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver.getManager(ViewTagResolver.kt:54)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver.tagAssigned$lambda$2(ViewTagResolver.kt:33)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver.$r8$lambda$fFgiZ0J-rbxO4IwNPQ2Xls8C8z4(Unknown Source:0)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.rnmapbox.rnmbx.utils.ViewTagResolver$$ExternalSyntheticLambda1.run(Unknown Source:6)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at android.os.Handler.handleCallback(Handler.java:958)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at android.os.Looper.loopOnce(Looper.java:230)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at android.os.Looper.loop(Looper.java:319)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at android.app.ActivityThread.main(ActivityThread.java:8919)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at java.lang.reflect.Method.invoke(Native Method)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
09-25 10:24:33.201 22341 22341 E unknown:com.facebook.react.uimanager.UIManagerHelper: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants