dirk.dittert
01/03/2025, 4:49 PMval device = withTimeout(Duration.parse("1s")) {
println("before filestore"). // is printed
val tmp = path.fileStore().name() // seems to freeze here
println("Filestore name: $tmp") // not printed
tmp
}
The execution stops after before filestore
is printed. Unfortunately, it runs on a machine where I can't just attach a remote debugger. How can the execution freeze at that point? I would expect to run into a TimeoutCancellationException
after one second. However, that does not happen.ross_a
01/03/2025, 4:51 PMross_a
01/03/2025, 4:51 PMdirk.dittert
01/03/2025, 4:53 PMtry
-catch
and see if the exception occursdirk.dittert
01/03/2025, 4:55 PMval device: String = try {
withTimeout(Duration.parse("1s")) {
println("before filestore")
val tmp = path.fileStore().name()
println("Filestore name: $tmp")
tmp
}
} catch (e: TimeoutCancellationException) {
e.printStackTrace()
"invalid"
}
Execution does not seem to run into the catch
-clause.Robert Williams
01/03/2025, 4:57 PMross_a
01/03/2025, 4:57 PMross_a
01/03/2025, 4:58 PMrunInterruptable
dirk.dittert
01/03/2025, 5:02 PMdirk.dittert
01/03/2025, 5:21 PMPath.filestore()
seems to block indefinitely on a broken symbolic link (for whatever reason). I am checking for that corner case and avoid it.
I learned from this that there is no point in wrapping filesystem IO operations with coroutines as they would just block anyway and there is no way to cover for this in the cooperative approach of coroutines.ephemient
01/03/2025, 6:17 PMEdoardo Luppi
01/06/2025, 5:31 PMrunInterruptible
, nice one!