Skip to content

ANR on saveInstanceState #76

@a-blekot

Description

@a-blekot

Hi!
We have ANRs in our Crashlytics. All devices running Android 12 and 13. 66% of them are Samsung devices ))

Could you please help to find the reason of these ANRs )

main (timed waiting):tid=1 systid=25492 
       at jdk.internal.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1079)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1369)
       at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
       at com.livefront.bridge.BridgeDelegate.queueDiskWritingIfNecessary(BridgeDelegate.java:229)
       at com.livefront.bridge.BridgeDelegate.saveToMemoryAndDiskIfNecessary(BridgeDelegate.java:380)
       at com.livefront.bridge.BridgeDelegate.saveInstanceState(BridgeDelegate.java:348)
       at com.livefront.bridge.Bridge.saveInstanceState(Bridge.java:145)

systid=25492 - it's different in each case. Other parts of stack-trace are the same.

we use following code to init Bridge

private fun initBridge() {
        Bridge.initialize(this, object : SavedStateHandler {
            override fun saveInstanceState(target: Any, state: Bundle) {
                (target as? StateSaver)?.saveState(state)
            }

            override fun restoreInstanceState(target: Any, state: Bundle?) {
                (target as? StateSaver)?.restoreState(state)
            }
        })
    }

Where StateSaver is interface which is implemented by our Fragments

// BaseFragment
override fun onSaveInstanceState(outState: Bundle) {
    Bridge.saveInstanceState(this, outState)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions