https://kotlinlang.org logo
#compose
Title
# compose
v

Vsevolod Ganin

02/11/2021, 6:00 PM
I think I got an infinite loop in
Recomposer.kt
. Only Compose’s code in the thread stack. I’m on alpha12
It got stuck in section looping indefinitely
Copy code
while (shouldKeepRecomposing) {
    // Await something to do
    if (_state.value < State.PendingWork) {
        suspendCancellableCoroutine<Unit> { co ->
            synchronized(stateLock) {
                val currentState = _state.value
                if (currentState == State.PendingWork ||
                    currentState <= State.ShuttingDown
                ) {
                    co.resume(Unit)
                } else {
                    frameContinuation = co
                }
            }
        }
    }

    // Don't await a new frame if we don't have frame-scoped work
    if (
        synchronized(stateLock) {
            if (!hasFrameWorkLocked) {
                recordComposerModificationsLocked()
                !hasFrameWorkLocked
            } else false
        }
    ) continue
    
    ...
Maybe someone could advise to look something in particular to debug this. It doesn’t happen 100% of the time, seems like more of a heisenbug to me. Maybe tied with
pointerInput
but I’m not sure
a

Adam Powell

02/11/2021, 6:15 PM
please file an issue with a repro sample if you can isolate it, this is definitely something I would like to trace if possible
s

Sarojini

05/05/2023, 6:56 AM
@Vsevolod Ganin did you find solution to this ?
v

Vsevolod Ganin

05/05/2023, 12:18 PM
Hey @Sarojini, umm no, I think it has gone away with the update at the time. Also, I think I've got carried away so I forgot to file an issue, sorry about that. Anyway, the Google Play Console doesn't report any ANRs in my production build now, so I guess the problem is gone for good for me.
s

Sarojini

05/05/2023, 12:21 PM
Okey nice! Actually I am facing same anr for my app in production, so looking for solution on internet but no luck yet.
v

Vsevolod Ganin

05/05/2023, 12:25 PM
The only hint I can give, as I remember, there was something to do with empty
pointerInput
. By that I mean no event consuming is happening in some
pointerInput
lambda
But I'm not really sure, it was 2 years ago :)
s

Sarojini

05/05/2023, 5:47 PM
No issues. Thank you.
15 Views