paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Fray: An Efficient General-Purpose Concurrency Testing Platform for the JVM

Fray:面向 JVM 的高效通用并发测试平台
OOPSLA 9(OOPSLA2)2025匹配度 2/10 · 该论文是 JVM 上的动态并发测试平台(controlled concurrency testing,基于 shadow locking 与交错搜索算法),属于测试/调试与并发方向,与画像核心的静态分析×LLM/Agent、浮点程序分析、贝叶斯程序分析均无交集,仅同属 PL/软件工程大领域。引用 0 inbox
Ao Li, Byeongjee Kang, Vasudev Vikram, Isabella Laybourn, Samvid Dharanikota, Shrey Tiwari, Rohan Padhye
crossref: 2026-09-10

AI 速览

一句话:提出 Fray,用 shadow locking 在不替换 JVM 现有并发原语的前提下实现受控并发测试,支持多种交错搜索算法并显著发现更多并发缺陷。

并发缺陷即使在无数据竞争的良同步程序中也难以发现和复现,而已有受控并发测试(CCT)算法难以用于真实 Java 程序:托管运行时与复杂同步原语使并发难以控制,成熟项目仍依赖朴素压力测试。本文从第一性原理梳理在任意 JVM 应用上实现 CCT 的设计空间,指出现有并发 mock、VM 改造、OS 级调度等选择在缺陷发现能力与适用范围上的局限,并提出 Fray:用 shadow locking 在不替换现有并发原语的前提下编排线程交错,忠实表达所有可能行为,从而支持随机游走、PCT、POS、SURW 等搜索算法。在 53 个含已知缺陷的基准上,Fray 随机游走比 JPF 多发现 70%、比 rr chaos 模式多发现 77% 的缺陷;在 Kafka、Lucene、Guava 的 2,664 个测试上发现 18 个真实缺陷,导致 371 个测试在特定交错下失败。

问题
并发缺陷(含无数据竞争的缺陷)难以发现与复现,而现有受控并发测试算法因托管运行时和复杂同步原语难以应用于真实 Java 程序,工业实践仍退化为朴素的循环压力测试。
方法
从第一性原理分析在 JVM 上实现通用 CCT 的需求与设计空间,提出 Fray 平台,其核心机制 shadow locking 在不替换现有并发原语的前提下编排线程交错,从而可插拔地运行随机游走、PCT、POS、SURW 等搜索算法。
评估
在 53 个含已知缺陷的基准程序(SCTBench、JaConTeBe)上与 JPF、rr chaos 模式对比缺陷发现数量,并在 Apache Kafka、Lucene、Google Guava 的 2,664 个测试上做开箱即用的真实项目验证。
原文摘要(Abstract)

Concurrency bugs are hard to discover and reproduce, even in well-synchronized programs that are free of data races. Thankfully, prior work on controlled concurrency testing (CCT) has developed sophisticated algorithms—such as partial-order based and selectively uniform sampling—to effectively search over the space of thread interleavings. Unfortunately, in practice, these techniques cannot easily be applied to real-world Java programs due to the difficulties of controlling concurrency in the presence of the managed runtime and complex synchronization primitives. So, mature Java projects that make heavy use of concurrency still rely on naive repeated stress testing in a loop. In this paper, we take a first-principles approach for elucidating the requirements and design space to enable CCT on arbitrary real-world JVM applications. We identify practical challenges with classical design choices described in prior work—such as concurrency mocking, VM hacking, and OS-level scheduling—that affect bug-finding effectiveness and/or the scope of target applications that can be easily supported. Based on these insights, we present Fray, a new platform for performing push-button concurrency testing (beyond data races) of JVM programs. The key design principle behind Fray is to orchestrate thread interleavings without replacing existing concurrency primitives, using a concurrency control mechanism called shadow locking for faithfully expressing the set of all possible program behaviors. With full concurrency control, Fray can test applications using a number of search algorithms from a simple random walk to sophisticated techniques like PCT, POS, and SURW. In an empirical evaluation on 53 benchmark programs with known bugs (SCTBench and JaConTeBe), Fray with random walk finds 70% more bugs than JPF and 77% more bugs than rr ’s chaos mode. We also demonstrate Fray’s push-button applicability on 2,664 tests from Apache Kafka, Lucene, and Google Guava. In these mature projects, Fray successfully discovered 18 real-world concurrency bugs that can cause 371 of the existing tests to fail under specific interleavings. We believe that Fray serves as a bridge between classical academic research and industrial practice— empowering developers with advanced concurrency testing algorithms that demonstrably uncover more bugs, while simultaneously providing researchers a platform for large-scale evaluation of search techniques.

链接与引用

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

BibTeX
@article{paperbot2980,
  title = {Fray: An Efficient General-Purpose Concurrency Testing Platform for the JVM},
  author = {Ao Li and Byeongjee Kang and Vasudev Vikram and Isabella Laybourn and Samvid Dharanikota and Shrey Tiwari and Rohan Padhye},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {OOPSLA2},
  year = {2025},
  doi = {10.1145/3764119}
}