Detection of Java Basic Thread Misuses Based on Static Event Analysis
Baoquan Cui, Miaomiao Wang, Chi Zhang, Jiwei Yan, Jun Yan, Jian Zhang
Abstract
The fundamental asynchronous thread (java.la -ng.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.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 080d64ad-7a3f-47fd-b086-d8dcaff24c3aBuilds on4
- Lightweight and modular resource leak verificationMartin Kellogg, Narges Shadab, Manu Sridharan, Michael D. ErnstFSE 2021 · 14 citations
- Automated construction of energy test oracles for AndroidReyhaneh Jabbarvand, Forough Mehralian, Sam MalekFSE 2020 · 13 citations
- Static asynchronous component misuse detection for Android applicationsLinjie Pan, Baoquan Cui, Hao Liu, Jiwei Yan et al.FSE 2020 · 10 citations
- ER Catcher: A Static Analysis Framework for Accurate and Scalable Event-Race Detection in AndroidNavid Salehnamadi, Abdulaziz Alshayban, Iftekhar Ahmed, Sam MalekASE 2020 · 5 citations
Related papers
- Flaky test detection in Android via event order explorationZhen Dong, Abhishek Tiwari, Xiao Liang Yu, Abhik RoychoudhuryFSE 2021 · 25 citations
- AsyncLeakBench: A Curated Benchmark of Asynchronous Resource Leaks in Open-Source Java ProjectsJinyoung Kim, Jinseok Heo, Dongwook Choi, Eunseok LeeISSTA 2026
- Project-Level Resource Leak Detection through Agent-based Ownership Analysis and Repair Pattern VerificationChengxin Xu, Xiu Zhang, Xiaorui GongICSE 2026
- Static executes-before analysis for event driven programsRekha R. Pai, Abhishek Uppar, Akshatha Shenoy, Pranshul Kushwaha et al.FSE 2022
- JLeaks: A Featured Resource Leak Repository Collected From Hundreds of Open-Source Java ProjectsTianyang Liu, Weixing Ji, Xiaohui Dong, Wuhuang Yao et al.ICSE 2024 · 1 citation
