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

JIT regression with Android+net6 P7 #55375

Closed
jonpryor opened this issue Jul 8, 2021 · 21 comments · Fixed by #55610
Closed

JIT regression with Android+net6 P7 #55375

jonpryor opened this issue Jul 8, 2021 · 21 comments · Fixed by #55610

Comments

@jonpryor
Copy link
Member

jonpryor commented Jul 8, 2021

Description

Context: dotnet/android#6072
Context: 02f70d0...0605bb3
Context: dotnet/linker@a07cab7...f574448

PR dotnet/android#6072 is a .NET 6 P7 SDK bump from dotnet/installer@e8b3b6be to dotnet/installer@bd5653f3, which includes dotnet/runtime changes in 02f70d0...0605bb3.

Changes within this commit range breaks one of our unit tests: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4952636&view=ms.vss-test-web.build-test-results-tab&runId=23305012&resultId=100052&paneView=debug

Java.Lang.RuntimeException : getNamespace() not supported
   at Java.Interop.JniEnvironment.InstanceMethods.CallObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) in Java.Interop.dll:token 0x6000326+0x6e
   at Android.Runtime.JNIEnv.CallObjectMethod(IntPtr , IntPtr , JValue* ) in Mono.Android.dll:token 0x6000a05+0xe
   at Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(String ) in Mono.Android.dll:token 0x60007de+0x52
   at Android.Runtime.XmlPullParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac8+0x3f
   at Android.Runtime.XmlResourceParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac4+0x0
   at Android.Runtime.XmlResourceParserReader.FromNative(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac7+0x3b
   at Android.Runtime.XmlResourceParserReader.FromJniHandle(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac6+0x0
   at Android.Content.Res.Resources.GetXml(Int32 ) in Mono.Android.dll:token 0x60007fc+0x36
   at Android.RuntimeTests.XmlReaderPullParserTest.ToLocalJniHandle() in Mono.Android.NET-Tests.dll:token 0x60000f3+0xa
   at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo ) in System.Private.CoreLib.dll:token 0x600274a+0x6a
  --- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: getNamespace() not supported
	at android.content.res.XmlBlock$Parser.getNamespace(XmlBlock.java:143)
	at crc643df67da7b13bb6b1.TestInstrumentation_1.n_onStart(Native Method)
	at crc643df67da7b13bb6b1.TestInstrumentation_1.onStart(Unknown Source:0)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

This failure only happens when the JIT is used. We have a "sibling" app which runs the same tests with the interpreter enabled, and those tests pass.

Repro steps:

  1. Configure an Android device.

  2. Download the test app: Mono.Android.NET_Tests-Signed.zip

  3. Rename Mono.Android.NET_Tests-Signed.zip to Mono.Android.NET_Tests-Signed.apk

  4. Install the app on your Android device:

    adb install Mono.Android.NET_Tests-Signed.apk
    
  5. In a new shell window, begin capturing adb logcat:

    adb logcat > log.txt
    
  6. Run the unit tests:

    $ adb shell am instrument  -e "exclude" "DotNetIgnore" -e "loglevel Verbose" -w "Mono.Android.NET_Tests/xamarin.android.runtimetests.NUnitInstrumentation"
    INSTRUMENTATION_RESULT: failed=3
    INSTRUMENTATION_RESULT: filtered=0
    INSTRUMENTATION_RESULT: inconclusive=0
    INSTRUMENTATION_RESULT: nunit2-results-path=/storage/emulated/0/Android/data/Mono.Android.NET_Tests/files/Documents/TestResults.NUnit.xml
    INSTRUMENTATION_RESULT: passed=772
    INSTRUMENTATION_RESULT: run=777
    INSTRUMENTATION_RESULT: skipped=2
    INSTRUMENTATION_RESULT: total=0
    INSTRUMENTATION_CODE: 0
    
  7. Read log.txt:

    E NUnit   :  : Java.Lang.RuntimeException : getNamespace() not supported
    E NUnit   :    at Java.Interop.JniEnvironment.InstanceMethods.CallObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) in Java.Interop.dll:token 0x6000326+0x6e
    E NUnit   :    at Android.Runtime.JNIEnv.CallObjectMethod(IntPtr , IntPtr , JValue* ) in Mono.Android.dll:token 0x6000a05+0xe
    E NUnit   :    at Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(String ) in Mono.Android.dll:token 0x60007de+0x52
    E NUnit   :    at Android.Runtime.XmlPullParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac8+0x3f
    E NUnit   :    at Android.Runtime.XmlResourceParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac4+0x0
    E NUnit   :    at Android.Runtime.XmlResourceParserReader.FromNative(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac7+0x3b
    E NUnit   :    at Android.Runtime.XmlResourceParserReader.FromJniHandle(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac6+0x0
    E NUnit   :    at Android.Content.Res.Resources.GetXml(Int32 ) in Mono.Android.dll:token 0x60007fc+0x36
    E NUnit   :    at Android.RuntimeTests.XmlReaderPullParserTest.ToLocalJniHandle() in Mono.Android.NET-Tests.dll:token 0x60000f3+0xa
    E NUnit   :    at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo ) in System.Private.CoreLib.dll:token 0x60027b0+0x6a
    E NUnit   :   --- End of managed Java.Lang.RuntimeException stack trace ---
    E NUnit   : java.lang.RuntimeException: getNamespace() not supported
    E NUnit   : 	at android.content.res.XmlBlock$Parser.getNamespace(XmlBlock.java:143)
    E NUnit   : 	at crc643df67da7b13bb6b1.TestInstrumentation_1.n_onStart(Native Method)
    E NUnit   : 	at crc643df67da7b13bb6b1.TestInstrumentation_1.onStart(Unknown Source:0)
    E NUnit   : 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
    

Of particular note -- revisited below -- is the call stack: unless some form of inlining or something is going on, that call stack isn't possible: the XmlPullParserReader(IJavaObject) constructor doesn't call .GetNamespace(). See the Other Information section for additional musings.

Configuration

  • Which version of .NET is the code running on? 0605bb3

  • What OS and version, and what distro if applicable? Android API-29 Emulator, as created by:

      avdmanager create avd --abi x86_64 --force --name XamarinAndroidTestRunner29-x86_64 --package "system-images;android-29;default;x86_64" --device pixel_4
    
  • What is the architecture (x64, x86, ARM, ARM64)? x64

  • Do you know whether it is specific to that configuration? No

Regression?

Yes. This was previously working with 02f70d0; see also dotnet/android@d593b72.

Other information

The original failing build may disappear, and someone will want access to the assemblies used in the test. Assemblies within the .apk are compressed. Here are the assemblies from the .apk, uncompressed: assemblies-uncompressed.zip

The unit test: https://github.com/xamarin/xamarin-android/blob/7c5fab13329ee898fb1562f83576a7ca881f2881/tests/Mono.Android-Tests/Android.Runtime/XmlReaderPullParserTest.cs#L18

Which calls:

This is where things get weird: in particular, note the body of the XmlPullParserReader(IJavaObject) constructor:

public XmlPullParserReader (IJavaObject source)
{
	this.source = (IXmlPullParser) source;
	supports_ns = this.source.GetFeature (XmlPullParser.FeatureProcessNamespaces);
	supports_ns_report_as_attr = this.source.GetFeature (XmlPullParser.FeatureReportNamespaceAttributes);
}

Note that the XmlPullParserReader(IJavaObject) constructor invokes a .GetFeature() method.

Recall again the stack trace in the failure:

E NUnit   :    at Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(String ) in Mono.Android.dll:token 0x60007de+0x52
E NUnit   :    at Android.Runtime.XmlPullParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac8+0x3f
E NUnit   :    at Android.Runtime.XmlResourceParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac4+0x0

Where is Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(string) coming from? There is no .GetNamespace() invocation, just .GetFeature().

(Also note that this test passes when using the interpreter. Mono.Android.NET_Tests-Interpreter-Signed.zip
Some of the assemblies within the interpreter-based .apk differ from those in the JIT-based .apk, but not Mono.Android.dll.)

"Fortunately", this is a linked app, so we can "just" disassemble Mono.Android.dll and find all occurrences of ::GetNamespace:

$ ikdasm Mono.Android.dll > Mono.Android.il
$ grep 'call.*::GetNamespace\>' Mono.Android.il
    IL_0011:  callvirt   instance string Org.XmlPull.V1.IXmlPullParser::GetNamespace(string)
    IL_0022:  callvirt   instance string Org.XmlPull.V1.IXmlPullParser::GetNamespace(string

One of those call sites is from XmlPullParserReader::GetAttribute(string, string). The other is from IXmlPullParserInvoker::n_GetNamespace_Ljava_lang_String_().

n_-prefixed methods are "JNI Marshal Methods"; they're called "by" Java, not by managed code. The only "normal" way it could appear is if Java were a calling stack frame. This is possible, but doesn't feel particularly plausible in this situation.

Which leaves XmlPullParserReader::GetAttribute(string, string), which only has two callers: XmlPullParserReader::GetAttribute(string) and XmlReaderPullParser::GetAttributeValue(string, string).

I can't easily reach a .GetNamespace() method from the ::GetAttribute() methods. (Maybe I gave up too soon?)

Thus, my conjecture: "something broke" in the JIT (02f70d0...0605bb3) which causes the post-linked IXmlPullParser::GetFeature(string) invocation to instead invoke a GetNamespace() method.

Unfortunately, nothing jumps out to me in the src/mono changes:

$ git log -p 02f70d0...0605bb3 src/mono

(Linker change could also be in play, but since the post-linked IL for XmlPullParserReader::.ctor() continues to contain a method invocation to IXmlPullParser::GetFeature(string), this seems less likely.)

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 8, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost
Copy link

ghost commented Jul 8, 2021

Tagging subscribers to 'arch-android': @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Context: dotnet/android#6072
Context: 02f70d0...0605bb3
Context: dotnet/linker@a07cab7...f574448

PR dotnet/android#6072 is a .NET 6 P7 SDK bump from dotnet/installer@e8b3b6be to dotnet/installer@bd5653f3, which includes dotnet/runtime changes in 02f70d0...0605bb3.

Changes within this commit range breaks one of our unit tests: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4952636&view=ms.vss-test-web.build-test-results-tab&runId=23305012&resultId=100052&paneView=debug

Java.Lang.RuntimeException : getNamespace() not supported
   at Java.Interop.JniEnvironment.InstanceMethods.CallObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) in Java.Interop.dll:token 0x6000326+0x6e
   at Android.Runtime.JNIEnv.CallObjectMethod(IntPtr , IntPtr , JValue* ) in Mono.Android.dll:token 0x6000a05+0xe
   at Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(String ) in Mono.Android.dll:token 0x60007de+0x52
   at Android.Runtime.XmlPullParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac8+0x3f
   at Android.Runtime.XmlResourceParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac4+0x0
   at Android.Runtime.XmlResourceParserReader.FromNative(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac7+0x3b
   at Android.Runtime.XmlResourceParserReader.FromJniHandle(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac6+0x0
   at Android.Content.Res.Resources.GetXml(Int32 ) in Mono.Android.dll:token 0x60007fc+0x36
   at Android.RuntimeTests.XmlReaderPullParserTest.ToLocalJniHandle() in Mono.Android.NET-Tests.dll:token 0x60000f3+0xa
   at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo ) in System.Private.CoreLib.dll:token 0x600274a+0x6a
  --- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: getNamespace() not supported
	at android.content.res.XmlBlock$Parser.getNamespace(XmlBlock.java:143)
	at crc643df67da7b13bb6b1.TestInstrumentation_1.n_onStart(Native Method)
	at crc643df67da7b13bb6b1.TestInstrumentation_1.onStart(Unknown Source:0)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

This failure only happens when the JIT is used. We have a "sibling" app which runs the same tests with the interpreter enabled, and those tests pass.

Repro steps:

  1. Configure an Android device.

  2. Download the test app: Mono.Android.NET_Tests-Signed.zip

  3. Rename Mono.Android.NET_Tests-Signed.zip to Mono.Android.NET_Tests-Signed.apk

  4. Install the app on your Android device:

    adb install Mono.Android.NET_Tests-Signed.apk
    
  5. In a new shell window, begin capturing adb logcat:

    adb logcat > log.txt
    
  6. Run the unit tests:

    $ adb shell am instrument  -e "exclude" "DotNetIgnore" -e "loglevel Verbose" -w "Mono.Android.NET_Tests/xamarin.android.runtimetests.NUnitInstrumentation"
    INSTRUMENTATION_RESULT: failed=3
    INSTRUMENTATION_RESULT: filtered=0
    INSTRUMENTATION_RESULT: inconclusive=0
    INSTRUMENTATION_RESULT: nunit2-results-path=/storage/emulated/0/Android/data/Mono.Android.NET_Tests/files/Documents/TestResults.NUnit.xml
    INSTRUMENTATION_RESULT: passed=772
    INSTRUMENTATION_RESULT: run=777
    INSTRUMENTATION_RESULT: skipped=2
    INSTRUMENTATION_RESULT: total=0
    INSTRUMENTATION_CODE: 0
    
  7. Read log.txt:

    E NUnit   :  : Java.Lang.RuntimeException : getNamespace() not supported
    E NUnit   :    at Java.Interop.JniEnvironment.InstanceMethods.CallObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) in Java.Interop.dll:token 0x6000326+0x6e
    E NUnit   :    at Android.Runtime.JNIEnv.CallObjectMethod(IntPtr , IntPtr , JValue* ) in Mono.Android.dll:token 0x6000a05+0xe
    E NUnit   :    at Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(String ) in Mono.Android.dll:token 0x60007de+0x52
    E NUnit   :    at Android.Runtime.XmlPullParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac8+0x3f
    E NUnit   :    at Android.Runtime.XmlResourceParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac4+0x0
    E NUnit   :    at Android.Runtime.XmlResourceParserReader.FromNative(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac7+0x3b
    E NUnit   :    at Android.Runtime.XmlResourceParserReader.FromJniHandle(IntPtr , JniHandleOwnership ) in Mono.Android.dll:token 0x6000ac6+0x0
    E NUnit   :    at Android.Content.Res.Resources.GetXml(Int32 ) in Mono.Android.dll:token 0x60007fc+0x36
    E NUnit   :    at Android.RuntimeTests.XmlReaderPullParserTest.ToLocalJniHandle() in Mono.Android.NET-Tests.dll:token 0x60000f3+0xa
    E NUnit   :    at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo ) in System.Private.CoreLib.dll:token 0x60027b0+0x6a
    E NUnit   :   --- End of managed Java.Lang.RuntimeException stack trace ---
    E NUnit   : java.lang.RuntimeException: getNamespace() not supported
    E NUnit   : 	at android.content.res.XmlBlock$Parser.getNamespace(XmlBlock.java:143)
    E NUnit   : 	at crc643df67da7b13bb6b1.TestInstrumentation_1.n_onStart(Native Method)
    E NUnit   : 	at crc643df67da7b13bb6b1.TestInstrumentation_1.onStart(Unknown Source:0)
    E NUnit   : 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)
    

Of particular note -- revisited below -- is the call stack: unless some form of inlining or something is going on, that call stack isn't possible: the XmlPullParserReader(IJavaObject) constructor doesn't call .GetNamespace(). See the Other Information section for additional musings.

Configuration

  • Which version of .NET is the code running on? 0605bb3

  • What OS and version, and what distro if applicable? Android API-29 Emulator, as created by:

      avdmanager create avd --abi x86_64 --force --name XamarinAndroidTestRunner29-x86_64 --package "system-images;android-29;default;x86_64" --device pixel_4
    
  • What is the architecture (x64, x86, ARM, ARM64)? x64

  • Do you know whether it is specific to that configuration? No

Regression?

Yes. This was previously working with 02f70d0; see also dotnet/android@d593b72.

Other information

The original failing build may disappear, and someone will want access to the assemblies used in the test. Assemblies within the .apk are compressed. Here are the assemblies from the .apk, uncompressed: assemblies-uncompressed.zip

The unit test: https://github.com/xamarin/xamarin-android/blob/7c5fab13329ee898fb1562f83576a7ca881f2881/tests/Mono.Android-Tests/Android.Runtime/XmlReaderPullParserTest.cs#L18

Which calls:

This is where things get weird: in particular, note the body of the XmlPullParserReader(IJavaObject) constructor:

