paperbot · PL 论文追踪

全部论文 待读 收藏

P2 From Leaks to Fixes: Automated Repairs for Resource Leak Warnings

从泄漏到修复:面向资源泄漏警告的自动修复
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 3/10 · 论文属于纯静态分析与自动修复,使用资源对象数据流分析修复 Java 资源泄漏,未涉及 LLM/Agent 与静态分析的交叉、浮点程序分析或贝叶斯程序分析;仅在广义程序分析、工业工具落地和问题驱动动机上与研究画像有较弱关联。引用 7 inbox
Akshay Utture, Jens Palsberg
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:RLFixer 通过资源对象数据流分析区分可修复与不可修复的泄漏,为 66% 的 Java 泄漏警告生成修复,其中 95% 正确。

资源泄漏是常见且难以定位的缺陷来源,可能导致崩溃与安全漏洞;静态分析是开发期发现泄漏的主要手段,但实证研究表明开发者还需要自动修复建议。现有唯一能建议资源泄漏修复的工具 Footpatch 是通用的,效果很差:仅对 6% 的泄漏生成修复,其中只有 27% 正确。本文提出专用修复工具 RLFixer,可为任意资源泄漏检测器报告的警告生成高质量修复。其核心挑战在于:最一般的资源泄漏修复问题至少与编译期对象释放一样困难。RLFixer 借助对资源对象的数据流分析,对其逃逸方法上下文的方式进行分类,从而将编译期工具不可修复的泄漏与可修复的泄漏区分开,并为后者生成正确修复。该工具是需求驱动的,只分析与该泄漏相关的语句,因此开销较低。作者用五款流行的 Java 资源泄漏检测器产生的警告进行评估,平均为 66% 的警告生成修复,其中 95% 正确,平均修复时间为 14 秒。

问题
静态分析会产生大量资源泄漏警告,而开发者需要自动修复建议;现有通用工具 Footpatch 仅能修复极少数泄漏且正确率很低。
方法
RLFixer 对资源对象做需求驱动的数据流分析,分类其逃逸方法上下文的方式,以此区分编译期不可修复与可修复的泄漏,并为可修复的泄漏生成修复。
评估
将 RLFixer 应用于五款流行 Java 资源泄漏检测器产生的警告,平均为 66% 的警告生成修复,其中 95% 正确,平均修复耗时 14 秒。
原文摘要(Abstract)

Resource leaks are a common and elusive source of bugs that can result in crashes and security vulnerabilities. The most effective technique to identify such leaks during development is static analysis. However, empirical studies show that in addition to leak warnings, developers often need help in the form of automated fix suggestions to correctly repair such leaks. The only existing tool that can suggest resource-leak fixes is the general-purpose tool Footpatch. Footpatch, however, performs poorly at this task; it generates fixes for only 6% of the leaks, out of which only 27% are correct. In this paper, we introduce RLFixer, a specialized repair tool that generates high-quality fixes for resource leaks identified by any resource-leak detector. A major challenge for RLFixer is that the most general version of the resource-leak repair problem is at least as hard as compile-time object deallocation, a well-known hard problem for compilers. RLFixer tackles this issue by separating the resource-leaks that are infeasible for a compile-time tool to fix from those that are feasible to fix. RLFixer achieves this separation by using a data-flow analysis of resource objects to classify how they escape the context of their methods. The same analysis also enables RLFixer to generate correct repairs for the feasible-to-fix leaks. RLFixer is demand-driven and hence only analyzes statements relevant to the leak, thereby keeping overhead low. We evaluated RLFixer by applying it to warnings generated by five popular Java resource-leak detectors. We show that, on average, RLFixer generates repairs for 66% of their warnings, out of which 95% are correct. It has an average repair time of 14 seconds.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{UttureP23,
  title = {From Leaks to Fixes: Automated Repairs for Resource Leak Warnings},
  author = {Akshay Utture and Jens Palsberg},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3616267}
}