TemCon: An Approach to Fixing Concurrency Bugs by Extracting Templates
Concurrency bugs occur due to the uncertainty of thread scheduling within concurrent programs. Most of the existing concurrency bug fixing approaches fix concurrency bugs by serializing the execution of all threads involved in concurrency bugs. However, they face the threats of introducing new deadlocks and lead to high runtime overhead while fixing the concurrency bugs. On the other hand, most of the approaches are biased toward fixing only one type of concurrency bug, e.g. data races, deadlocks, or atomicity violations. In this paper, we propose TemCon, a template-based concurrency bug fixing approach that constructs fine-grained semantic change graphs on patch files based on Abstract Syntax Trees (ASTs) to mine accurate fixing templates. First, it constructs fine-grained semantic change graphs on patch files and splits the graphs into three subgraphs (i.e. attribute graphs, operation graphs and text graphs). Then, the fixing templates are extracted by clustering the same graph pairs. Finally, the buggy programs are matched with the fixing templates to generate the patches for fixing concurrency bugs. We constructed a new concurrency bug dataset with 1830 concurrency bug fixing patches and compared our approach with the state-of-the-arts in our experiments. The experimental results show that our approach can correctly fix 887 concurrency bugs without introducing new deadlocks, which is 684 and 93 more than Grail and PFix, respectively. TemCon can achieve a fixing accuracy of 48.47%, which is 5.08–37.38% higher than that of the state-of-the-art approaches.
Authors
- Lili Bo (ORCID: https://orcid.org/0000-0002-7267-4923)
- Guofeng Zhang (ORCID: https://orcid.org/0000-0001-5854-5247)
- Yun Yang (ORCID: https://orcid.org/0000-0002-2709-6423)
- Md Mahfuzur Rahman (ORCID: https://orcid.org/0000-0002-5366-018X)
- Md. Nazmus Sakib (ORCID: https://orcid.org/0000-0002-8828-8197)
- Yanchi Yuan
Institutions
- Yunnan University (CN)
- Yangzhou University (CN)
Publication Details
- Journal
- International Journal of Software Engineering and Knowledge Engineering
- Published
- 2025-10-17
- DOI
- https://doi.org/10.1142/s0218194025500822
- Primary Topic
- Software Testing and Debugging Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00