newrelic / newrelic-cordova-plugin

A Cordova plugin for the New Relic Mobile SDKs
Apache License 2.0
18 stars 66 forks source link

NullPointerException #61

Closed stevesum closed 1 year ago

stevesum commented 1 year ago

We use the start and end interaction from Android native code in our application. In GooglePlay CrashLog I found this message: Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void com.newrelic.agent.android.tracing.TraceMachine.completeActivityTrace()' on a null object reference at com.newrelic.agent.android.tracing.TraceMachine.endTrace (TraceMachine.java:191) at com.newrelic.agent.android.NewRelic.endInteraction (NewRelic.java:580)

We use the latest 6.1.0 from the plugin. The impacted device and os version were the following:

ndesai-newrelic commented 1 year ago

@stevesum We will look into this issue.

stevesum commented 1 year ago

@ndesai-newrelic any news about it? Unfortunately, we have an application released with this plugin and we get these reports about the application crash.

kennyt276 commented 1 year ago

@stevesum We are currently looking into reproducing this issue. Would it be possible to provide any additional runtime logs when this issue happens, preferably from the developer side and not from Google Play?

stevesum commented 1 year ago

@kthai-nr We are not able to reproduce it either, but still a real problem with some of the devices. It appears in the NewRelic crash log also, if the data from there helps. You found the crashDetails here [https://drive.google.com/file/d/19VXM5AhzWv_jZ6PsbcBUrcEnu-O-Fd2Y/view?usp=sharing](crash details) device type,Samsung Phone,3 device type,Galaxy S21,1 device model,SM-A525F,1 device model,SM-A520F,1 device model,SM-S911B,1 device model,SM-G991B,1

stevesum commented 1 year ago

May simply should add the null check for safe in the TraceMachine class.

    public static void endTrace() {
        if (isTracingActive()) {
          traceMachine.completeActivityTrace();
        }
     }

    public static void endTrace(String id) {
        try {
            if (getActivityTrace().rootTrace.myUUID.toString().equals(id) && isTracingActive()) {
                traceMachine.completeActivityTrace();
            }
        } catch (TracingInactiveException var2) {
        }

    }
kennyt276 commented 1 year ago

Thanks for providing extra information. We'll add some extra checks/hardening for this. It should be available on the next release.

kennyt276 commented 1 year ago

Hello we've released a new update v6.2.0, which contains some hardening for this issue. I'll close this issue for now, but feel free to let us know if problems still perist.