https://kotlinlang.org logo
#coroutines
Title
# coroutines
p

Paul Woitaschek

11/29/2019, 12:38 PM
All right, I need help. After updating my application I faced a lot of crashes on android 7 devices. I couldn't reproduce it on my nexus or on the emulator so I bought one of the crashing devices. After spending half of the day I finally managed to find the root cause and I can reproduce it in a hello world project.
Copy code
class MainActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        CoroutineScope(SupervisorJob() + Dispatchers.Main).launch {
            while (true) {
                combine(flowOf(Unit), flowOf(Unit)) { _ -> Unit }.collect()
            }
        }
    }
}
This leads to a sigsegv
Copy code
Flags: 0x28c8bf46
    Package: com.example.weirdcrash v1 (1.0)
    Foreground: Yes
    Build: TCL/5009D/U5A_PLUS_3G:7.0/NRD90M/5009D_ALWE_V2.9_20180529:user/release-keys
    
    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'TCL/5009D/U5A_PLUS_3G:7.0/NRD90M/5009D_ALWE_V2.9_20180529:user/release-keys'
    Revision: '0'
    ABI: 'arm'
    pid: 29639, tid: 29639, name: mple.weirdcrash  >>> com.example.weirdcrash <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x15608
        r0 00015000  r1 12d35700  r2 00000002  r3 00000000
        r4 af58a6d8  r5 12d31ee0  r6 12d37280  r7 00000000
        r8 12d35700  r9 ac684400  sl 12cb0a90  fp 12d33bf8
        ip bef2f84c  sp bef2f8b0  lr 9901f5ef  pc 9901f608  cpsr 000f0030
    
    backtrace:
        #00 pc 00000608  /dev/ashmem/dalvik-jit-code-cache (deleted)
        #01 pc 000005ed  /dev/ashmem/dalvik-jit-code-cache (deleted)
     29639
I currently see about 1200 affected users; is there anythign I can do here?
😱 6
@elizarov cc
e

elizarov

11/29/2019, 12:40 PM
Thanks a lot for figuring it out. Can you, please, file an issue and list which devices are affected so that we can troubleshoot and maybe find a work-around.
e

elizarov

11/29/2019, 1:20 PM
Thanks!
p

Paul Woitaschek

11/29/2019, 1:22 PM
Do you have an idea if there is anything I can do to workaround this in the meantime? Our support is flooded with angry customers
a

Adam Powell

11/29/2019, 2:45 PM
Please also file this at b.android.com, even though it looks device-specific on an older platform version, it would be good to try to catch this in later versions of CTS. Depending on what's triggering it we might also be able to work around it in d8/r8.
e

elizarov

11/29/2019, 2:47 PM
We’ll need to find a way to reproduce it locally to find a workaround.
t

Thomas

11/29/2019, 2:55 PM
I am experiencing a different type of crash. In my case it is a coroutines issue in combination with R8. I don't think it is related but it happens on (almost) the same devices and Android 7 only. All of my affected devices have a Mediatek processor. Maybe that could help you in your case?
p

Paul Woitaschek

11/29/2019, 4:41 PM
@elizarov I got an Alcatel 1c for 60€ on ebay
7 Views