paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Detection of Java Basic Thread Misuses Based on Static Event Analysis

基于静态事件分析的 Java 基本线程误用检测
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 2/10 · 论文研究 Java 并发线程误用的静态分析,属于传统程序分析,未涉及 LLM/Agent、浮点或贝叶斯程序分析,与用户关注的 PL 与 AI 交叉方向不匹配。引用 4 inbox
Baoquan Cui, Miaomiao Wang, Chi Zhang, Jiwei Yan, Jun Yan, Jian Zhang
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出基于静态事件分析的 Java 基本线程误用检测方法,并实现工具 Leopard。

Java 基础异步线程 java.lang.Thread 容易被误用:开发者若不了解垃圾回收与线程中断机制,可能写出无法及时响应中断的代码,造成资源泄漏或浪费。现有动态方法缺乏有效输入,路径敏感静态方法则因路径爆炸耗时高且漏报。本文观察到线程行为及其与引用对象的交互可被抽象,提出事件分析方法,聚焦事件是否存在及其顺序以减少漏报。方法抽取线程事件及线程引用对象的销毁事件等误用相关事件,并借助循环识别、happens-before 关系构建和别名判定进行分析,实现工具 Leopard。在真实 Java 程序和 Android 应用上,Leopard 比已有方法检测到更多误用(723 vs 47),耗时更短(60s vs 30min),精度更优;报告的 66 个问题获确认,其中 21 个已修复。

问题
Java 基础异步线程存在因垃圾回收与中断机制理解不足而导致的误用,现有动态方法缺乏有效输入,路径敏感静态方法则因路径爆炸耗时高且漏报。
方法
将线程行为及其与引用对象的交互抽象为事件,抽取线程事件和引用对象销毁事件,结合循环识别、happens-before 构建与别名判定进行静态事件分析,并实现工具 Leopard。
评估
在真实 Java 程序与 Android 应用上与已有方法对比,检测到 723 处误用(对比 47 处),耗时 60s(对比 30min),精度更优;66 个报告问题获确认,21 个已修复。
原文摘要(Abstract)

The fundamental asynchronous thread (java.lang. Thread) in Java can be easily misused, due to the lack of deep understanding for garbage collection and thread interruption mechanism. For example, a careless implementation of asynchronous thread may cause no response to the interrupt mechanism in time, resulting in unexpected thread-related behaviors, especially resource leak/waste. Currently, few works aim at these misuses and related works adopt either the dynamic approach which lacks effective inputs or the static path-sensitive approach with high time consumption due to the path explosion, causing false negatives. We have found that the behavior of threads and the interaction between threads and its referencing objects can be abstracted. In this paper, we propose an event analysis approach to detect the defects in Java programs and Android apps, which focuses on the existence or the order of the events to reduce the false negatives. We extract the misuse-related events, containing the thread events and the destroy events of the object referenced by the thread. Then we analyze the events with loop identification, happens-before relationship construction and alias determination. Finally, we implement an automatic tool named Leopard and evaluate it on real world Java programs and Android apps. Experiments show that it is efficient when comparing with the existing approach (misuse: 723 vs 47, time: 60s vs 30min), which also outperforms the existing work in precision. The manual check indicates that Leopard is more efficient and effective than existing work. Besides, 66 issues reported by us have been confirmed and 21 of them have been fixed by developers.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{CuiWZYYZ23,
  title = {Detection of Java Basic Thread Misuses Based on Static Event Analysis},
  author = {Baoquan Cui and Miaomiao Wang and Chi Zhang and Jiwei Yan and Jun Yan and Jian Zhang},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00145}
}