groostav
10/29/2019, 9:26 PMcoroutineContext with a finalize that can detect an abandoned coroutine? Maybe print a warning?elizarov
10/29/2019, 9:31 PMgroostav
10/29/2019, 9:48 PMgroostav
10/29/2019, 9:48 PMoctylFractal
10/29/2019, 9:49 PMgroostav
10/29/2019, 9:49 PMwithContext is abandoning according to println statements I've got, which is wholly unexpected, itl be interesting to see why.groostav
10/29/2019, 9:49 PMfinally blocks might not go off.octylFractal
10/29/2019, 9:50 PMjob.isActive is still trueoctylFractal
10/29/2019, 9:51 PMfinally block perhaps?), I would inspect the compiled code to ensure it does what you expectgroostav
10/29/2019, 10:12 PMpublic class AbandonmentNotifier(val job: Job): AbstractCoroutineContextElement(Key) {
fun finalize(){
if(job.isActive){
println("abandoned!!!")
}
}
private object Key: CoroutineContext.Key<AbandonmentNotifier>
}
does nothing, and my code
println("A")
withContext(Dispatchers.Default){
println("B")
}
prints "A" without printing Bgroostav
10/29/2019, 10:13 PMgroostav
10/29/2019, 10:17 PM-ea to get that debugging.groostav
10/29/2019, 10:17 PMgroostav
10/29/2019, 10:55 PMelizarov
10/30/2019, 5:11 AMlouiscad
10/30/2019, 7:15 AMyield() in your tight loops to allow other coroutines to run.elizarov
11/02/2019, 6:52 AMscheduler-changes branchelizarov
11/02/2019, 6:52 AMgroostav
11/26/2019, 9:02 PMFlow instances stuff, and it only happens when using the intelliJ run button. When using intelliJ's debug or our own installer target its fine. I'm going to start running with java -jar invocations by hand to see if I can reproduce the problem. One problem though is that I believe handleCoroutineException() is hiding exceptions; I've seen it get hit under the debugger once or twice but no exceptions were printed out.
really scary stuff.elizarov
11/26/2019, 9:46 PMgroostav
11/27/2019, 1:13 AMgroostav
11/27/2019, 1:15 AMgroostav
12/06/2019, 8:26 PMDispatchers.Default was deadlocked, and <http://Dispatchers.IO|Dispatchers.IO> appears to use Dispatchers.Default for scheduling, so if Default is deadlocked IO is effectively also deadlocked. Could that be considered a bug? Interestingly enough, jstack points out the deadlock plain-and-simple, no coroutines involved. I just needed to pay attention to the thread names.