CrashTranslator: Automatically Reproducing Mobile Application Crashes Directly from Stack Trace

Yuchao Huang, Junjie Wang, Zhe Liu, Yawen Wang, Song Wang, Chunyang Chen, Yuanzhe Hu, Qing WangICSE 2023

TL;DR

Reproducing mobile app crashes is a time-consuming bottleneck for developers. This paper introduces Crash Translator, a novel system that automatically reproduces crashes directly from stack traces, outperforming existing methods by a significant margin and reducing reproduction time dramatically.

What Problem Does This Paper Address?

Mobile app development is a highly competitive landscape, making swift bug fixing crucial for user retention. Crash reports are a primary source of information for identifying and resolving issues. However, a significant portion of these reports, particularly those generated by automated tools like Crashlytics, only contain a stack trace and lack explicit step-by-step instructions for reproduction. This "stack-trace-only" scenario presents a major challenge, as developers must manually decipher the sequence of user interactions that led to the crash. Existing automated crash reproduction techniques, which rely on natural language descriptions of reproduction steps, are ineffective in these cases. This gap leads to longer debugging cycles and increased development costs.

Methods

Crash Translator tackles the stack-trace-only crash reproduction problem by combining a pre-trained Large Language Model (LLM) with a reinforcement learning (RL) approach. The core idea is to leverage the stack trace to infer the crash-occurring page and involved APIs, and then use these clues to guide an automated exploration of the app.

The process involves three main components:

  • Page Reaching Scorer: This component uses an LLM (specifically, a fine-tuned GPT-3 Curie model) to predict the sequence of GUI pages needed to reach the crash-occurring page. It iteratively asks the LLM to suggest the next page and the widget to interact with to get there.
  • Widget Hitting Scorer: Once the crash-occurring page is reached, this scorer identifies the specific widget that, when interacted with, is most likely to trigger the crash. It achieves this by matching crash-involved APIs extracted from the stack trace with the names of interactable widgets on the page.
  • Exploration Optimization Scorer: This RL-based component acts as a crucial layer to mitigate inaccuracies from the first two scorers. It uses Q-learning to learn from past interactions, assigning rewards or penalties to guide the exploration towards successful crash reproduction and avoid unproductive paths.

The system iteratively selects widgets based on the combined scores from these three components until the target crash is triggered. Finally, it generates a replay script and human-readable reproducing steps with image instructions.

Datasets

The paper uses three datasets for evaluation:

  • ReCDroid's dataset: 33 crash reports.
  • AndroR2 dataset: 22 crash reports.
  • Crash Translator's dataset: 20 crash reports, manually collected from GitHub and filtered for reproducibility.

For training the LLM, the authors used a fine-tuning dataset derived from 1,000 apps from F-Droid, focusing on activity transition graphs. They also used the RICO dataset for fine-tuning the widget prediction.

Key Insights and Ideas

  • Stack traces are more informative than previously thought: While lacking explicit steps, stack traces contain enough implicit information (crash-occurring page, involved APIs) to guide automated crash reproduction.
  • LLMs are powerful for predicting app navigation: The paper demonstrates that LLMs can effectively predict sequences of GUI interactions needed to reach specific app states, a task previously challenging for traditional methods.
  • RL is essential for robust exploration: The integration of reinforcement learning is key to overcoming the inherent inaccuracies of LLM predictions and guiding the exploration process efficiently, especially in complex app structures.
  • Automated reproduction can significantly outperform manual efforts: The results highlight a substantial speedup and higher success rate compared to manual reproduction or existing automated tools, indicating a paradigm shift in crash debugging.

Key Results

Crash Translator achieved a success rate of 61.3% (46 out of 75 crash reports) across the evaluated datasets. This significantly outperforms baselines like ReCDroidST (22.7%), Monkey (17.3%), Humanoid (25.3%), Ape (29.3%), and Q-Testing (20%).

In terms of efficiency, Crash Translator reproduced crashes in an average of 68.7 seconds. This is dramatically faster than the baselines, with speedups ranging from 302% to 1611%.

Furthermore, human evaluation showed that the reproducing steps generated by Crash Translator enabled participants to reproduce crashes 215% faster than using only stack traces.

Limitations and Future Work

The authors acknowledge several limitations:

  • Incomplete stack traces: Crashes not directly tied to specific pages or APIs (e.g., network-related issues) may not be reproducible.
  • Invalid input requirements: Crashes requiring specific user inputs (like valid credentials) cannot be fully automated without user intervention.
  • Uncaptured preconditions: Complex scenarios where a crash is triggered by specific settings or environmental conditions (e.g., dark theme) are not currently handled.

Future work includes investigating techniques to incorporate these preconditions and further improving the system's ability to handle a wider range of crash types.

Summary updated

BibTeX
@inproceedings{huang2023crashtranslator,
  author = {Yuchao Huang and Junjie Wang and Zhe Liu and Yawen Wang and Song Wang and Chunyang Chen and Yuanzhe Hu and Qing Wang},
  title = {{CrashTranslator: Automatically Reproducing Mobile Application Crashes Directly from Stack Trace}},
  booktitle = {ICSE},
  year = {2023},
}
Figure