For full text search please use the '?' prefix. e.g. ? Onboarding

CoRoutine Gotchas

From Cancellation Gotchas (With Regular Job)
Go to text →
  • ⚠️ Firstly, make sure to understand intended Exception/Cancellation Behavior with Regular Job ⚠️.
  • ⚠️ Swallowing cancellation exception prevents cancellation ⚠️
  • ⚠️ Unhandled exception from async can go to parent scope without going through await() ⚠️
  • ⚠️ cancel() call stops on next suspension point, NOT right away ⚠️
  • ⚠️ join() does NOT rethrow ⚠️

From scope functions gotchas
Go to text →
  • ⚠️🐢 Mixing essential and non-essential operations in one coroutineScope 🐢⚠️

From building-scope-gotchas
Go to text →
  • +Job()/+SupervisorJob() must-inherit-from-parent or it will ⚠️not respect parent cancellation⚠️

From withTimeout gotchas
Go to text →
  • ⚠️ does-not-cancel-parent-or-siblings-on-timeout ⚠️

  • ⚠️CoroutineExceptionHandler: does-not-work-with-async⚠️

Job is not inherited: it is used as a parent

DONT: runBlocking(SupervisorJob()) makes no sense. pg 433.

img


Children
  1. Benchmarking against Thread Pool
  2. Benchmarking in Native
  3. Co routines invocations will wait for the background thread to finish even if result is not used right away.
  4. Delay Can Take Longer than requested
  5. Even with Async Await Io Dispatcher Not Using up All Cores
  6. Initial Run Blocking Takes Upwards of 100ms

Backlinks
  • Kotlin Co-Routine