一句话:构建了目前最大、标注完整且可复现的 Java 资源泄漏缺陷仓库 JLeaks,并分析其分布、根因与修复方式。
高质量缺陷仓库对缺陷检测、定位与修复至关重要,但现有开源项目缺陷仓库往往规模小或标注、打包不足。本文系统总结了 Java 中文件、套接字和线程等系统资源的编程 API,并说明了链式与嵌套流操作中可能引发资源泄漏的异常。作者构建半自动工具链以提高缺陷抽取效率,包括对大型遗留 Java 项目的自动构建,并从 GitHub 321 个开源项目中收集了 1,094 个资源泄漏。通过逐轮过滤与交叉验证,涉及约 3,185 次提交审查,最终建成 JLeaks。其中 254 个缺陷带有原因、位置、补丁、源文件和编译字节码等完整标注。本文还分析了缺陷分布、根因与修复方式,并与两个知名资源泄漏仓库对比,表明 JLeaks 信息更丰富、更完整,具有高可用性、唯一性和一致性,并展示了两个应用场景。
High-quality defect repositories are vital in defect detection, localization, and repair. However, existing repositories collected from open-source projects are either small-scale or inadequately labeled and packed. This paper systematically summarizes the programming APIs of system resources (i.e., file, socket, and thread) in Java. Additionally, this paper demonstrates the exceptions that may cause resource leaks in the chained and nested streaming operations. A semi-automatic toolchain is built to improve the efficiency of defect extraction, including automatic building for large legacy Java projects. Accordingly, 1,094 resource leaks were collected from 321 open-source projects on GitHub. This repository, named JLeaks, was built by round-by-round filtering and cross-validation, involving the review of approximately 3,185 commits from hundreds of projects. JLeaks is currently the largest resource leak repository, and each defect in JLeaks is well-labeled and packed, including causes, locations, patches, source files, and compiled bytecode files for 254 defects. We have conducted a detailed analysis of JLeaks for defect distribution, root causes, and fix approaches. We compare JLeaks with two well-known resource leak repositories, and the results show that JLeaks is more informative and complete, with high availability, uniqueness, and consistency. Additionally, we show the usability of JLeaks in two application scenarios. Future studies can leverage our repository to encourage better design and implementation of defect-related algorithms and tools.
@inproceedings{paperbot11275,
title = {JLeaks: A Featured Resource Leak Repository Collected From Hundreds of Open-Source Java Projects},
author = {Tianyang Liu and Weixing Ji and Xiaohui Dong and Wuhuang Yao and Yizhuo Wang and Hui Liu and Haiyang Peng and Yuxuan Wang},
booktitle = {ICSE},
year = {2024},
doi = {10.1145/3597503.3639162}
}