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

App crashes on launch when deployed to Google Play #5619

Closed
Glomby opened this issue Feb 12, 2021 · 4 comments
Closed

App crashes on launch when deployed to Google Play #5619

Glomby opened this issue Feb 12, 2021 · 4 comments
Assignees
Labels
Area: App Runtime Issues in `libmonodroid.so`. possibly-stale Issues that are potentially no longer relevant.

Comments

@Glomby
Copy link

Glomby commented Feb 12, 2021

Steps to Reproduce

  1. Build release bundle
  2. Upload to Google Play Console internal Test Track
  3. Wait for Pre-Launch Tests to report crashes

I wasn't able to reproduce this crash on my end. Non of my physical devices or emulated devices have done this so far. I can download the App from the play store onto my physical devices and run it. I have not seen it crash like that. The pre-launch test crashes everytime though.

It would greatly help to understand the type of crash and maybe find a way to actually reproduce it on my end. Even downloading the .apks that Google Play generates and installing them manually on my physical devices has never caused a crash.

Expected Behavior

App launches successfully.

Actual Behavior

Crashes during Splash Screen

Version Information

Microsoft Visual Studio Professional 2019
Version 16.8.5
VisualStudio.16.Release/16.8.5+31005.135
Microsoft .NET Framework
Version 4.8.04084

Xamarin 16.8.000.262 (d16-8@4d60f9c)
Visual Studio-Erweiterung, um Entwicklung für Xamarin.iOS und Xamarin.Android zu ermöglichen.

Xamarin.Android SDK 11.1.0.26 (d16-8/a36ce73)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard@ebe9000
SQLite: xamarin/sqlite@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

Log File

All the crashes look pretty much the same and end up here: "..get_java_class_name_for_TypeManager(_jclass*)"

Here are two reports, but all the other crash reports I'm getting look pretty much the same.

Native Crash on Google Pixel 3 Android 9 (SDK 28)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/blueline/blueline:9/PQ3A.190801.002/5670241:user/release-keys'
Revision: 'MP1.0'
ABI: 'arm64'
pid: 15773, tid: 15773, name: com.Myapp  >>> com.Myapp<<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    x0  0000000000000000  x1  0000000000000000  x2  0000000000000000  x3  00000000000000e1
    x4  0000000000000000  x5  0000000000000305  x6  0000000000000006  x7  0000000000000010
    x8  0101010101010101  x9  4adfd1b7ed2e23e2  x10 0000000000430000  x11 000000000000000a
    x12 0000000000000002  x13 0000000000000001  x14 00000000000000a8  x15 000000000000000a
    x16 0000007f703f00f8  x17 0000007f7031f290  x18 0000000000000008  x19 0000000000000000
    x20 0000007eecae0460  x21 0000000000000000  x22 0000000000000000  x23 0000000000000099
    x24 0000000000000085  x25 0000007eecb30010  x26 0000000000000099  x27 0000000000000000
    x28 0000007f724255e0  x29 0000007fe01ad010
    sp  0000007fe01acff0  lr  0000007f7036f3b4  pc  0000007f7031f2a0
backtrace:
    #00 pc 000000000001e2a0  /system/lib64/libc.so (strlen+16)
    #01 pc 000000000006e3b0  /system/lib64/libc.so (strdup+20)
    #02 pc 000000000000d4e8  /data/app/com.Myapp-1lufsJe3FIZ0YHoEAB08KA==/split_config.arm64_v8a.apk (offset 0x165d000) (xamarin::android::internal::MonodroidRuntime::get_java_class_name_for_TypeManager(_jclass*)+92)
    #03 pc 000000000005f6d0  <anonymous:0000007ecc4ac000>

Or another crash on a Nokia 1 Android 8.1 (SDK27)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Nokia/Frontier_00WW/FRT:8.1.0/O11019/00WW_1_33A:user/release-keys'
Revision: '0'
ABI: 'arm'
pid: 17780, tid: 17780, name: com.Myapp>>> com.Myapp<<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    r0 00000000  r1 00000000  r2 00000000  r3 00000000
    r4 00000000  r5 a58a8460  r6 00000000  r7 00000000
    r8 80e9abd0  r9 a87fa1b8  sl be07a3f8  fp be079ff8
    ip a87f3594  sp be079ed8  lr a87ac4bb  pc a877ff44  cpsr 60070030
backtrace:
    #00 pc 00019f44  /system/lib/libc.so (strlen+71)
    #01 pc 000464b7  /system/lib/libc.so (strdup+4)
    #02 pc 00008d53  /data/app/com.Myapp-yCnicQ3tLYnQLajGbCzN3Q==/lib/arm/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::get_java_class_name_for_TypeManager(_jclass*)+50)
    #03 pc 00008dd8  <anonymous:a5e27000>

Full logcat for the crash on a google Pixel 3.
logcat.txt

