Abstract
We propose an automated mining-based method for explaining concurrency bugs. We use a data mining technique called sequential pattern mining to identify problematic sequences of concurrent read and write accesses to the shared memory of a multithreaded program. Our technique does not rely on any characteristics specific to one type of concurrency bug, thus providing a general framework for concurrency bug explanation. In our method, given a set of concurrent execution traces, we first mine sequences that frequently occur in failing traces and then rank them based on the number of their occurrences in passing traces. We consider the highly ranked sequences of events that occur frequently only in failing traces an explanation of the system failure, as they can reveal its causes in the execution traces. Since the scalability of sequential pattern mining is limited by the length of the traces, we present an abstraction technique which shortens the traces at the cost of introducing spurious explanations. Spurious as well as misleading explanations are then eliminated by a subsequent filtering step, helping the programmer to focus on likely causes of the failure. We validate our approach using a number of case studies, including synthetic as well as real-world bugs.
Introduction
Concurrency bugs, such as data races and atomicity violations, are notoriously difficult to debug due to their non-deterministic nature. A program may execute correctly thousands of times before failing on a rare, specific interleaving of threads. Traditional debugging tools often focus on specific bug templates, but many real-world failures involve complex order violations that do not fit these predefined patterns. Furthermore, even when a failure is captured, the resulting execution traces can be thousands of events long, making it nearly impossible for developers to manually identify the root cause.
This paper introduces an automated, "bug-oblivious" method for explaining these failures. By treating bug explanation as a statistical anomaly detection problem in execution traces, the proposed framework can isolate the specific thread interactions that trigger crashes without prior knowledge of the bug type.
Methodology: From Raw Traces to Explanations
The proposed pipeline consists of four primary phases designed to transform massive amounts of execution data into human-readable insights:
- Trace Generation and Partitioning: Using systematic testing tools, the system generates various thread interleavings, labeling them as either "passing" or "failing."
- Macro-Event Abstraction: To address the scalability limits of data mining, the authors introduce a novel abstraction technique. Consecutive events from the same thread are grouped into "macros," and these are further abstracted based on shared memory locations. This process preserves critical context switches while significantly shortening the trace.
- Sequential Pattern Mining: Algorithms like PrefixSpan are applied to find sequences of events that appear frequently in failing traces but rarely in passing ones.
- Ranking and Filtering: Patterns are ranked by relative support to highlight sequences exclusive to failures. A final filtering step removes "spurious" patterns—artifacts of the abstraction process—to ensure the output corresponds to actual data dependencies.
Key Insights and Results
The core innovation of this approach is its bug-type agnostic nature. Rather than searching for a specific "data race" signature, it looks for statistical anomalies in interleavings. This allows it to identify logic errors and complex multi-variable violations that formal methods might miss.
Experimental Performance
The approach was evaluated on nine case studies, ranging from synthetic bugs to real-world kernels from Apache and Mozilla, and the full bzip2smp application. Key results include:
- Massive Compression: The abstraction technique reduced trace lengths by an average of 91%, and up to 99% in the case of
bzip2smp, making mining computationally feasible. - High Precision: In every case study, the top-ranked pattern correctly identified the root cause of the bug.
- Efficiency: The mining and post-processing steps averaged only 27 seconds.
- Developer Impact: A user study with 32 students demonstrated that those provided with mined patterns identified bugs 5 minutes faster on average than those working with raw code alone.
Limitations and Future Work
While effective, the current framework operates as an offline analysis tool, which can incur logging overhead. Future work aims to move toward "online" mining as traces are generated. Additionally, the current model focuses on safety properties (crashes/assertions) and does not yet address liveness bugs like deadlocks. Finally, the method assumes failures are primarily caused by scheduling; bugs triggered by specific input values rather than interleavings may require further statistical modeling.
Summary updated