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

FATAL EXCEPTION: java.lang.ArrayIndexOutOfBoundsException: com.google.protobuf.MessageSchema.newSchemaForRawMessageInfo #2158

Closed
stephaniemulder opened this issue Nov 7, 2020 · 13 comments
Assignees

Comments

@stephaniemulder
Copy link

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1
  • Firebase Component: Firebase Performance (Database, Firestore, Storage, Functions, etc)
  • Component version: 26.0.0

[REQUIRED] Step 3: Describe the problem

App crashes consistently on adding Firebase performance monitoring

implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-perf'

Steps to reproduce:

Create any activity with both the protobuff and firebase plugin
apply plugin: 'com.google.protobuf'
apply plugin: 'com.google.firebase.firebase-perf'
What happened? How can we make the problem occur?

 java.lang.ArrayIndexOutOfBoundsException: length=4; index=4
        at com.google.protobuf.MessageSchema.newSchemaForRawMessageInfo(MessageSchema.java:507)
        at com.google.protobuf.MessageSchema.newSchema(MessageSchema.java:227)
        at com.google.protobuf.ManifestSchemaFactory.newSchema(ManifestSchemaFactory.java:77)
        at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:71)
        at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
        at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
        at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
        at com.google.protobuf.GeneratedMessageLite$Builder.buildPartial(GeneratedMessageLite.java:395)
        at com.google.protobuf.GeneratedMessageLite$Builder.build(GeneratedMessageLite.java:403)
        at com.google.firebase.perf.v1.ApplicationInfo$Builder.setAndroidAppInfo(ApplicationInfo.java:934)
        at com.google.firebase.perf.internal.FirebasePerfClearcutLogger.syncInit(FirebasePerfClearcutLogger.java:278)
        at com.google.firebase.perf.internal.FirebasePerfClearcutLogger.access$000(FirebasePerfClearcutLogger.java:62)
        at com.google.firebase.perf.internal.FirebasePerfClearcutLogger$1.run(FirebasePerfClearcutLogger.java:169)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
2020-11-07 19:55:34.998 16553-16619/? I/Process: Sending signal. PID: 16553 SIG: 9

The Firebase analytics works fine, the problem start as soon as adding the **Firebase Performance **

Relevant Code:

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
}
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@nargroves
Copy link

nargroves commented Nov 9, 2020

We are seeing the same issue with the same stack trace. In our case, we aren't using the firebase bom yet. Here are our version numbers:

'firebaseCore'       : '18.0.0',
'firebaseAnalytics'  : '18.0.0',
'firebaseMessaging'  : '21.0.0',
'firebasePerf'       : '19.0.9',
'firebaseConfig'     : '20.0.0'

*** Edit ***
Just tested with the bom and see the same issue

@SaqibJDev
Copy link

In my case one of my dependency was using com.google.protobuf:protobuf-javalite:3.13.0 whereas firebase pref uses com.google.protobuf:protobuf-javalite:3.11.0. Excluding the 3.13.0 fixed the issue for firebase. But I think firebase should update to protobuf-javalite:3.13.0

@ramanpreetSinghKhinda
Copy link
Contributor

Assigning to current oncallers.

@kim-f
Copy link

kim-f commented Nov 20, 2020

I haven't yet been able to reproduce this issue, but am still working on it. I'll let you know if we need any additional information.

Optional: While not required, it would be helpful to have a repro demo project.

Note: this is being tracked internally at b/173728277.

Thank you for reporting this issue!

@XabierGoros
Copy link

XabierGoros commented Nov 24, 2020

The error is still happening on the latest com.google.firebase:firebase-bom:26.1.0 (which uses com.google.firebase:firebase-perf-ktx:19.0.10).

@XabierGoros
Copy link

As @SaqibJDev pointed out, forcing its version may work, at least for me:

implementation("com.google.protobuf:protobuf-javalite") {
    version {
        strictly '3.11.0'
    }
}

However, it would be desirable to update the library with a newer protobuf-javalite version.

@yingdai3
Copy link

Thanks. vkryachko@, can you take a look and see if we can update protobuf-javalite version?

@vkryachko
Copy link
Member

@yingdai3 firebase-perf 19.0.10 already depends on protobuf-javalite:3.11.0.

I wonder if some other dependency in the developer's app "bumps" the version to an incompatible one?

@XabierGoros
Copy link

@vkryachko sure thing firebase depends on protobuf-javalite:3.11.0, and in my case, other dependency with a min required version of protobuf-javalite:3.12.0 was referenced in the project making firebase library crash while it shouldn't.

@vkryachko
Copy link
Member

I can reproduce the problem with 3.12.0 although I have a different stacktrace:

     Caused by: java.lang.ClassCastException: com.google.protobuf.MapEntryLite cannot be cast to java.lang.String
        at com.google.protobuf.MessageSchema.newSchemaForRawMessageInfo(MessageSchema.java:507)
        at com.google.protobuf.MessageSchema.newSchema(MessageSchema.java:227)
        at com.google.protobuf.ManifestSchemaFactory.newSchema(ManifestSchemaFactory.java:77)
        at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:71)
        at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:93)
        at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:107)
        at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:175)
        at com.google.protobuf.GeneratedMessageLite$Builder.buildPartial(GeneratedMessageLite.java:395)
        at com.google.protobuf.GeneratedMessageLite$Builder.build(GeneratedMessageLite.java:403)
        at com.google.firebase.perf.metrics.AppStartTrace.onActivityResumed(AppStartTrace.java:214)
        at android.app.Application.dispatchActivityResumed(Application.java:436)
        at android.app.Activity.dispatchActivityResumed(Activity.java:1265)
        at android.app.Activity.onResume(Activity.java:1789)
        at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:456)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1446)
        at android.app.Activity.performResume(Activity.java:7939)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4195)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4237) 
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) 
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:214) 
        at android.app.ActivityThread.main(ActivityThread.java:7356) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) 

The only mitigation for now is to force downgrade as described in #2158 (comment)
Short term we will upgrade all SDKs to the latest protobuf-javalite, but mid/long term we will remove the protobuf dependency altogether as it does not follow semver and is not binary compatible across releases.

@XabierGoros
Copy link

Thanks a lot @vkryachko, that would help us so much. And if you guys add gRPC client network monitoring support in the near future, even much better! 😉 (already filled the feature request to your support team)

@yingdai3
Copy link

Thanks @vkryachko and @XabierGoros !

@XabierGoros I'm going to close this issue now since there is a mitigation and we have mid/long term plans.

yifanyang added a commit that referenced this issue Dec 9, 2020
- Explicitly depends on annotations to uplift auth's dependency on annotations.
- Remove messaging test and fireperf test from the smoke test suite.
  - Restore messaging test once messaging src in github is up to date.
  - Restore fireperf test once M85 release is live (#2158).
@firebase firebase locked and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants