vgorloff / swift-everywhere-toolchain

Automated workflow to compile Swift Toolchain, for making Android apps with Swift.
MIT License
85 stars 25 forks source link

Runtime crash when using Android SDK Version 30 #106

Closed gshahbazian closed 3 years ago

gshahbazian commented 3 years ago

Hello! I'm running into this crash when setting our project to use compileSdkVersion and targetSdkVersion 30. This can also be reproduced by using the sample project (at https://github.com/vgorloff/swift-everywhere-samples/tree/55797008c69382f74e0fa492d2917a93c06852e4) and changing build.gradle to sdk 30.

Crash that occurs:

2020-12-07 12:47:10.266 4318-4318/? A/SwiftRuntime: Fatal error: No foreign strings on Linux in this version of Swift: file Swift/UnicodeHelpers.swift, line 266
2020-12-07 12:47:10.269 4318-4318/? A/libc: Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x73262eec38 in tid 4318 (.home.hello_ndk), pid 4318 (.home.hello_ndk)
2020-12-07 12:47:10.312 4390-4390/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-12-07 12:47:10.312 4390-4390/? A/DEBUG: Build fingerprint: 'google/flame/flame:11/RP1A.201005.004/6782484:user/release-keys'
2020-12-07 12:47:10.312 4390-4390/? A/DEBUG: Revision: 'MP1.0'
2020-12-07 12:47:10.312 4390-4390/? A/DEBUG: ABI: 'arm64'
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG: Timestamp: 2020-12-07 12:47:10-0800
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG: pid: 4318, tid: 4318, name: .home.hello_ndk  >>> com.home.hello_ndk <<<
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG: uid: 10264
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG: signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr 0x73262eec38
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG: Abort message: 'Fatal error: No foreign strings on Linux in this version of Swift: file Swift/UnicodeHelpers.swift, line 266
    '
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x0  80000073265dacc0  x1  0000007326558f60  x2  0000007fd7608fe8  x3  0000000000000042
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x4  0000000000000010  x5  b400007407253cf1  x6  6965726f66206f4e  x7  6e69727473206e67
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x8  0000007326558f60  x9  addce693f77b2657  x10 0000000000000009  x11 0000000000000090
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x12 0000000000000000  x13 c886000000042107  x14 0000000000000107  x15 0000000000000000
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x16 0000007326681a58  x17 0000007629e9ead4  x18 000000762d13e000  x19 00000073265df5a0
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x20 0000000000000001  x21 0000000000000000  x22 000000000000010a  x23 00000073265dad20
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x24 80000073265dacc0  x25 d000000000000034  x26 000000000000000b  x27 0000000000000002
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     x28 0000007fd7609710  x29 0000007fd7609160
2020-12-07 12:47:10.313 4390-4390/? A/DEBUG:     lr  00000073262eec38  sp  0000007fd7609120  pc  00000073262eec38  pst 00000000a0000000
2020-12-07 12:47:10.400 4390-4390/? A/DEBUG: backtrace:
2020-12-07 12:47:10.400 4390-4390/? A/DEBUG:       #00 pc 000000000016ec38  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) ($ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_SSAHSus6UInt32VtF+464) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.400 4390-4390/? A/DEBUG:       #01 pc 00000000002b7218  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) ($sSS8UTF8ViewV13_foreignIndex5afterSS0D0VAF_tF+100) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #02 pc 0000000000173884  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #03 pc 00000000002a49e4  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #04 pc 00000000002582f0  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #05 pc 000000000025818c  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) ($sSS5write2toyxz_ts16TextOutputStreamRzlF+36) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #06 pc 0000000000421184  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libFoundation.so (offset 0x6bc000) ($s10Foundation14OperationQueueCACycfc+644)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #07 pc 0000000000420ef0  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libFoundation.so (offset 0x6bc000) ($s10Foundation14OperationQueueCACycfC+32)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #08 pc 0000000000006018  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk (offset 0xe81000)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #09 pc 0000000000092220  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libc++_shared.so (offset 0x223000) (std::__ndk1::__call_once(unsigned long volatile&, void*, void (*)(void*))+156) (BuildId: 0075e78523040db11292a281c23d268c33bbc8e5)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #10 pc 00000000003f8154  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!libswiftCore.so (offset 0xe8d000) (swift_once+68) (BuildId: b675f3bdf87ce6bbd5f501895dea482bce59b5fb)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #11 pc 000000000000604c  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk (offset 0xe81000)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #12 pc 00000000000059c4  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk (offset 0xe81000) ($s12HelloJNICore14probeOperationyyF+88)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #13 pc 0000000000005564  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk (offset 0xe81000) ($s12HelloJNICore03sayA0SiyF+68)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #14 pc 0000000000005514  /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk (offset 0xe81000) (Java_com_home_helloNDK_SwiftLib_sayHello+8)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #15 pc 000000000013ced4  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #16 pc 0000000000133564  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #17 pc 00000000001a8a78  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #18 pc 000000000031830c  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+376) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #19 pc 000000000030e638  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+996) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #20 pc 00000000001489d0  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+28080) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #21 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #22 pc 0000000000019408  [anon:dalvik-classes2.dex extracted in memory from /data/app/~~easO8X0C3Cv7ineZXMOkqw==/com.home.hello_ndk-SB3Mbo_6XLjJ5KAZGQ-RUA==/base.apk!classes2.dex] (com.home.helloNDK.MainActivity$1.onClick)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #23 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #24 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #25 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #26 pc 000000000014846c  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+26700) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #27 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #28 pc 00000000002508c8  /system/framework/framework.jar (offset 0x125d000) (android.view.View.performClick)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #29 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #30 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #31 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #32 pc 00000000001489d0  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+28080) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #33 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #34 pc 0000000000250918  /system/framework/framework.jar (offset 0x125d000) (android.view.View.performClickInternal)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #35 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #36 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #37 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #38 pc 00000000001489d0  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+28080) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #39 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #40 pc 000000000024c05c  /system/framework/framework.jar (offset 0x125d000) (android.view.View.access$3600)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #41 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #42 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #43 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #44 pc 000000000014a0c8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+33960) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #45 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #46 pc 000000000022ac4c  /system/framework/framework.jar (offset 0x125d000) (android.view.View$PerformClick.run)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #47 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #48 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #49 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #50 pc 000000000014846c  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+26700) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #51 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #52 pc 000000000036f420  /system/framework/framework.jar (offset 0x92b000) (android.os.Handler.handleCallback)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #53 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #54 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #55 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #56 pc 000000000014a0c8  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+33960) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #57 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #58 pc 000000000036f288  /system/framework/framework.jar (offset 0x92b000) (android.os.Handler.dispatchMessage)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #59 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #60 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #61 pc 000000000030e61c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #62 pc 00000000001489d0  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*)+28080) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #63 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #64 pc 00000000003968c8  /system/framework/framework.jar (offset 0x92b000) (android.os.Looper.loop)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #65 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #66 pc 000000000030dc24  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #67 pc 000000000030f00c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1772) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #68 pc 0000000000177f40  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+57848) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #69 pc 000000000013f7d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #70 pc 00000000001a1698  /system/framework/framework.jar (android.app.ActivityThread.main)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #71 pc 0000000000305d3c  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.16249794272548105830)+532) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #72 pc 0000000000669e20  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+780) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #73 pc 000000000013cff8  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.401 4390-4390/? A/DEBUG:       #74 pc 000000000013d20c  /apex/com.android.art/lib64/libart.so (BuildId: 0252adff22f4c0297f97cb35735c7649)
2020-12-07 12:47:10.556 864-864/? E/tombstoned: Tombstone written to: /data/tombstones/tombstone_01

