Tim Malseed
11/11/2020, 6:41 AMJobCancellationException
. My crash reporting tool isn't offering any useful information, and I don't quite understand this exception..kotlinx.coroutines.JobCancellationException · Job was cancelled
unknown fileunknown method
MainActivity.onDestroy()
is called in my Android app. So presumably, someone is swiping the app away from recents (potentially killing the app process)CoroutineScope(Dispatchers.Main + job + coroutineExceptionHandler)
Where:
job
is a SupervisorJob
, and
coroutineExceptionHandler
is an instance of CoroutineExceptionHandler
that logs errorselizarov
11/11/2020, 6:48 AMTim Malseed
11/11/2020, 6:48 AMlouiscad
11/11/2020, 7:36 AMChannel
and the offer
function?Tim Malseed
11/11/2020, 9:56 PMlouiscad
11/12/2020, 10:01 AMconsume
, consumeEach
or consumeAsFlow()
when, respectively, you should not, when you should use a plain for
loop or receive()
, or when you should use receiveAsFlow()
• because you have a race condition, for example in `callbackFlow`/`channelFlow` or elsewhere, which is this issue: https://github.com/Kotlin/kotlinx.coroutines/issues/974
• because you close
or cancel
the channel in a way or another, where a JobCancellationException
is passed as a cause.Tim Malseed
11/12/2020, 12:40 PM