Abstract
Diagnosing failures in distributed systems is notoriously difficult due to sparse issue reports and complex execution paths that often cross network boundaries. COCA (Code Knowledge Enhanced Root Cause Analysis) is a novel framework designed to bridge this gap. By intelligently linking log messages to source code and reconstructing execution paths—including "bridging" across Remote Procedure Calls (RPC)—COCA provides Large Language Models (LLMs) with the precise context needed to generate accurate root cause summaries and pinpoint faulty components. Evaluation on real-world datasets shows significant improvements in both localization and diagnostic quality.
Introduction
When complex distributed systems like HDFS or Cassandra fail, developers typically begin their investigation with an issue report containing a brief description, logs, and stack traces. However, these reports are frequently incomplete or ambiguous. Existing automated Root Cause Analysis (RCA) tools often fall short: monitor-driven tools require massive amounts of runtime data that may not be available post-mortem, while LLM-driven tools often "guess" the system's logic without access to the underlying source code.
A specific challenge in distributed environments is the "broken" execution path. A stack trace might indicate a failure on a client machine, but the actual bug resides on a server reached via an RPC. Standard static analysis tools cannot easily traverse these network boundaries, leaving a critical gap in the diagnostic chain.
The COCA Framework
COCA introduces a four-phase pipeline designed to ground LLM reasoning in actual system logic rather than just textual patterns.
- Logging Source Retrieval: Using static analysis, COCA identifies the exact line of code that generated a specific log message, even when the log contains dynamic variables.
- Execution Path Reconstruction: COCA builds an Inter-procedure Control Flow Graph (ICFG). Its core innovation is RPC Bridging, which parses interface definitions (like gRPC) to link client-side calls to server-side implementations, creating a continuous map of the failure.
- Failure-related Code Profiling: To manage LLM token limits, COCA uses a two-stage retrieval process, first presenting method signatures and documentation to identify relevant code, then fetching the full snippets for those specific areas.
- Root Cause Inference: Finally, COCA uses In-Context Learning (ICL) to prompt the LLM with the report, the reconstructed path, and the relevant code to generate a diagnostic summary.
Bridging Logs to Logic
The fundamental insight of COCA is that logs are merely symptoms; the code is the blueprint. By providing the LLM with the logic that precedes a log message, the model moves from simple pattern matching to actual reasoning about the system's intended behavior.
As shown in the example above, COCA can trace a "failed to run job" error back through the JobSubmitter and YarnRunner classes, identifying the specific point where a null status from the Resource Manager (RM) triggered a premature cleanup of the staging area.
Evaluation and Results
The authors evaluated COCA on a curated dataset of 106 real-world issues from five major Apache distributed systems: MapReduce, HDFS, HBase, Cassandra, and ZooKeeper. These systems range from 184K to 1.1M lines of code.
Key results include:
- Localization: A 28.3% improvement in pinpointing responsible components compared to state-of-the-art baselines.
- Summarization: A 22.0% improvement in the quality of root cause summaries (measured by BLEU-4).
- Efficiency: In a case study on HBase, COCA generated a detailed diagnosis in 19.4 seconds—a task that previously took a human expert over three hours.
Conclusion
COCA demonstrates that integrating deep code knowledge and RPC bridging significantly enhances the capability of LLMs in diagnosing distributed system failures. While challenges remain regarding dynamic language features like reflection, the framework provides a robust foundation for automated, high-fidelity root cause analysis. Future work will focus on expanding language support and integrating these capabilities directly into developer IDEs.
Summary updated