arXiv:2504.15637cs.DCcs.AI2025-04被引 3

用大模型+程序分析自动修复大规模并发代码中的数据竞争问题。

DR.FIX: Automatically Fixing Data Races at Industry Scale

  • 结合大语言模型与程序分析生成修复方案。
  • 在Uber实测中修复了404个数据竞争中的224个(55%)。
  • 修复方案获100多名开发者认可,86%被合并进主干代码。

数据竞争是共享内存并行程序中常见的一类并发缺陷,严重威胁软件可靠性与可复现性。尽管已有大量研究专注于数据竞争检测,并开发出多种编程语言的实用检测工具,但针对工业规模下自动修复数据竞争的工作仍较少。在大型代码库中,数据竞争持续引入且模式多样,自动化修复极具挑战。本文提出Dr.Fix,一种结合大语言模型(LLMs)与程序分析的工具,可在真实场景中自动生成数据竞争的修复方案,有效应对复杂代码上下文中的多种竞态模式。该工具专为Go语言设计——这种语言广泛应用于现代微服务架构,其中并发普遍存在,数据竞争频发——并能无缝融入现有开发流程。我们详细阐述Dr.Fix的设计,并分析各设计选择对修复质量的影响。过去18个月中,Dr.Fix已集成至Uber的开发工作流,覆盖404个数据竞争实例,成功生成224个修复补丁(占比55%),其中193个(占修复总数86%)经超过百名开发者代码审查后被采纳并合并到代码库。

原文摘要 · Abstract (English)

Data races are a prevalent class of concurrency bugs in shared-memory parallel programs, posing significant challenges to software reliability and reproducibility. While there is an extensive body of research on detecting data races and a wealth of practical detection tools across various programming languages, considerably less effort has been directed toward automatically fixing data races at an industrial scale. In large codebases, data races are continuously introduced and exhibit myriad patterns, making automated fixing particularly challenging. In this paper, we tackle the problem of automatically fixing data races at an industrial scale. We present Dr.Fix, a tool that combines large language models (LLMs) with program analysis to generate fixes for data races in real-world settings, effectively addressing a broad spectrum of racy patterns in complex code contexts. Implemented for Go--the programming language widely used in modern microservice architectures where concurrency is pervasive and data races are common--Dr.Fix seamlessly integrates into existing development workflows. We detail the design of Dr.Fix and examine how individual design choices influence the quality of the fixes produced. Over the past 18 months, Dr.Fix has been integrated into developer workflows at Uber demonstrating its practical utility. During this period, Dr.Fix produced patches for 224 (55%) from a corpus of 404 data races spanning various categories; 193 of these patches (86%) were accepted by more than a hundred developers via code reviews and integrated into the codebase.

并发修复大模型Go语言程序分析

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。