hansemannn / titanium-firebase-analytics

Use the Firebase Analytics SDK in Axway Titanium 🚀
Other
35 stars 18 forks source link

Play Console Firebase Analytics Crash reported #21

Closed amigoni closed 6 years ago

amigoni commented 6 years ago

Hi, I am getting this error reported a few times on the Android Vitals on the production app. Can't seem to reproduce it in dev environment. Does anyone know what it might be? Thanks

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

_ZN8firebase9analytics31TitaniumFirebaseAnalyticsModule3logERKN2v820FunctionCallbackInfoINS2_5ValueEEE

backtrace:

00 pc 0000000000005234 /data/app/com.fluidmarket.fluid-1/lib/arm64/libfirebase.analytics.so (_ZN8firebase9analytics31TitaniumFirebaseAnalyticsModule3logERKN2v820FunctionCallbackInfoINS2_5ValueEEE+120)

01 pc 0000000000728c00 /data/app/com.fluidmarket.fluid-1/lib/arm64/libkroll-v8.so (_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE+188)

02 pc 000000000077cb6c /data/app/com.fluidmarket.fluid-1/lib/arm64/libkroll-v8.so

03 pc 000000000077d150 /data/app/com.fluidmarket.fluid-1/lib/arm64/libkroll-v8.so

04 pc 000000000077d3bc /data/app/com.fluidmarket.fluid-1/lib/arm64/libkroll-v8.so (_ZN2v88internal21Builtin_HandleApiCallEiPPNS0_6ObjectEPNS0_7IsolateE+28)

05 pc 00000000000000e4

hansemannn commented 6 years ago

Which API's of the module do you use? Which module version? Which SDK version? tiapp.xml config?

amigoni commented 6 years ago

Good point. SDK 7.0.1 FBcore 2.0.0, FBAnalytics 2.0.1,

I use only the following :

var FirebaseCore = require('firebase.core');
var FirebaseAnalytics = require('firebase.analytics');
FirebaseCore.configure();
FirebaseAnalytics.enabled = true;
FirebaseAnalytics.userID = vendorID;
FirebaseAnalytics.log(eventName, data); 
FirebaseAnalytics.setScreenNameAndScreenClass({
    screenName: screenName,
    screenClass: screenName
});

`<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService"/>
            <service android:enabled="true" android:exported="false"
                android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
            <service android:exported="false" android:name="com.fluidmarket.fluid.gcm.RegistrationIntentService"/>
            <receiver android:enabled="true" android:name="com.google.android.gms.measurement.AppMeasurementReceiver">
                <intent-filter>
                    <action android:name="com.google.android.gms.measurement.UPLOAD"/>
                </intent-filter>
            </receiver>
            <service android:exported="false" android:name="com.fluidmarket.fluid.gcm.GcmIntentService">
                <intent-filter>
                    <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
                </intent-filter>
            </service>
            <service android:exported="false" android:name="com.fluidmarket.fluid.gcm.GcmIntentService">
                <intent-filter>
                    <action android:name="com.google.android.c2dm.intent.SEND"/>
                </intent-filter>
            </service>
            <service android:exported="false" android:name="com.fluidmarket.fluid.gcm.GcmIDListenerService">
                <intent-filter>
                    <action android:name="com.google.android.gms.iid.InstanceID"/>
                </intent-filter>
            </service>`
hansemannn commented 6 years ago

Mhh, I have no idea. It seems related to the log method, but not sure. Do you use main thread? And how does data look like? It may have a circular structure or non-serializable data?

amigoni commented 6 years ago

Yes. Question. Is the second parameter on the log call a Javascript Object? Also if the first or second parameter is null or one of the attributes of the second is null, could that potentially cause it?

hansemannn commented 6 years ago

Yep, if the first one is null it will crash for sure. For the second one, it has to be an Object, e.g. { ... } with valid Firebase Analytics log keys (important!). In native apps, the log keys are mapped through constants, for Titanium, I wanted to keep it flexible but still based on their requirements. The raw values are listed below each constant, e.g. ITEM_NAME equals item_name.

amigoni commented 6 years ago

Yep, it's gotta be one of those two then

amigoni commented 6 years ago

Ok but the second one is optional correct? It says on the doc optional arguments. Does it mean I have to at least send in an empty object? Or can I call the log function with just the first param?

hansemannn commented 6 years ago

I think the second one can be null, but I have not tested that.

amigoni commented 6 years ago

Just tested it. Need to send at least an empty object or it will crash.

hansemannn commented 6 years ago

Ok, I‘ll change the API to allow an empty parameter as well. Can this one be closed?

amigoni commented 6 years ago

Up to you. Only way for me to find out for sure is release and see if I am still getting the errors. My suspicion is that the error came from invalid attributes in the object as the second parameters. Probably releasing today. So will start having data in a couple of days. Thanks

hansemannn commented 6 years ago

Will keep open for now. The code change will also have to wait until more spare time available.

amigoni commented 6 years ago

Still getting this issue in the last version even with the adjustments made. I only fire log events if there is a eventName and i use an empty object as second param. Here is one of the error reported in the crashlogs.

backtrace:

00 pc 000000000000414c /data/app/com.fluidmarket.fluid-1/lib/arm/libfirebase.analytics.so (_ZN8titanium5Proxy7inheritIN8firebase9analytics31TitaniumFirebaseAnalyticsModuleEEEvRKN2v820FunctionCallbackInfoINS5_5ValueEEE+139)

01 pc 00000000000045ff /data/app/com.fluidmarket.fluid-1/lib/arm/libfirebase.analytics.so (_ZN8firebase9analytics31TitaniumFirebaseAnalyticsModule3logERKN2v820FunctionCallbackInfoINS2_5ValueEEE+138)

02 pc 0000000000598f18 /data/app/com.fluidmarket.fluid-1/lib/arm/libkroll-v8.so (_ZN2v88internal25FunctionCallbackArguments4CallEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEE+188)

03 pc 00000000005ebe78 /data/app/com.fluidmarket.fluid-1/lib/arm/libkroll-v8.so

04 pc 00000000005ec31c /data/app/com.fluidmarket.fluid-1/lib/arm/libkroll-v8.so

05 pc 00000000005ec5a8 /data/app/com.fluidmarket.fluid-1/lib/arm/libkroll-v8.so (_ZN2v88internal21Builtin_HandleApiCallEiPPNS0_6ObjectEPNS0_7IsolateE+44)

06 pc 0000000000000098

hansemannn commented 6 years ago

To confirm: The key of the event (1st parameter) is a valid Firebase event as well? E.g. first_open. Also note the general structure. It my be invalid to pass an empty dictionary, so I will update the API to allow both.

hansemannn commented 6 years ago

@amigoni Status here?

amigoni commented 6 years ago

Still getting the error, seems to be less frequent so I am going through the event names to verify that there is no conflicts.

hansemannn commented 6 years ago

@amigoni I'd like to fix or close this issue, can you give an update with latest versions of the module (v2.1.1)?

hansemannn commented 6 years ago

Closing due to inactivity.