2013 IEEE Sixth International Conference on Software Testing, Verification and Validation (2013)
Luxembourg, Luxembourg Luxembourg
Mar. 18, 2013 to Mar. 22, 2013
DOI Bookmark: http://doi.ieeecomputersociety.org/10.1109/ICST.2013.41
Concurrent collections provide thread-safe, highly-scalable operations, and are widely used in practice. However, programmers can misuse these concurrent collections when composing two operations where a check on the collection (such as non-emptiness) precedes an action (such as removing an entry). Unless the whole composition is atomic, the program contains an atomicity violation bug. In this paper we present the first empirical study of CHECK-THEN-ACT idioms of Java concurrent collections in a large corpus of open-source applications. We catalog nine commonly misused CHECK-THEN-ACT idioms and show the correct usage. We quantitatively and qualitatively analyze 28 widely-used open source Java projects that use Java concurrency collections- comprising 6.4M lines of code. We classify the commonly used idioms, the ones that are the most error-prone, and the evolution of the programs with respect to misused idioms. We implemented a tool, CTADETECTOR, to detect and correct misused CHECK-THEN-ACT idioms. Using CTADETECTOR we found 282 buggy instances. We reported 155 to the developers, who examined 90 of them. The developers confirmed 60 as new bugs and accepted our patch. This shows that CHECK-THEN-ACT idioms are commonly misused in practice, and correcting them is important.
Computer bugs, Semantics, Synchronization, Libraries, Java, Catalogs, Industries, Empirical Study, Java Concurrent Collection, Check-then-Act, Atomicity Violation
Y. Lin and D. Dig, "CHECK-THEN-ACT Misuse of Java Concurrent Collections," 2013 IEEE Sixth International Conference on Software Testing, Verification and Validation(ICST), Luxembourg, Luxembourg Luxembourg, 2013, pp. 164-173.