paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Compositional Deadlock Detector for Android Java

面向 Android Java 的组合式死锁检测器
ASE 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE)2021匹配度 4/10 · 论文是静态分析与抽象解释在Android Java并发死锁检测中的工业落地,兼具理论形式化和工程部署,符合部分兴趣;但未涉及LLM/Agent、浮点程序分析或贝叶斯程序分析,与用户核心的PL-AI交叉方向关联有限。引用 9 inbox
James Brotherston, Paul Brunet, Nikos Gorogiannis, Max Kanovich
crossref: 2026-09-12

AI 速览

一句话:为超大规模 Android Java 应用提出组合式静态死锁检测,基于临界对将问题判定为 NP 并部署于 Infer。

本文面向 Facebook 在研的商用 Android Java 应用(数千万行代码),提出一种可在代码评审时仅分析改动代码及其依赖、并在约 15 分钟内给出报告的静态死锁分析。作者将真实语言抽象为带平衡可重入锁、非确定性迭代/分支和非递归过程调用的抽象语言,证明死锁存在性等价于各程序线程 critical pairs(临界对)集合上的某条件;由于临界对有限且可计算,该死锁检测问题可判定且属于 NP。实现采用组合式抽象解释风格计算临界对,运行时间为拟指数级,并以开源形式构建于 Infer 验证框架;已工业部署两年多,收到 200 多份已修复死锁报告,修复率约 54%。

问题
在数千万行、持续演进的商用 Android Java 代码上,如何在代码评审时快速且可扩展地检测真实并发死锁。
方法
将语言抽象为带平衡可重入锁、非确定性控制流和非递归调用的模型,用每线程临界对刻画死锁,并以组合式抽象解释计算临界对。
评估
在 Facebook 工业部署两年多,分析改动代码及其依赖,报告 200 多例已修复死锁,修复率约 54%。
原文摘要(Abstract)

We develop a static deadlock analysis for commercial Android Java applications, of sizes in the tens of millions of LoC, under active development at Facebook. The analysis runs primarily at code-review time, on only the modified code and its dependents; we aim at reporting to developers in under 15 minutes.To detect deadlocks in this setting, we first model the real language as an abstract language with balanced re-entrant locks, nondeterministic iteration and branching, and non-recursive procedure calls. We show that the existence of a deadlock in this abstract language is equivalent to a certain condition over the sets of critical pairs of each program thread; these record, for all possible executions of the thread, which locks are currently held at the point when a fresh lock is acquired. Since the critical pairs of any program thread is finite and computable, the deadlock detection problem for our language is decidable, and in NP.We then leverage these results to develop an open-source implementation of our analysis adapted to deal with real Java code. The core of the implementation is an algorithm which computes critical pairs in a compositional, abstract interpretation style, running in quasi-exponential time. Our analyser is built in the Infer verification framework and has been in industrial deployment for over two years; it has seen over two hundred fixed deadlock reports with a report fix rate of ~54%.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot6572,
  title = {A Compositional Deadlock Detector for Android Java},
  author = {James Brotherston and Paul Brunet and Nikos Gorogiannis and Max Kanovich},
  booktitle = {ASE},
  year = {2021},
  doi = {10.1109/ase51524.2021.9678572}
}