Skip to main content
QUICK REVIEW

[论文解读] Exposing Non-Atomic Methods of Concurrent Objects

Michael Emmi, Constantin Enea|arXiv (Cornell University)|Jun 28, 2017
Distributed systems and fault tolerance参考文献 2被引用 5
一句话总结

本文提出一种自动化方法,通过生成最小测试框架并对照预先计算的原子返回值组合集验证结果,检测来自 Java 开发工具包(JDK)的并发对象中的原子性违规。该方法实现高吞吐量测试(每核每秒数百万次执行),在广泛使用的并发数据结构(如 ConcurrentSkipListMap 和 ConcurrentHashMap)中发现罕见的原子性违规。

ABSTRACT

Multithreaded software is typically built with specialized concurrent objects like atomic integers, queues, and maps. These objects' methods are designed to behave according to certain consistency criteria like atomicity, despite being optimized to avoid blocking and exploit parallelism, e.g., by using atomic machine instructions like compare and exchange (cmpxchg). Exposing atomicity violations is important since they generally lead to elusive bugs that are difficult to identify, reproduce, and ultimately repair. In this work we expose atomicity violations in concurrent object implementations from the most widely-used software development kit: The Java Development Kit (JDK). We witness atomicity violations via simple test harnesses containing few concurrent method invocations. While stress testing is effective at exposing violations given catalytic test harnesses and lightweight means of falsifying atomicity, divining effectual catalysts can be difficult, and atomicity checks are generally cumbersome. We overcome these problems by automating test-harness search, and establishing atomicity via membership in precomputed sets of acceptable return-value outcomes. Our approach enables testing millions of executions of each harness each second (per processor core). This scale is important since atomicity violations are observed in very few executions (tens to hundreds out of millions) of very few harnesses (one out of hundreds to thousands). Our implementation is open source and publicly available.

研究动机与目标

  • 识别并暴露广泛使用的 Java 开发工具包(JDK)中并发数据结构的原子性违规。
  • 克服压力测试的挑战,如难以找到有效的测试触发器以及手动原子性检查成本高昂的问题。
  • 自动化搜索能够暴露并发对象方法中原子性违规的最小、最有效的测试框架。
  • 通过用快速结果集查找替代昂贵的线性化枚举,实现可扩展的、高性能的并发执行测试。
  • 提供一种与语言无关、开源的框架,用于检测并发库中的原子性违规,且无需访问实现代码。

提出的方法

  • 自动生成包含一个非核心方法和多个核心方法调用的微型、最小化测试框架,作为原子性违规的触发催化剂。
  • 静态索引方法调用,以实现每种执行的快速、确定性结果向量计算。
  • 为每个框架预先计算所有与原子行为(线性化)一致的可能返回值结果向量。
  • 通过检查执行结果是否属于预先计算的原子结果集合来验证每个执行,从而替代昂贵的线性化枚举。
  • 使用高性能测试自动化框架,实现在每处理器核心每秒数百万次并发执行。
  • 采用轻量级仪器化技术记录方法返回值,并确保验证过程中结果记录的确定性。

实验结果

研究问题

  • RQ1自动化测试框架生成是否能有效暴露 JDK 并发对象中罕见的原子性违规?
  • RQ2预先计算的原子结果向量集合是否能够替代昂贵的线性化枚举,从而实现可扩展的原子性检查?
  • RQ3该方法在检测真实世界并发数据结构(如 ConcurrentSkipListMap 和 ConcurrentHashMap)中的原子性违规方面效果如何?
  • RQ4所检测到的违规是实现错误,还是由于规格说明不精确而被有意允许的行为?
  • RQ5该方法在多大程度上可推广至其他并发库和编程语言?

主要发现

  • 该方法成功检测到 java.util.concurrent 包中 10 个类存在原子性违规,包括 ConcurrentSkipListMap 和 ConcurrentHashMap。
  • 原子性违规在每百万次执行中仅出现数十至数百次,凸显了高吞吐量测试的必要性。
  • 与先前方法相比,该方法在框架执行速率上实现了 31.5 倍的性能提升,实现每核每秒数百万次执行。
  • 在 ConcurrentSkipListMap 的 clear 方法中发现一个关键缺陷:在并发 put 操作下,containsKey 可能返回 false,尽管之前已对同一 key 执行了 put 操作。
  • 作者指出,许多违规可能不被视为错误,因为规格说明不精确,但对依赖原子性的客户端而言仍为问题行为。
  • 该方法在无需访问实现源代码的情况下依然有效,仅依赖可观测的方法返回值和结果验证。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。