Do Bugs Propagate? An Empirical Analysis of Temporal Correlations Among Software Bugs

Xiaodong Gu, Yo-Sub Han, Sunghun Kim, Hongyu ZhangECOOP 2021 · DOI

TL;DR

This paper investigates whether software bugs "propagate" over time, similar to social phenomena. By analyzing temporal correlations between bugs across different software artifact relationships (like function calls and code changes), the authors found significant evidence of bug propagation. They propose a novel "hybrid graph" that effectively captures these temporal bug correlations, offering new avenues for improved bug prediction and localization.

What Problem Does This Paper Address?

Software bugs are rarely isolated events. They can interact, influence each other, and even trigger new bugs. While previous research has hinted at spatial correlations (bugs occurring near each other), this paper tackles a more dynamic question: do bugs propagate over time? Specifically, the authors aim to understand if bugs propagate, how they propagate through software structures, and why this temporal correlation exists. Understanding these temporal dynamics is crucial for developers to better localize bug origins, predict future bugs, and design more resilient software architectures.

Methods

The core methodology of this paper is inspired by social science's approach to studying the spread of phenomena like obesity and happiness. The authors adapt this to software by:

  • Modeling Software Ties as Graphs: They represent relationships between software artifacts (like source files) as graphs. Three types of "software ties" are modeled:
  • Function Call Graph: Edges represent function calls between source files.
  • Type Hierarchy Graph: Edges represent inheritance relationships between classes in different files.
  • Co-Change Graph: Edges represent files that were frequently changed together.
  • Longitudinal Logistic Regression (LLR): This statistical model is used to measure the temporal correlation between a "buggy" artifact (the "ego") and its "buggy neighbors" in the previous time step. The key metric derived is the Logistic Regression Coefficient (LRC), where a higher LRC indicates a stronger temporal correlation.
  • Hybrid Graph Synthesis: Based on the observation that different basic graphs capture bug correlations to varying degrees, the authors propose a "hybrid graph." This graph is constructed by merging edges from the basic graphs, prioritizing those that show stronger historical temporal correlations. This aims to create a more sensitive representation of bug propagation.
  • Edge-Reversal Test: To distinguish true propagation from homophily (e.g., developers who write similar code also introduce similar bugs) or confounding factors, they reverse the direction of edges in the graphs and re-evaluate correlations. If correlations significantly change, it suggests a directional propagation rather than just shared characteristics.

Datasets

The study uses bug repositories from four well-known open-source Java projects:

  • HTTPClient: A library for making HTTP requests.
  • Jackrabbit (JCR): A content repository.
  • Lucene: A search engine library.
  • Rhino: A JavaScript engine.

These projects were chosen for their availability of manually verified bug data and varying project durations and sizes. The data was collected by selecting specific "examination points" (releases) from the project's history to analyze bug occurrences and artifact relationships over time.

Key Insights and Ideas

  • Bugs are Contagious (Temporally): The most significant finding is that bugs do indeed exhibit temporal correlations, meaning a bug in one artifact can increase the likelihood of bugs appearing in related artifacts in the future. This is analogous to how diseases or behaviors spread in social networks.
  • Propagation Varies by Software Tie: Not all relationships between software artifacts are equally prone to bug propagation. The study found that co-change graphs and type hierarchy graphs showed stronger temporal correlations than function call graphs.
  • A Hybrid Approach is More Powerful: A synthesized "hybrid graph," combining information from multiple basic graphs, significantly amplifies the detection of temporal bug correlations, yielding much higher LRC values. This suggests that a multi-faceted view of software relationships is key to understanding bug propagation.
  • Edge Reversal Supports Causality: The edge-reversal test provided evidence that the observed correlations are likely due to directional propagation rather than mere homophily or confounding factors, as correlations changed significantly when edge directions were reversed.
  • Mechanisms of Propagation: The authors identify three primary mechanisms for bug propagation:
  • Code Reuse: Bugs in reused code (e.g., via function calls or inheritance) can propagate to the code that uses them.
  • Bugfix: Fixing one bug can inadvertently introduce or expose another bug in related code.
  • Human Factors: Careless developers might introduce similar bugs across different parts of the codebase due to shared understanding or oversight.

Key Results

  • Significant Temporal Correlations: The average LRC values for the basic graphs were:
  • Function Call Graph: 0.19

    • Type Hierarchy Graph: 0.32
    • Co-Change Graph: 0.39 These values are notably higher than a random graph (LRC=0) and comparable to social phenomena like happiness (LRC=0.12) and obesity (LRC=0.28).
  • Hybrid Graph Performance: The proposed hybrid graph achieved significantly higher average LRCs, reaching 0.66. For individual projects, LRCs for the hybrid graph were as high as 1.09 (HTTPClient).

  • Edge Reversal Impact: The edge-reversal test showed significant changes in LRCs for the hybrid graph in three out of four subjects, supporting the idea of directional bug propagation.

Limitations and Future Work

  • Language Specificity: The study was conducted on Java open-source projects. While the authors believe the approach is generalizable, they acknowledge that results might differ for other programming languages.
  • Examination Point Selection: The choice of examination points (releases) can influence the density and sparsity of the graphs. While efforts were made to mitigate this, the intervals between points were not always equal, which could affect results.
  • Future Work:
    • Investigate temporal bug correlations on a wider range of software graphs.
  • Apply these findings to improve software engineering tasks like defect prediction, correlated bug report linking, and bug localization.
  • Utilize Graph Neural Networks (GNNs) on the proposed hybrid graph to learn bug correlation representations for more advanced defect prediction models.
  • Conduct a more detailed qualitative analysis to quantify the impact of the identified causal mechanisms (code reuse, bugfix, human factors).

Summary updated

BibTeX
@inproceedings{gu2021do,
  author = {Xiaodong Gu and Yo-Sub Han and Sunghun Kim and Hongyu Zhang},
  title = {{Do Bugs Propagate? An Empirical Analysis of Temporal Correlations Among Software Bugs}},
  booktitle = {ECOOP},
  year = {2021},
  doi = {10.4230/lipics.ecoop.2021.11},
}
Figure