Skip to content

RollingFileLogWriter can throw InterruptedException #480

Description

@szymone

File log writer can throw InterruptedException probably when calling thread is no longer active. This can happen for example if Android account sync process is called by the system and the whole sync process is interrupted, because of battery optimization or other condition. This error occurred when app was in background, on Samsung devices, Android 15 and 16.

Fatal Exception: java.lang.InterruptedException
    kotlinx.coroutines.BlockingCoroutine.joinBlocking (BlockingCoroutine.java:98)
    kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking (BuildersKt__Builders.kt:70)
    kotlinx.coroutines.BuildersKt.runBlocking (Builders.kt:1)
    kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default (BuildersKt__Builders.kt:48)
    kotlinx.coroutines.BuildersKt.runBlocking$default (Builders.kt:1)
    kotlinx.coroutines.channels.ChannelsKt__ChannelsKt.trySendBlocking (ChannelsKt__Channels.kt:38)
    kotlinx.coroutines.channels.ChannelsKt.trySendBlocking (Channels.kt:1)
    co.touchlab.kermit.io.RollingFileLogWriter.bufferLog (RollingFileLogWriter.java:131)
    co.touchlab.kermit.io.RollingFileLogWriter.log (RollingFileLogWriter.java:110)
    co.touchlab.kermit.BaseLogger.processLog (BaseLogger.java:55)
    ...
    android.content.AbstractThreadedSyncAdapter$SyncThread.run (AbstractThreadedSyncAdapter.java:354)

Any thoughts on this? Is there any chance to fix this issue? Maybe trySendBlocking on logging channel should be used only if current tread is not interrupted, otherwise would trySend be a better option?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions