Tim Schraepen
07/15/2026, 3:31 PMTim Schraepen
07/15/2026, 3:34 PMCLOVIS
07/15/2026, 4:07 PMclass Foo(
parent: CoroutineContext,
) {
private val scope = CoroutineScope(parent + SupervisorJob(parent.job))
// …
suspend fun results(): FooResults {
scope.coroutineContext.job.children.toList().joinAll()
return results
}
}
We did not notice, but nothing anywhere completes the job, so this does return results, and then the scope continues to exists forever so the parent coroutine cannot ever finish. We therefore had endpoints that would correctly respond, and then would hang forever, never freeing their resourcesamanda.hinchman-dominguez
07/23/2026, 9:11 PMSupervisorJob(parent.job) inside a custom scope, and that's because a cancellation signal can be sent downstream, but completion cannot be signaled upstream due to the boundaries a scope draws around a job.
This pattern is actually one of the scenarios we're breaking down in the workshop. Mind if we share this example as well? Thanks for sharing this one. If your team has interest in learning more about the workshop, hit me or @Tim Schraepen up for additional details.CLOVIS
07/25/2026, 2:49 PM