Go is a statically-typed programming language that aims to provide a simple, efficient, and safe way to build concurrent programs. To achieve its design purpose, Go recommends passing messages using channels as a less error-prone means of thread communication and provides several new concurrency mechanisms and libraries to ease multi-threading programming. Since its creation in 2009, Go has become increasingly popular and has already been adopted to build many important infrastructure software systems. Unfortunately, concurrency bugs, especially those due to misuse of channels, exist widely in Go. Those bugs severely hurt the reliability of Go software systems.
In this talk, I will present our recent research work on fighting Go concurrency bugs. We first empirically studied 171 concurrency bugs from six popular Go software, including Docker, Kubernetes, and gRPC to compare message passing and share memory synchronization. Inspired by the study, we then built a static concurrency bug detection system, GCatch, to effectively identify block bugs due to misuse of channels. After disentangling an input Go program, GCatch models the complex channel operations in Go using a novel constraint system and applies a constraint solver to pinpoint blocking bugs. A blocking bug continues to hurt the system’s reliability until it is fixed. Thus, we built an automated concurrency bug fixing system, GFix, for patching blocking bugs detected by GCatch. GFix synthesizes patches with good readability and performance using Go’s channel-related language features. In total, GCatch finds 149 previously unknown blocking bugs due to misuse of channels in real Go software systems and GFix successfully fixes 124 of them. We have reported all detected bugs and generated patches to developers. So far, developers have fixed 125 bugs based on our reporting. Among them, 87 bugs are fixed by applying GFix’s patches directly.
Linhai Song is an assistant professor in the College of Information Sciences and Technology at the Pennsylvania State University. He received his Ph.D at the University of Wisconsin-Madison in 2015. He was a staff research staff at FireEye, Inc., from 2015 to 2017. His research focuses on software reliability, efficiency, and security, with particular interests in combating software bugs in new programming languages (e.g., Go, Rust). Linhai won the MICRO Best Paper Runner Up in 2014 and received the ACM SIGPLAN Research Highlights Award in 2011.