Skip to content

Rare crash on startup #52

@pfleeter

Description

@pfleeter

We are using Unity 2017.4.4 and have a user on Android 8 that was able to send us this log. As best I can make out, it looks like NewGlobalRef is failing because the reference being passed in is already invalid somehow.

07-13 16:20:35.402  2604  2635 F zygote  : indirect_reference_table.cc:58] JNI ERROR (app bug): accessed deleted Global 0x2c86

07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514] Runtime aborting...
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514] Aborting thread:
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514] "UnityMain" prio=5 tid=13 Runnable
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | group="" sCount=0 dsCount=0 flags=4 obj=0x12c41270 self=0xd50d4600
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | sysTid=2635 nice=0 cgrp=default sched=0/0 handle=0xc76ff970
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | state=R schedstat=( 1530772739 28633897 1766 ) utm=136 stm=17 core=5 HZ=100
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | stack=0xc75fd000-0xc75ff000 stackSize=1038KB
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   | held mutexes= "abort lock" "mutator lock"(shared held)

07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #00 pc 002c521f  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+130)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #01 pc 00356cd1  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+200)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #02 pc 003531a3  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+34)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #03 pc 00343b9d  /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+28)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #04 pc 0034397f  /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+346)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #05 pc 00338877  /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+110)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #06 pc 00338f7f  /system/lib/libart.so (_ZN3art7Runtime7AborterEPKc+10)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #07 pc 003effad  /system/lib/libart.so (_ZN7android4base10LogMessageD1Ev+456)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #08 pc 001c8757  /system/lib/libart.so (_ZN3art22IndirectReferenceTable17AbortIfNoCheckJNIERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE+166)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #09 pc 00234c63  /system/lib/libart.so (_ZNK3art22IndirectReferenceTable10GetCheckedEPv+266)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #10 pc 0023145b  /system/lib/libart.so (_ZN3art9JavaVMExt12DecodeGlobalEPv+10)
07-13 16:20:35.693  2604  2635 F zygote  : runtime.cc:514]   native: #11 pc 0035ab4b  /system/lib/libart.so (_ZNK3art6Thread13DecodeJObjectEP8_jobject+162)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #12 pc 0025fdf3  /system/lib/libart.so (_ZN3art3JNI12NewGlobalRefEP7_JNIEnvP8_jobject+374)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #13 pc 000064c5  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignIn16GoogleSignInImplC2EP8_jobject+32)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #14 pc 00006ac7  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libnative-googlesignin.so (_ZN12googlesignin12GoogleSignInC1EP8_jobject+22)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #15 pc 0000616b  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libnative-googlesignin.so (GoogleSignIn_Create+30)
07-13 16:20:35.694  2604  2635 F zygote  : runtime.cc:514]   native: #16 pc 0211ce54  /data/app/com.thirdtime.photofinishtwo-K8CqbIHzxiIdyy0X4xOY9g==/lib/arm/libil2cpp.so (???)

Activity

pfleeter

pfleeter commented on Jul 14, 2018

@pfleeter
Author

Could it be that the helper class is garbage collected before it's global reference is created?

I'm not very familiar with this type of JNI coding, but I read here that, "Local references become invalid when the execution returns from the native method in which the local reference is created."

So maybe there is a small window for problems, and the Global Ref needs to be created before FindClass returns.

  if (!helper_clazz_) {
    // Find the java  helper class and initialize it.
    helper_clazz_ = FindClass(HELPER_CLASSNAME, activity);

    assert(helper_clazz_);

    if (helper_clazz_) {
      helper_clazz_ = (jclass)env->NewGlobalRef(helper_clazz_);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pfleeter

        Issue actions

          Rare crash on startup · Issue #52 · googlesamples/google-signin-unity