Skip to content
Preptima
mediumConceptScenarioMidSenior

What does structured concurrency actually give you in Kotlin coroutines, and how does a coroutine scope leak happen despite it?

4 min readUpdated 2026-08-15

Answer

Short answer

Structured concurrency ties a coroutine's lifetime to a CoroutineScope so cancellation propagates automatically, but a leak still happens when a coroutine is launched in a scope that outlives the component that should own it, such as GlobalScope or a manually retained scope nobody cancels.

Was this answer helpful?

Likely follow-ups

  • What actually happens inside a coroutine when its containing scope is cancelled mid-suspension?
  • Why does launching a coroutine from a Composable directly, instead of through a LaunchedEffect, tend to cause leaks?
  • How would you make a long-running coroutine cooperative with cancellation if it wraps a blocking call?
  • What is the difference between SupervisorJob and a regular Job in how a child failure propagates?

Related questions

Further reading