Static Deadlock Analysis for Kotlin Coroutines

Master Thesis (2024)
Author(s)

B.J. Brockbernd (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Contributor(s)

Burcu Kulahcioglu Özkan – Mentor (TU Delft - Software Engineering)

Arie van Van Deursen – Mentor (TU Delft - Software Engineering)

Faculty
Electrical Engineering, Mathematics and Computer Science
More Info
expand_more
Publication Year
2024
Language
English
Graduation Date
11-10-2024
Awarding Institution
Delft University of Technology
Programme
Computer Engineering
Faculty
Electrical Engineering, Mathematics and Computer Science
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

Asynchronous programming is often a difficult and non-trivial task. To make asynchronous programming more straightforward, languages are continuously introducing new syntax and patterns, making it easier to think about and develop solutions for concurrent problems.
JetBrains introduced coroutines for Kotlin in 2018. Although Kotlin coroutines promise safe execution and concise code, it is not immune to concurrency bugs such as deadlocks. Particular runBlocking deadlocks are common when working with Kotlin coroutines. While other languages have made various advancements in detecting deadlocks, Kotlin lags behind.

In this work, we present two static analysis techniques that help developers detect and prevent deadlocks. The first technique, focused on the runBlocking problem, successfully identified dangerous patterns in open source repositories, leading to their resolution. Additionally, this technique has been integrated into JetBrains flagship IDE: IntelliJ IDEA. The second technique, aimed at general deadlock detection, has been developed and tested as a prototype. By using existing modeling techniques combined with novel approaches we have been able to accurately predict deadlocks in a controlled environment. Overall, this study tackled a common problem in Kotlin coroutines and made the first steps toward general deadlock detection.

Files

Thesis.pdf
(pdf | 1.38 Mb)
License info not available