Preventing Data Races in Async Coroutines
May 04, 2023
17 min
Free
kotlin
data-races
thread-sanitizer
tsan
coroutines
concurrency
async-programming
static-analysis
android
jvm
testing
kotlinx-coroutines
Description
In this talk, Kevin Bierhoff explores techniques used at Google to detect and prevent race conditions in asynchronous coroutines. He discusses static analysis to flag potentially racy code at compile time and the use of TSAN (Thread Sanitizer) to detect race conditions during multithreaded test execution. The presentation covers how to make data safe for concurrent access through immutability and proper synchronization mechanisms like mutexes, and touches upon the implementation of these analyses using Android lint for both Java and Kotlin.