Skip to main content
QUICK REVIEW

[Paper Review] Exposing Non-Atomic Methods of Concurrent Objects

Michael Emmi, Constantin Enea|arXiv (Cornell University)|Jun 28, 2017
Distributed systems and fault toleranceComputer Science2 references5 citations
TL;DR

This paper presents an automated method to detect atomicity violations in concurrent objects from the Java Development Kit (JDK) by generating minimal test harnesses and validating outcomes against precomputed sets of atomic return-value combinations. The approach enables high-throughput testing (millions of executions per second per core), uncovering rare atomicity violations in widely used concurrent data structures like ConcurrentSkipListMap and 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.

Motivation & Objective

  • To identify and expose atomicity violations in concurrent data structures from the widely used Java Development Kit (JDK).
  • To overcome the challenges of stress testing, such as difficulty in finding effective test catalysts and the high cost of manual atomicity checks.
  • To automate the search for minimal, effective test harnesses that expose atomicity violations in concurrent object methods.
  • To enable scalable, high-performance testing of concurrent executions by replacing expensive linearization enumeration with fast outcome-set lookups.
  • To provide a language-agnostic, open-source framework for detecting atomicity violations in concurrent libraries without requiring access to implementation code.

Proposed method

  • Automatically generates small, minimal test harnesses containing one non-core method and multiple core method invocations to act as catalysts for atomicity violations.
  • Indexes method invocations statically to enable fast, deterministic outcome-vector computation for each execution.
  • Precomputes all possible return-value outcome vectors that are consistent with atomic behavior (linearizability) for each harness.
  • Validates each execution's outcome by checking membership in the precomputed set of atomic outcomes, replacing costly linearization enumeration.
  • Uses a high-performance test automation framework to execute millions of concurrent executions per second per processor core.
  • Employs lightweight instrumentation to record method return values and ensure deterministic outcome recording for validation.

Experimental results

Research questions

  • RQ1Can automated test harness generation effectively expose rare atomicity violations in concurrent objects from the JDK?
  • RQ2Can precomputed sets of atomic outcome vectors replace expensive linearization enumeration to enable scalable atomicity checking?
  • RQ3How effective is the approach in detecting atomicity violations in real-world concurrent data structures like ConcurrentSkipListMap and ConcurrentHashMap?
  • RQ4Are the detected violations due to implementation bugs or intentionally allowed behavior due to imprecise specifications?
  • RQ5To what extent can this method be generalized to other concurrent libraries and programming languages?

Key findings

  • The method successfully detected 10 classes in the java.util.concurrent package with atomicity violations, including ConcurrentSkipListMap and ConcurrentHashMap.
  • Atomicity violations were observed in as few as tens to hundreds of executions out of millions, highlighting the need for high-throughput testing.
  • The approach achieved a 31.5× speedup in harness execution rate compared to prior methods, enabling millions of executions per second per core.
  • A critical bug was found in ConcurrentSkipListMap’s clear method, where a concurrent put could cause containsKey to return false despite a prior put for the same key.
  • The authors identified that many violations may not be considered bugs due to imprecise specifications, but still represent problematic behavior for clients relying on atomicity.
  • The approach is effective without access to implementation source code, relying only on observable method return values and outcome validation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.