[Paper Review] Automated Dynamic Concurrency Analysis for Go
This paper presents an automated dynamic concurrency analysis framework for Go that enhances the language's built-in tracer with concurrency primitive events to generate detailed execution concurrency traces (ECTs). By storing these traces in a structured SQL database, the approach enables post-mortem analysis, identifies critical execution points for scheduler perturbation, and accelerates concurrent bug detection—demonstrated effectively on GoKer benchmarks with scalability up to 2,000 goroutines.
Kotlin language has recently become prominent for developing both Android and server-side applications. These programs are typically designed to be fast and responsive, with asynchrony and concurrency at their core. To enable developers to write asynchronous and concurrent code safely and concisely, Kotlin provides built-in coroutines support. However, developers unfamiliar with the coroutines concept may write programs with subtle concurrency bugs and face unexpected program behaviors. Besides the traditional concurrency bug patterns, such as data races and deadlocks, these bugs may exhibit patterns related to the coroutine semantics. Understanding these coroutine-specific bug patterns in real-world Kotlin applications is essential in avoiding common mistakes and writing correct programs. In this paper, we present the first study of real-world concurrency bugs related to Kotlin coroutines. We examined 55 concurrency bug cases selected from 7 popular open-source repositories that use Kotlin coroutines, including IntelliJ IDEA, Firefox, and Ktor, and analyzed their bug characteristics and root causes. We identified common bug patterns related to asynchrony and Kotlin’s coroutine semantics, presenting them with their root causes, misconceptions that led to the bugs, and strategies for their automated detection. Overall, this study provides insight into programming with Kotlin coroutines concurrency and its pitfalls, aiming to shed light on common bug patterns and foster further research and development of concurrency analysis tools for Kotlin programs.
Motivation & Objective
- To address the lack of effective dynamic debugging support for Go's complex concurrency model, especially for hard-to-detect concurrency bugs.
- To overcome the limitations of existing tools that fail to handle dynamic goroutine and channel creation in large-scale Go programs.
- To develop an automated, low-overhead tracing mechanism that captures comprehensive concurrency behavior for post-execution analysis.
- To identify critical program points where scheduler perturbations can maximize the exposure of erroneous interleavings.
- To enable systematic, coverage-driven testing by leveraging ECTs to guide targeted scheduler manipulation.
Proposed method
- Enhanced Go’s built-in tracer to capture concurrency primitive usage events (e.g., channel send/receive, mutex lock/unlock) alongside regular execution events, producing Execution Concurrency Traces (ECTs).
- Designed a framework that automatically instruments Go programs, collects ECTs during execution, and persistently stores them in relational SQL tables for structured analysis.
- Extracted source-level locations of concurrency operations from ECTs to identify 'critical points'—locations where context-switches can alter program behavior and expose bugs.
- Implemented a scheduler perturbation mechanism that injects bounded, random delays around critical points to explore untested interleavings and increase schedule coverage.
- Leveraged ECTs to compute concurrency coverage metrics such as sync-pair, blocking-blocked, and blocked-pair to quantify testing effectiveness.
- Integrated the framework with a testing pipeline that re-executes programs under manipulated schedulers to improve bug exposure and refine critical point detection.
Experimental results
Research questions
- RQ1How can dynamic tracing be enhanced to capture the full concurrency semantics of Go programs, including dynamic goroutine and channel creation?
- RQ2What are the key program locations (critical points) where scheduler perturbations most effectively alter execution interleavings and expose hidden concurrency bugs?
- RQ3To what extent can ECT-based analysis improve the detection of atomicity violations and other Go-specific concurrency bugs compared to existing tools?
- RQ4Can ECTs enable scalable and practical post-mortem analysis of large Go applications with up to 2,000 goroutines?
- RQ5How effective is scheduler perturbation guided by ECTs in increasing coverage and accelerating the exposure of hard-to-trigger concurrency bugs?
Key findings
- The enhanced tracing mechanism successfully captured full concurrency behavior in Go programs, including dynamic goroutine and channel creation, with feasible runtime overhead.
- The framework enabled accurate reconstruction of the program’s dynamic concurrency model through structured ECTs stored in an SQL database.
- ECTs were used to identify critical execution points where scheduler perturbations could alter program behavior and increase the likelihood of triggering bugs.
- The approach achieved effective detection of bugs and their root causes in all blocking benchmarks from the GoKer suite through ECT analysis.
- Preliminary results showed that scheduler perturbation around critical points significantly accelerated the exposure of hard-to-trigger concurrency bugs, with measurable improvements in schedule coverage metrics.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.