Note that the crash does not occur in an emulator only when running on device (Pixel 4).

vgorloff commented 3 years ago

Seems error is due this line: https://github.com/apple/swift/blob/main/stdlib/public/core/UnicodeHelpers.swift#L266

vgorloff commented 3 years ago

As I understand it is due UTF16 encoding. Probably your device (Pixel 4) has a non-latin language/encoding which cannot be processed by Swift.

gshahbazian commented 3 years ago

@vgorloff Do you know what language or encoding to check for this? The device language is set to English. Note this crash does not occur if I set the SDK Version to 28 and run on the same device.

vgorloff commented 3 years ago

Not sure. Unicode is a complex topic. The quick look on Swift sources showing not too much.

gshahbazian commented 3 years ago

@vgorloff Thanks. I'm wondering if you are able to reproduce the issue? Currently it only happens for me on a Pixel 4 running Android 11, our Galaxy S20 running Android 10 and emulator running Android 11 do not have the issue.

Molanda commented 3 years ago

I ran into this as well. Was able to resolve by adding android:allowNativeHeapPointerTagging="false" to the AndroidManifest.xml per this link.

Molanda commented 3 years ago

Per the release notes...

Heap pointers now have a non-zero tag in the most significant byte (MSB). Applications that use pointers incorrectly, including those that modify the MSB, can now crash or experience other issues. This change is necessary to support future hardware with ARM Memory Tagging Extension (MTE) enabled. To learn more, see Tagged Pointers.

To disable this feature, see the allowNativeHeapPointerTagging manifest documentation.

gshahbazian commented 3 years ago

Thank you for that pointer @Molanda! That flag also fixes the problem for me.

Molanda commented 3 years ago

I found some discussion in the Swift forums about this.

finagolfin commented 2 years ago

I'm trying to get a fix upstreamed for this, apple/swift#40779, @vgorloff, try it out and let me know.

MihaelIsaev commented 2 years ago

Seems it is fixed in Swift 5.6.1 https://github.com/apple/swift/pull/40779

finagolfin commented 2 years ago

No, that patch has not been merged in the 5.6 branch yet, apple/swift#42178.