public XmlPullParserReader (IJavaObject source)
{
	this.source = (IXmlPullParser) source;
	supports_ns = this.source.GetFeature (XmlPullParser.FeatureProcessNamespaces);
	supports_ns_report_as_attr = this.source.GetFeature (XmlPullParser.FeatureReportNamespaceAttributes);
}

Note that the XmlPullParserReader(IJavaObject) constructor invokes a .GetFeature() method.

Recall again the stack trace in the failure:

E NUnit   :    at Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(String ) in Mono.Android.dll:token 0x60007de+0x52
E NUnit   :    at Android.Runtime.XmlPullParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac8+0x3f
E NUnit   :    at Android.Runtime.XmlResourceParserReader..ctor(IJavaObject ) in Mono.Android.dll:token 0x6000ac4+0x0

Where is Android.Content.Res.IXmlResourceParserInvoker.GetNamespace(string) coming from? There is no .GetNamespace() invocation, just .GetFeature().

(Also note that this test passes when using the interpreter. Mono.Android.NET_Tests-Interpreter-Signed.zip
Some of the assemblies within the interpreter-based .apk differ from those in the JIT-based .apk, but not Mono.Android.dll.)

"Fortunately", this is a linked app, so we can "just" disassemble Mono.Android.dll and find all occurrences of ::GetNamespace:

$ ikdasm Mono.Android.dll > Mono.Android.il
$ grep 'call.*::GetNamespace\>' Mono.Android.il
    IL_0011:  callvirt   instance string Org.XmlPull.V1.IXmlPullParser::GetNamespace(string)
    IL_0022:  callvirt   instance string Org.XmlPull.V1.IXmlPullParser::GetNamespace(string

One of those call sites is from XmlPullParserReader::GetAttribute(string, string). The other is from IXmlPullParserInvoker::n_GetNamespace_Ljava_lang_String_().

n_-prefixed methods are "JNI Marshal Methods"; they're called "by" Java, not by managed code. The only "normal" way it could appear is if Java were a calling stack frame. This is possible, but doesn't feel particularly plausible in this situation.

Which leaves XmlPullParserReader::GetAttribute(string, string), which only has two callers: XmlPullParserReader::GetAttribute(string) and XmlReaderPullParser::GetAttributeValue(string, string).

I can't easily reach a .GetNamespace() method from the ::GetAttribute() methods. (Maybe I gave up too soon?)

Thus, my conjecture: "something broke" in the JIT (02f70d0...0605bb3) which causes the post-linked IXmlPullParser::GetFeature(string) invocation to instead invoke a GetNamespace() method.

Unfortunately, nothing jumps out to me in the src/mono changes:

$ git log -p 02f70d0...0605bb3 src/mono

(Linker change could also be in play, but since the post-linked IL for XmlPullParserReader::.ctor() continues to contain a method invocation to IXmlPullParser::GetFeature(string), this seems less likely.)

Author: jonpryor
Assignees: -
Labels:

os-android, untriaged

Milestone: -

@steveisok
Copy link
Member

/cc @SamMonoRT

@jonpryor
Copy link
Member Author

jonpryor commented Jul 8, 2021

Related: https://discord.com/channels/732297728826277939/732297837953679412/862827287343136839

I re-ran the suite with inlining disabled:

$ adb logcat > log.txt &
$ adb shell setprop debug.mono.runtime_args '"-O=-inline"'
$ adb shell am instrument  -e "exclude" "DotNetIgnore" -e "loglevel Verbose" -w "Mono.Android.NET_Tests/xamarin.android.runtimetests.NUnitInstrumentation"
INSTRUMENTATION_RESULT: failed=3
…

Using -O=-inline failed. Using -O=-all crashed:

* Assertion at /__w/1/s/src/mono/mono/metadata/object.c:562, condition `is_ok (error)' not met, function:mono_runtime_class_init_full, (null) assembly:System.Private.CoreLib.dll type:PlatformNotSupportedException member:(null)

…which was unexpected. Turns out, disabling lots of the optimizations also triggers the same assertion.

I was able to get -O=-abcrem,-inline,-leaf,-tailc,-sched,-copyprop,-consprop,-deadce,-cfold,-branch to not assert, but it did have test failures.

@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

Another idea which came to mind was to enable mono --trace:

$ adb logcat > trace.txt &
$ adb shell setprop debug.mono.trace all
$ time adb shell am instrument  -e "exclude" "DotNetIgnore" -e "loglevel Verbose" -w "Mono.Android.NET_Tests/xamarin.android.runtimetests.NUnitInstrumentation"

Unfortunately, this takes significantly longer to execute: 19 minutes:

adb shell am instrument -e "exclude" "DotNetIgnore" -e "loglevel Verbose" -w   0.00s user 0.00s system 0% cpu 18:49.35 total

It also produced a 758M log trace.txt file.

Looking for the ENTER:c trace messages:

$ grep ': ENTER:c' > enter.txt

we can find something that looks reasonable:

V mono    : ENTER:c Android.Content.Res.Resources:GetXml (int)(
…
V mono    : ENTER:c Android.Runtime.XmlResourceParserReader:FromJniHandle (intptr,Android.Runtime.JniHandleOwnership)(
V mono    : ENTER:c Android.Runtime.XmlResourceParserReader:FromNative (intptr,Android.Runtime.JniHandleOwnership)(
…
V mono    : ENTER:c Android.Content.Res.IXmlResourceParserInvoker:Validate (intptr)(
…
V mono    : ENTER:c Android.Runtime.XmlResourceParserReader:.ctor (Android.Runtime.IJavaObject)(
V mono    : ENTER:c Android.Runtime.XmlPullParserReader:.ctor (Android.Runtime.IJavaObject)(
…
V mono    : ENTER:c System.Xml.XmlReader:.ctor ()(
V mono    : ENTER:c Android.Content.Res.IXmlResourceParserInvoker:GetFeature (string)(
…
V mono    : ENTER:c Android.Content.Res.IXmlResourceParserInvoker:GetNamespace (string)(

Thing is, this does look weird. We have a .GetFeature() invocation, which is expected, but then we have a .GetNamespace() invocation, which isn't.

For context, the disassembled IL for XmlPullParserReader::.ctor():

  .method public hidebysig specialname rtspecialname 
          instance void  .ctor(class Android.Runtime.IJavaObject A_1) cil managed
  {
    // Code size       86 (0x56)
    .maxstack  3
    IL_0000:  ldarg.0
    IL_0001:  newobj     instance void [System.Private.Xml]System.Xml.NameTable::.ctor()
    IL_0006:  newobj     instance void [System.Private.Xml]System.Xml.XmlNamespaceManager::.ctor([System.Private.Xml]System.Xml.XmlNameTable)
    IL_000b:  stfld      [System.Private.Xml]System.Xml.XmlNamespaceManager Android.Runtime.XmlPullParserReader::nsmgr
    IL_0010:  ldarg.0
    IL_0011:  ldc.i4.m1
    IL_0012:  stfld      int32 Android.Runtime.XmlPullParserReader::attr_pos
    IL_0017:  ldarg.0
    IL_0018:  call       instance void [System.Private.Xml]System.Xml.XmlReader::.ctor()
    IL_001d:  ldarg.0
    IL_001e:  ldarg.1
    IL_001f:  castclass  Org.XmlPull.V1.IXmlPullParser
    IL_0024:  stfld      class Org.XmlPull.V1.IXmlPullParser Android.Runtime.XmlPullParserReader::source
    IL_0029:  ldarg.0
    IL_002a:  ldarg.0
    IL_002b:  ldfld      class Org.XmlPull.V1.IXmlPullParser Android.Runtime.XmlPullParserReader::source
    IL_0030:  ldstr      "http://xmlpull.org/v1/doc/features.html#process-namespaces"
    IL_0035:  callvirt   instance bool Org.XmlPull.V1.IXmlPullParser::GetFeature(string)
    IL_003a:  stfld      bool Android.Runtime.XmlPullParserReader::supports_ns
    IL_003f:  ldarg.0
    IL_0040:  ldarg.0
    IL_0041:  ldfld      class Org.XmlPull.V1.IXmlPullParser Android.Runtime.XmlPullParserReader::source
    IL_0046:  ldstr      "http://xmlpull.org/v1/doc/features.html#report-namespace-prefixes"
    IL_004b:  callvirt   instance bool Org.XmlPull.V1.IXmlPullParser::GetFeature(string)
    IL_0050:  stfld      bool Android.Runtime.XmlPullParserReader::supports_ns_report_as_attr
    IL_0055:  ret
  } // end of method XmlPullParserReader::.ctor

IL shows a .GetFeature("http://xmlpull.org/v1/doc/features.html#process-namespaces") invocation, which trace.txt has:

# Call .GetFeature():
V mono    : ENTER:c Android.Content.Res.IXmlResourceParserInvoker:GetFeature (string)(
V mono    : this:0x7418001798[Android.Content.Res.IXmlResourceParserInvoker RootDomain]
V mono    : , 
V mono    : [STRING:0x7415ecc8b0:http://xmlpull.org/v1/doc/features.html#process-namespaces]
V mono    : )
…

## JNI method lookup
V mono    : [0x7414c75cc0: 86.95301 42] 
V mono    : ENTER:c Android.Runtime.JNIEnv:GetMethodID (intptr,string,string)(
V mono    : 0x31a2
V mono    : , 
V mono    : [STRING:0x7415ed8be0:getFeature]
V mono    : , 
V mono    : [STRING:0x7415ee0c30:(Ljava/lang/String;)Z]
V mono    : )
…

## Parameter Marshaling
V mono    : ENTER:c Android.Runtime.JNIEnv:NewString (string)(
V mono    : [STRING:0x7415ecc8b0:http://xmlpull.org/v1/doc/features.html#process-namespaces]
…

## JNI method invocation
V mono    : ENTER:c Android.Runtime.JNIEnv:CallBooleanMethod (intptr,intptr,Android.Runtime.JValue*)(

All is well and good.

But then!

V mono    : ENTER:c Android.Content.Res.IXmlResourceParserInvoker:GetNamespace (string)(
V mono    : this:0x7418001798[Android.Content.Res.IXmlResourceParserInvoker RootDomain]
V mono    : , 
V mono    : [STRING:0x7415ecc950:http://xmlpull.org/v1/doc/features.html#report-namespace-prefixes]
V mono    : )

huh?

As per the IL shown above, after the first .GetFeature(), we expect a second .GetFeature("http://xmlpull.org/v1/doc/features.html#report-namespace-prefixes") invocation. Here, we see the same string parameter value -- http://xmlpull.org/v1/doc/features.html#report-namespace-prefixes -- but passed into a GetNamespace() method, not GetFeature()!

"Verifying" this, enter.txt contains only one Android.Content.Res.IXmlResourceParserInvoker:GetFeature, when there should be two.

Additionally, the this pointer value corresponding to XmlPullParserReader::source is the same for both ENTER:c trace messages: this:0x7418001798.

Somehow, the second .GetFeature() invocation is translated into .GetNamespace(). This is why the test fails.

jonpryor added a commit to dotnet/android that referenced this issue Jul 9, 2021
Context: dotnet/runtime#55375

There are lots of tests in `tests/Mono.Android-Tests`, but only two
tests are failing.

Add a `[Category("dotnet-runtime-55375")]` to the failing tests so
that we can more easily execute *just* the tests in question:

	adb shell am instrument -e include dotnet-runtime-55375 -e loglevel Verbose -w Mono.Android.NET_Tests/xamarin.android.runtimetests.NUnitInstrumentation
jonpryor added a commit to dotnet/android that referenced this issue Jul 9, 2021
@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

@vargaz suggestion to disable the linker worked: the unit tests pass when linking is disabled. This suggests something in here is responsible for the breakage: dotnet/linker@a07cab7...f574448

This still confuses me, because it suggests that perhaps I can't rely on ikdasm output...?

jonpryor added a commit to dotnet/android that referenced this issue Jul 9, 2021
Context: dotnet/runtime#55375 (comment)

This reverts commit 004725d.

> Disable the linker, and lets see what happens!

What happens is…all the tests pass!

Which suggests that this *is* a linker-related (adjacent?) issue,
*not* a JIT issue, as I had previously believed.

(I still don't understand *how* it's linker-related, and now I have
to wonder if I can't "believe" the output of `ikdasm`, which is an
equally troubling thought…)

Re-enable the linker, so that tests once again *fail*.
(I'm also not able to repro the crash locally, so if I want to
further explore things, exploring CI output is the only path forward.)
jonpryor added a commit to dotnet/android that referenced this issue Jul 9, 2021
This reverts commit 5062dd8.

Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=4963171&view=results
Context: #6072 (comment)

I *thought* that re-enabling the linker (23310da) would cause the
unit tests to once again start failing.

The **APKs .NET** tests are *passing*.  Meaning
`Android.RuntimeTests.XmlReaderPullParserTest.ToLocalJniHandle()`
is now *passing*.

I had thought this was due to the linker, but could it instead be due
to commit 5062dd8?

Revert 5062dd8; let's see if it once again breaks.

*Locally*, `XmlReaderPullParserTest.ToLocalJniHandle()` fails when
commit 5062dd88is not applied.
@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

…and I'm wrong. Disabling the linker isn't what made the tests pass. Adding [Category] is what made the tests pass: dotnet/android@5062dd8

The fact that adding a [Category] attribute would prevent the tests from running doesn't make sense to me.

@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

I'm now able to repro locally. (Yay.). Disabling the linker does not fix the issue. I do not think that this is related to linker behavior.

@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

New, easier, repro steps!

  1. Download scratch.getxml.zip and extract

  2. Build + install

    cd path/to/scratch.getxml
    dotnet build /t:Install scratch.getxml.csproj
    
  3. Start Your Logcat Capture

    adb logcat > log.txt
    
  4. Run!

    cd path/to/scratch.getxml
    dotnet run 
    # ~or~
    adb shell am start-activity scratch.getxml/my.Activity
    

Expected results: no crash!

Actual results: crash!

See log.txt from Step (3) for details:

AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{scratch.getxml/my.Activity}: java.lang.RuntimeException: getNamespace() not supported
AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3431)
AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
AndroidRuntime:        at android.os.Looper.loop(Looper.java:223)
AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7660)
AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
AndroidRuntime: Caused by: java.lang.RuntimeException: getNamespace() not supported
AndroidRuntime:        at android.content.res.XmlBlock$Parser.getNamespace(XmlBlock.java:143)
AndroidRuntime:        at my.Activity.n_onCreate(Native Method)
AndroidRuntime:        at my.Activity.onCreate(Activity.java:29)
AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8000)
AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7984)
AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3404)
AndroidRuntime:        ... 11 more

@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

Note that the new and improved and simpler repro also fails when the linker is disabled ($(AndroidLinkMode)=None).

@jonpryor
Copy link
Member Author

jonpryor commented Jul 9, 2021

Now that it's smaller, trace output should be more reasonable, right?

adb logcat -c
adb logcat > trace.txt &
adb shell setprop debug.mono.trace all
adb shell am start-activity scratch.getxml/my.Activity
adb shell setprop debug.mono.trace '""'

Results in a much more "reasonable" 13 MB trace file, in case that's of interest: trace.zip

@vargaz had previously suggested disabling inlining. Previously, using -O=-inline crashed. Now, it doesn't. It still fails though:

adb shell setprop debug.mono.runtime_args '"-O=-inline"'
adb logcat > log.txt &
adb shell am start-activity scratch.getxml/my.Activity
# check `log.txt` for details

@SamMonoRT SamMonoRT added this to the 6.0.0 milestone Jul 12, 2021
@marek-safar marek-safar removed the untriaged New issue has not been triaged by the area owner label Jul 12, 2021
@steveisok
Copy link
Member

@vargaz is this something you can take a look at?

@vargaz
Copy link
Contributor

vargaz commented Jul 12, 2021

I would suspect 5b337cb

@vargaz
Copy link
Contributor

vargaz commented Jul 12, 2021

[
libs.tar.gz
](url)

@jonpryor
Copy link
Member Author

@vargaz : thanks!

Unfortunately, fix.so doesn't fix the crash. :-(

My repro steps:

cp $HOME/.nuget/packages/microsoft.netcore.app.runtime.mono.android-arm64/6.0.0-preview.7.21352.16/runtimes/android-arm64/native/libmonosgen-2.0.so $HOME/.nuget/packages/microsoft.netcore.app.runtime.mono.android-arm64/6.0.0-preview.7.21352.16/runtimes/android-arm64/native/libmonosgen-2.0.so.orig

cp ~/Downloads/good.so $HOME/.nuget/packages/microsoft.netcore.app.runtime.mono.android-arm64/6.0.0-preview.7.21352.16/runtimes/android-arm64/native/libmonosgen-2.0.so

# try good.so:
cd path/to/scratch.getxml
rm -Rf bin obj
~/android-toolchain/dotnet/dotnet build /t:Install
adb shell am start-activity scratch.getxml/my.Activity
## result: no crash. Yay!

# verify w/ bad.so
cp ~/Downloads/bad.so $HOME/.nuget/packages/microsoft.netcore.app.runtime.mono.android-arm64/6.0.0-preview.7.21352.16/runtimes/android-arm64/native/libmonosgen-2.0.so
rm -Rf bin obj
~/android-toolchain/dotnet/dotnet build /t:Install
adb shell am start-activity scratch.getxml/my.Activity
## result: crashes.  Good sanity check!

# Try fix.so
cp ~/Downloads/fix.so $HOME/.nuget/packages/microsoft.netcore.app.runtime.mono.android-arm64/6.0.0-preview.7.21352.16/runtimes/android-arm64/native/libmonosgen-2.0.so
rm -Rf bin obj
~/android-toolchain/dotnet/dotnet build /t:Install
adb shell am start-activity scratch.getxml/my.Activity
## result: crashes.  :-(

@jonpryor
Copy link
Member Author

@vargaz provided additional native libs to try: https://www.dropbox.com/s/d1k8kprxorhbb85/libs-2.tar.gz?dl=0
https://discord.com/channels/732297728826277939/732297837953679412/864335739659878441

Results:

  • 1.so: works
  • 2.so: works
  • 3.so: works
  • 4.so: crashes
  • 5.so: crashes

@vargaz
Copy link
Contributor

vargaz commented Jul 13, 2021

libs-3.tar.gz

@jonpryor
Copy link
Member Author

jonpryor commented Jul 13, 2021

Using the latest libs-3.tar.gz

  • 6.so: crashed, but with an abort!

    W monodroid: MonodroidRuntime::monodroid_dlopen ("libmono-component-diagnostics_tracing.so", 0x2, 0x7fc13eb968, 0x0)
    E scratch.getxml: * Assertion at /Users/vargaz/git/runtime/src/mono/mono/mini/mini-codegen.c:1156, condition `MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC)[OP_LAST - OP_LOAD] == 0xffff' not met
    …
    F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 21414 (scratch.getxml), pid 21414 (scratch.getxml)
    F DEBUG   :       #00 pc 000000000004e178  /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) (BuildId: 47a9ba0d54d9614053e13adab1207062)
    F DEBUG   :       #01 pc 0000000000027e44  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::mono_log_handler(char const*, char const*, char const*, int, void*)+144) (BuildId: 86a5024f94723fa32c5f6b940455366f77af4cf9)
    F DEBUG   :       #02 pc 0000000000187848  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (eglib_log_adapter+128) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #03 pc 0000000000430d4c  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (monoeg_g_logstr+104) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #04 pc 00000000004306f8  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (monoeg_g_logv_nofree+200) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #05 pc 00000000004308c8  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (monoeg_assertion_message+164) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #06 pc 0000000000430938  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_assertion_message+48) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #07 pc 0000000000348f14  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_local_regalloc+348) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #08 pc 000000000024e064  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_codegen+168) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #09 pc 0000000000251018  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mini_method_compile+8776) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #10 pc 0000000000254e38  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_jit_compile_method_inner+204) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #11 pc 000000000025bd70  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_jit_compile_method_with_opt+1796) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #12 pc 000000000025c154  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_jit_compile_method_jit_only+84) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #13 pc 000000000025ed8c  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_jit_runtime_invoke+512) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #14 pc 00000000000e6594  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (do_runtime_invoke+204) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #15 pc 00000000000e0ec4  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_runtime_invoke_checked+108) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #16 pc 00000000000e0f50  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_runtime_invoke_handle_void+124) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #17 pc 000000000006cbc4  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (create_except:
    F DEBUG   :       #18 pc 000000000006c84c  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_exception_from_name_two_strings_checked+180) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #19 pc 00000000000327c8  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (create_domain_objects+1012) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #20 pc 0000000000031f14  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_runtime_init_checked+508) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #21 pc 000000000025e348  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mini_init+1892) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #22 pc 0000000000308a6c  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonosgen-2.0.so (mono_jit_init_version+44) (BuildId: d833f5e06d1c8f1fee1d7d1dacf0f972b0b4e6f3)
    F DEBUG   :       #23 pc 000000000001ef04  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::create_domain(_JNIEnv*, xamarin::android::jstring_array_wrapper&, bool)+248) (BuildId: 86a5024f94723fa32c5f6b940455366f77af4cf9)
    F DEBUG   :       #24 pc 00000000000203ec  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::create_and_initialize_domain(_JNIEnv*, _jclass*, xamarin::android::jstring_array_wrapper&, xamarin::android::jstring_array_wrapper&, _jobjectArray*, xamarin::android::jstring_array_wrapper&, _jobject*, bool, bool)+48) (BuildId: 86a5024f94723fa32c5f6b940455366f77af4cf9)
    F DEBUG   :       #25 pc 0000000000021d78  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::Java_mono_android_Runtime_initInternal(_JNIEnv*, _jclass*, _jstring*, _jobjectArray*, _jstring*, _jobjectArray*, _jobject*, _jobjectArray*, int, unsigned char)+5244) (BuildId: 86a5024f94723fa32c5f6b940455366f77af4cf9)
    F DEBUG   :       #26 pc 00000000000221bc  /data/app/~~K53iwn58qyKpLCxJU9ompA==/scratch.getxml-KxQfLZZxWtBi35k-1G7Wig==/lib/arm64/libmonodroid.so (Java_mono_android_Runtime_initInternal+72) (BuildId: 86a5024f94723fa32c5f6b940455366f77af4cf9)
    F DEBUG   :       #27 pc 000000000013ced4  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: aeb876e57f112c8539df5053f2da77d4)
    F DEBUG   :       #28 pc 00000000001337e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: aeb876e57f112c8539df5053f2da77d4)
    …
    
  • 7.so: ~same crash as 6.so.

Which raises a terrible thought: previously, I was only checking to see if the app launched or not. I wasn't checking adb logcat to see the kind of crash. So…

  • 4.so: Crash with .getNamespace().
  • 5.so: Native crash within xamarin::android::internal::MonodroidRuntime::mono_log_handler(), as with 6.so, above.

@vargaz
Copy link
Contributor

vargaz commented Jul 13, 2021

4-corelib.dll.gz

@jonpryor
Copy link
Member Author

Using the most recently provided System.Private.CoreLib.dll:

  • 5.so: crashes with our expected .getNamespace() failure. Yay!

  • 6.so: Crashes with our unexpected assert: :-(

    E scratch.getxml: * Assertion at /Users/vargaz/git/runtime/src/mono/mono/mini/mini-codegen.c:1156, condition `MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC)[OP_LAST - OP_LOAD] == 0xffff' not met
    
  • 7.so: Same assertion failure as 6.so.

vargaz added a commit to vargaz/runtime that referenced this issue Jul 13, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 13, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 14, 2021
@vargaz
Copy link
Contributor

vargaz commented Jul 14, 2021

Should be fixed now, please verify with newer packages.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants