sentry-unity icon indicating copy to clipboard operation
sentry-unity copied to clipboard

Unity 2021 + Android API 30 Smoke test crash

Open vaind opened this issue 2 years ago • 4 comments

After splitting the Android smoke test build into a separate job and running it via the integration-test scripts (i.e. create empty project, build, add unity, build, test) in PR #686, the "smoke-test" part of the test now consistently crashes the app in CI (not reproducible locally yet) when run a Unity 2021 build on Android API 30 x86 emulator - for example, see this run: https://github.com/getsentry/sentry-unity/runs/6227149023?check_suite_focus=true

--------- beginning of crash
04-29 11:22:58.137  3521  3554 E AndroidRuntime: FATAL EXCEPTION: UnityMain
04-29 11:22:58.137  3521  3554 E AndroidRuntime: Process: com.DefaultCompany.IntegrationTest, PID: 3521
04-29 11:22:58.137  3521  3554 E AndroidRuntime: java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-29 11:22:58.137  3521  3554 E AndroidRuntime: Version '2021.3.1f1 (3b70a0754835)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'x86'
04-29 11:22:58.137  3521  3554 E AndroidRuntime: Build fingerprint: 'Android/sdk_phone_x86/generic_x86:11/RSR1.210210.001.A1/7193139:userdebug/dev-keys'
04-29 11:22:58.137  3521  3554 E AndroidRuntime: Revision: '0'
04-29 11:22:58.137  3521  3554 E AndroidRuntime: ABI: 'x86'
04-29 11:22:58.137  3521  3554 E AndroidRuntime: Timestamp: 2022-04-29 11:22:56+0000
04-29 11:22:58.137  3521  3554 E AndroidRuntime: pid: 3521, tid: 3554, name: UnityMain  >>> com.DefaultCompany.IntegrationTest <<<
04-29 11:22:58.137  3521  3554 E AndroidRuntime: uid: 10121
04-29 11:22:58.137  3521  3554 E AndroidRuntime: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x6c0000
04-29 11:22:58.137  3521  3554 E AndroidRuntime:     eax 00000000  ebx 00006000  ecx 00003f00  edx 006c0000
04-29 11:22:58.137  3521  3554 E AndroidRuntime:     edi 00004000  esi bbb23ff0
04-29 11:22:58.137  3521  3554 E AndroidRuntime:     ebp bd7bf3d8  esp bd7bf394  eip ee02a939
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 
04-29 11:22:58.137  3521  3554 E AndroidRuntime: backtrace:
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #00 pc 00055939  /apex/com.android.runtime/lib/bionic/libc.so (wcscmp+825) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #01 pc 0061b349  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #02 pc 005c7e3d  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #03 pc 0075c12f  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #04 pc 005b62ba  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #05 pc 0056acd0  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #06 pc 00303c23  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #07 pc 0056b53b  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #08 pc 0056b7ef  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #09 pc 002cfbd9  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #10 pc 002b8d32  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #11 pc 002b9b34  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #12 pc 002d22bb  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/lib/x86/libunity.so (BuildId: 196160b2df8717a6f2d40e3d9d28e4b942cf61d4)
04-29 11:22:58.137  3521  3554 E AndroidRuntime:       #13 pc 00006298  /data/app/~~MYfxsgTRMT04Rp3X73WdCw==/com.DefaultCompany.IntegrationTest-GR7ZEbIrFLV7jIOJYcwF0g==/oat/x86/base.odex
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libc.wcscmp(wcscmp:825)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x61b349(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x5c7e3d(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x75c12f(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x5b62ba(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x56acd0(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x303c23(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x56b53b(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x56b7ef(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x2cfbd9(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x2b8d32(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x2b9b34(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at libunity.0x2d22bb(Native Method)
04-29 11:22:58.137  3521  3554 E AndroidRuntime: 	at base.0x6298(Native Method)

For now the test has been disabled to unblock the PR, because it is not deemed to be caused by the changes in the PR but to be an existing issue, because that PR doesn't change anything about the actual package, just the test execution.

Note: I've also tried to update the CI so that it doesn't do the first build without sentry, to make sure the error isn't caused by the second build and it isn't - that app still crashes even with a single build, with unity included from the beginning.

vaind avatar Apr 29 '22 13:04 vaind

I've tried if the app crashes with just plain build, without Sentry package included and indeed it does, so this has nothing to do with Sentry: https://github.com/getsentry/sentry-unity/runs/6475554309?check_suite_focus=true

vaind avatar May 17 '22 17:05 vaind

Unity 2020 Android API 30 build is rather flaky recently too: https://github.com/getsentry/sentry-unity/runs/6817497012?check_suite_focus=true

vaind avatar Jun 10 '22 07:06 vaind

Before anything I think it's a good start to make those logs more readable. Logcat has a limit of text that can be output per line, so the event is getting cut on the log

2022-06-09T17:14:04.0102000Z 06-09 17:13:48.910  2516  2642 I Unity   : Sentry: SMOKE TEST: Intercepted HTTP Request #2 = {"sdk":{"name":"sentry.dotnet","version":"3.17.0"},"event_id":"b4da983c56dd4ba680c8e089a650ebb2"}
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   : {"type":"event","length":5560}
2022-06-09T17:14:04.0104400Z 06-09 17:13:48.910  2516  2642 I Unity   : {"modules":{"mscorlib":"4.0.0.0","System.Configuration":"4.0.0.0","Mono.Security":"4.0.0.0","System.Xml":"4.0.0.0","System":"4.0.0.0","Sentry.System.Buffers":"4.0.3.0","Sentry.System.Numerics.Vectors":"4.1.4.0","Sentry.System.Runtime.CompilerServices.Unsafe":"5.0.0.0","System.Core":"4.0.0.0","UnityEngine.SharedInternalsModule":"0.0.0.0","Sentry.System.Memory":"4.0.1.1","Sentry.System.Threading.Tasks.Extensions":"4.2.0.1","UnityEngine.CoreModule":"0.0.0.0","Sentry.Microsoft.Bcl.AsyncInterfaces":"5.0.0.0","Sentry.System.Collections.Immutable":"5.0.0.0","Sentry.System.Text.Encodings.Web":"5.0.0.1","UnityEngine.GridModule":"0.0.0.0","UnityEngine.InputLegacyModule":"0.0.0.0","UnityEngine.Physics2DModule":"0.0.0.0","UnityEngine.TextRenderingModule":"0.0.0.0","Sentry.System.Reflection.Metadata":"5.0.0.0","Sentry.System.Text.Json":"5.0.0.0"

I propose a solution for this case by formatting the json and splitting each line of it into a ne log, examle:

2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :  {
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :     "modules":{
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "mscorlib":"4.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "System.Configuration":"4.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Mono.Security":"4.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "System.Xml":"4.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "System":"4.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Buffers":"4.0.3.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Numerics.Vectors":"4.1.4.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Runtime.CompilerServices.Unsafe":"5.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "System.Core":"4.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "UnityEngine.SharedInternalsModule":"0.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Memory":"4.0.1.1",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Threading.Tasks.Extensions":"4.2.0.1",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "UnityEngine.CoreModule":"0.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.Microsoft.Bcl.AsyncInterfaces":"5.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Collections.Immutable":"5.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Text.Encodings.Web":"5.0.0.1",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "UnityEngine.GridModule":"0.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "UnityEngine.InputLegacyModule":"0.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "UnityEngine.Physics2DModule":"0.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "UnityEngine.TextRenderingModule":"0.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Reflection.Metadata":"5.0.0.0",
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :        "Sentry.System.Text.Json":"5.0.0.0"
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :  	}
2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910  2516  2642 I Unity   :  }

What do you thinks think?

lucas-zimerman avatar Jun 21 '22 19:06 lucas-zimerman

That would apply to logs like when we're printing the whole event? Works for me. If we're already splitting the log, can we get rid or at least truncate 2022-06-09T17:14:04.0102480Z 06-09 17:13:48.910 2516 2642 I Unity : as well?

bitsandfoxes avatar Jun 22 '22 08:06 bitsandfoxes

I've recently tried enabling this and it still fails. I think, considering I've previously tried running the same app without Sentry included at all, we can assume it's a Unity issue and close this. I'll leave a comment in the code pointing to this issue for explanation and if we want to pursue this further at some time down the road.

Latest run in CI: https://github.com/getsentry/sentry-unity/actions/runs/3302480440/jobs/5449627380 logs - Run Android 30 Unity 2022 Smoke Test.zip

error
  10-22 08:34:42.848  2325  2349 E CRASH   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
  10-22 08:34:42.849  2325  2349 E CRASH   : Version '2022.1.20f1 (01d83b40d570)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'x86_64'
  10-22 08:34:42.849  2325  2349 E CRASH   : Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:11/RSR1.210722.012/7758210:userdebug/test-keys'
  10-22 08:34:42.849  2325  2349 E CRASH   : Revision: '0'
  10-22 08:34:42.849  2325  2349 E CRASH   : ABI: 'x86_64'
  10-22 08:34:42.849  2325  2349 E CRASH   : Timestamp: 2022-10-22 08:34:42+0000
  10-22 08:34:42.849  2325  2349 E CRASH   : pid: 2325, tid: 2349, name: UnityMain  >>> com.DefaultCompany.IntegrationTest 

vaind avatar Oct 24 '22 11:10 vaind