@Glomby Glomby added the Area: App Runtime Issues in `libmonodroid.so`. label Feb 12, 2021
@jpobst jpobst added this to the Under Consideration milestone Feb 12, 2021
grendello added a commit to grendello/xamarin-android that referenced this issue Feb 12, 2021
Context: dotnet#5619

It appears that Xamarin.Android application uploaded to Google Console
internal Test Track can fail the pre-launch test because the
`MonodroidRuntime::get_java_class_name_for_TypeManager` method, can
sometimes get a `nullptr` Java class name from JNI:

    Build fingerprint: 'google/blueline/blueline:9/PQ3A.190801.002/5670241:user/release-keys'
    Revision: 'MP1.0'
    ABI: 'arm64'
    pid: 15773, tid: 15773, name: com.Myapp  >>> com.Myapp<<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    Cause: null pointer dereference
        x0  0000000000000000  x1  0000000000000000  x2  0000000000000000  x3  00000000000000e1
        x4  0000000000000000  x5  0000000000000305  x6  0000000000000006  x7  0000000000000010
        x8  0101010101010101  x9  4adfd1b7ed2e23e2  x10 0000000000430000  x11 000000000000000a
        x12 0000000000000002  x13 0000000000000001  x14 00000000000000a8  x15 000000000000000a
        x16 0000007f703f00f8  x17 0000007f7031f290  x18 0000000000000008  x19 0000000000000000
        x20 0000007eecae0460  x21 0000000000000000  x22 0000000000000000  x23 0000000000000099
        x24 0000000000000085  x25 0000007eecb30010  x26 0000000000000099  x27 0000000000000000
        x28 0000007f724255e0  x29 0000007fe01ad010
        sp  0000007fe01acff0  lr  0000007f7036f3b4  pc  0000007f7031f2a0
    backtrace:
        #00 pc 000000000001e2a0  /system/lib64/libc.so (strlen+16)
        #1 pc 000000000006e3b0  /system/lib64/libc.so (strdup+20)
        #2 pc 000000000000d4e8  /data/app/com.Myapp-1lufsJe3FIZ0YHoEAB08KA==/split_config.arm64_v8a.apk (offset 0x165d000) (xamarin::android::internal::MonodroidRuntime::get_java_class_name_for_TypeManager(_jclass*)+92)
        #3 pc 000000000005f6d0  <anonymous:0000007ecc4ac000>

This can happen if either one of the below points is true:

  1. The Java	[`Class.getName`](https://developer.android.com/reference/java/lang/Class?hl=en#getName())
     method is absent
  2. `Class.getName` returns `nullptr` (a nameless class?)
  3. `env->GetStringUTFChars` returns `nullptr` (a memory allocation
     failure?)

Out of these, 3. appears to be most probable and this commit adds a
check for a `nullptr` pointer there, failing gracefully instead of
segfaulting.  This is NOT a fix for the original problem as we don't
know by what it is caused but, nevertheless, the `nullptr` check should
be there.
@grendello
Copy link
Contributor

@Glomby the crash happens right in this code, however it would happen only if one of the items below were true:

  1. the Java Class.getName method is absent
  2. Class.getName returns nullptr (a nameless class?)
  3. env->GetStringUTFChars returns nullptr (a memory allocation failure?)

Out of these, I suspect 3., however unlikely it is. opened a PR to fail gracefully in this instance.

@Glomby
Copy link
Author

Glomby commented Feb 15, 2021

@grendello I just finished testing this fix. I wasn't able to build xamarin.android in the release configuration (only in debug) so I couldn't test it in die Google Play Console but as far as I know these tests are the same as the Firebase Test Lab Tests.

I still need to test this a little more but I haven't seen this crash so far and for the first time ever I was able to get a successful test result.

grendello added a commit to grendello/xamarin-android that referenced this issue Feb 16, 2021
Context: dotnet#5619

It appears that Xamarin.Android application uploaded to Google Console
internal Test Track can fail the pre-launch test because the
`MonodroidRuntime::get_java_class_name_for_TypeManager` method, can
sometimes get a `nullptr` Java class name from JNI:

    Build fingerprint: 'google/blueline/blueline:9/PQ3A.190801.002/5670241:user/release-keys'
    Revision: 'MP1.0'
    ABI: 'arm64'
    pid: 15773, tid: 15773, name: com.Myapp  >>> com.Myapp<<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    Cause: null pointer dereference
        x0  0000000000000000  x1  0000000000000000  x2  0000000000000000  x3  00000000000000e1
        x4  0000000000000000  x5  0000000000000305  x6  0000000000000006  x7  0000000000000010
        x8  0101010101010101  x9  4adfd1b7ed2e23e2  x10 0000000000430000  x11 000000000000000a
        x12 0000000000000002  x13 0000000000000001  x14 00000000000000a8  x15 000000000000000a
        x16 0000007f703f00f8  x17 0000007f7031f290  x18 0000000000000008  x19 0000000000000000
        x20 0000007eecae0460  x21 0000000000000000  x22 0000000000000000  x23 0000000000000099
        x24 0000000000000085  x25 0000007eecb30010  x26 0000000000000099  x27 0000000000000000
        x28 0000007f724255e0  x29 0000007fe01ad010
        sp  0000007fe01acff0  lr  0000007f7036f3b4  pc  0000007f7031f2a0
    backtrace:
        #00 pc 000000000001e2a0  /system/lib64/libc.so (strlen+16)
        #1 pc 000000000006e3b0  /system/lib64/libc.so (strdup+20)
        #2 pc 000000000000d4e8  /data/app/com.Myapp-1lufsJe3FIZ0YHoEAB08KA==/split_config.arm64_v8a.apk (offset 0x165d000) (xamarin::android::internal::MonodroidRuntime::get_java_class_name_for_TypeManager(_jclass*)+92)
        #3 pc 000000000005f6d0  <anonymous:0000007ecc4ac000>

This can happen if either one of the below points is true:

  1. The Java	[`Class.getName`](https://developer.android.com/reference/java/lang/Class?hl=en#getName())
     method is absent
  2. `Class.getName` returns `nullptr` (a nameless class?)
  3. `env->GetStringUTFChars` returns `nullptr` (a memory allocation
     failure?)

Out of these, 3. appears to be most probable and this commit adds a
check for a `nullptr` pointer there, failing gracefully instead of
segfaulting.  This is NOT a fix for the original problem as we don't
know by what it is caused but, nevertheless, the `nullptr` check should
be there.
jonpryor pushed a commit that referenced this issue Feb 18, 2021
…5623)

Context: #5619

It appears that Xamarin.Android application uploaded to
Google Play Console internal Test Track can fail the pre-launch test
because the `MonodroidRuntime::get_java_class_name_for_TypeManager()`
method can sometimes get a `nullptr` Java class name from JNI:

	Build fingerprint: 'google/blueline/blueline:9/PQ3A.190801.002/5670241:user/release-keys'
	Revision: 'MP1.0'
	ABI: 'arm64'
	pid: 15773, tid: 15773, name: com.Myapp  >>> com.Myapp<<<
	signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
	Cause: null pointer dereference
	    x0  0000000000000000  x1  0000000000000000  x2  0000000000000000  x3  00000000000000e1
	    x4  0000000000000000  x5  0000000000000305  x6  0000000000000006  x7  0000000000000010
	    x8  0101010101010101  x9  4adfd1b7ed2e23e2  x10 0000000000430000  x11 000000000000000a
	    x12 0000000000000002  x13 0000000000000001  x14 00000000000000a8  x15 000000000000000a
	    x16 0000007f703f00f8  x17 0000007f7031f290  x18 0000000000000008  x19 0000000000000000
	    x20 0000007eecae0460  x21 0000000000000000  x22 0000000000000000  x23 0000000000000099
	    x24 0000000000000085  x25 0000007eecb30010  x26 0000000000000099  x27 0000000000000000
	    x28 0000007f724255e0  x29 0000007fe01ad010
	    sp  0000007fe01acff0  lr  0000007f7036f3b4  pc  0000007f7031f2a0
	backtrace:
	    #00 pc 000000000001e2a0  /system/lib64/libc.so (strlen+16)
	    #1 pc 000000000006e3b0  /system/lib64/libc.so (strdup+20)
	    #2 pc 000000000000d4e8  /data/app/com.Myapp-1lufsJe3FIZ0YHoEAB08KA==/split_config.arm64_v8a.apk (offset 0x165d000) (xamarin::android::internal::MonodroidRuntime::get_java_class_name_for_TypeManager(_jclass*)+92)
	    #3 pc 000000000005f6d0  <anonymous:0000007ecc4ac000>

This can happen if either one of the below points is true:

 1. [`java.lang.Class.getName()`][0] returns `nullptr`
    (a nameless class?  This seems unlikely.)
 2. [`JNIEnv::GetStringUTFChars()`][1] returns `nullptr`
    (a memory allocation failure?)

Of these, (2) appears to be most probable; regardless, add appropriate
`nullptr` checks for each of them, failing gracefully instead of
segfaulting.

This is NOT a fix for the original problem as we don't know by what
it is caused but, nevertheless, the `nullptr` check should be there.

[0]: https://developer.android.com/reference/java/lang/Class?hl=en#getName()
[1]: https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#GetStringUTFChars
@jpobst jpobst added the possibly-stale Issues that are potentially no longer relevant. label Sep 6, 2022
@ghost
Copy link

ghost commented Sep 6, 2022

We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

@ghost
Copy link

ghost commented Sep 21, 2022

This issue will now be closed since it had been marked possibly-stale but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@ghost ghost closed this as completed Sep 21, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 21, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App Runtime Issues in `libmonodroid.so`. possibly-stale Issues that are potentially no longer relevant.
Projects
None yet
Development

No branches or pull requests

3 participants