arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

自动检测并修复 Go 代码中的死锁:GoDDaR

Automatically Detecting and Fixing Deadlocks in Go Code with GoDDaR

Gustavo Feio, Jorge Coelho, Miguel Flor, João M. Lourenço, António Ravara

arXiv 2610.08962首次发表:更新:

发表机构

NOVA LINCS; NOVA FCT(NOVA LINCS; NOVA科学技术学院)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

GoDDaR 通过将 Go 源码转为中间表示并进行符号分析,检测全局和部分死锁,并生成修复差异,在检测上与顶尖方法相当,并推进了自动修复技术。

AI 中文摘要

Go 编程语言通过 goroutine 提供了轻量级的并发编程抽象,而 goroutine 容易发生死锁。Go 包含一个运行时检测器,当所有线程都被阻塞(全局死锁)时会中止执行。然而,由于线程调度的不确定性,这种运行时机制只能检测在执行过程中显现的全局死锁,无法识别部分死锁——即一部分 goroutine 被永久阻塞,而至少有一个 goroutine 仍处于可运行状态。静态检测局部死锁对于开发可靠的并发软件至关重要。虽然已有多种工具能够静态检测并发程序中的死锁,但很少有工具能协助开发者修复死锁。检测和解决部分死锁需要对复杂的交错和通信模式进行推理,这本身是一项极具挑战性的任务。在本文中,我们提出了 GoDDaR,一种能够检测 Go 程序中未被观察到的全局或部分死锁并给出具体修复建议的工具。GoDDaR 将 Go 源代码转换为一种中间表示,该表示反映了消息传递通信事件和组合模式。部分死锁通过对该表示进行符号分析来识别。为了解决检测到的死锁,我们的算法对中间表示进行变换,以消除有问题的同步模式,从而使 GoDDaR 能够以差异(diff)的形式为原始 Go 源代码生成修复建议。我们在一个包含文献和 git 仓库中代表性死锁示例的基准测试套件上评估了 GoDDaR,以验证算法的正确性,并与现有最先进的方法进行性能比较。结果表明,GoDDaR 在部分死锁检测方面与顶级方法不相上下,并在自动化死锁修复方面推动了最先进水平的发展。

英文摘要

The Go programming language provides a lightweight abstraction for concurrent programming through goroutines, which are prone to deadlocks. Go includes a runtime detector that aborts execution when all threads are blocked (a global deadlock). However, due to nondeterministic thread scheduling, this runtime mechanism only detects global deadlocks that manifest during execution and cannot identify partial deadlocks, where a subset of goroutines is permanently blocked while at least one remains runnable. Statically detecting local deadlocks is essential for developing dependable concurrent software. While several tools statically detect deadlocks in concurrent programs, few assist developers in fixing them. Detecting and resolving partial deadlocks requires reasoning about complex interleavings and communication patterns, an inherently challenging task. In this paper, we present GoDDaR, a tool that detects unobserved global or partial deadlocks in Go programs and suggests concrete fixes. GoDDaR translates Go source code into an intermediate representation reflecting message-passing communication events and composition patterns. Partial deadlocks are identified through symbolic analysis over this representation. To resolve detected deadlocks, our algorithms transform the intermediate representation to eliminate problematic synchronization patterns, allowing GoDDaR to generate fix suggestions for the original Go source code as a diff. We evaluate GoDDaR on a benchmark suite of representative deadlock examples from literature and git repositories to validate algorithm correctness and compare performance against the state of the art. Results demonstrate that GoDDaR is competitive with top approaches in partial deadlock detection and advances the state of the art in automated deadlock fixing.

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