RUS  ENG
Full version
JOURNALS // Proceedings of the Institute for System Programming of the RAS // Archive

Proceedings of ISP RAS, 2015 Volume 27, Issue 2, Pages 39–52 (Mi tisp121)

Detecting race conditions in Java programs using dynamic analysis

M. Ermakov, S. Vartanov

Department of Computational Mathematics and Cybernethics, Moscow State University

Abstract: Multithreading support is one of Java programming language built-in features. Synchronization defects are a serious issue despite the extensive thread processing API provided by standard classes. One of the most common synchronization defects is a race condition. It arises when two different threads read and modify shared data and data access order is not fixed. This paper focuses on an approach to automatically detect race conditions using dynamic analysis. The main advantage of dynamic analysis is the lack of false positives if program under analysis fits a number of requirements. Our approach for dynamic analysis uses static bytecode instrumentation to extract execution trace at run-time which allows to track usage for thread synchronization methods and functions. Generated trace is a concrete execution model which is processed to identify happen-before relations and lock sets for possible data race detection. We use Coffee Machine tool for static instrumentation. Static instrumentation approach is applicable even to virtual machines which do not provide support for dynamic instrumentation. We use ThreadSanitizer Offline to process generated trace and detect race conditions. While debug information in bytecode is unnecessary it provides more precise error messages. Described tool chain has been tested on a set of open source projects.

Keywords: dynamic analysis, race condition, synchronization defects.

DOI: 10.15514/ISPRAS-2015-27(2)-3



Bibliographic databases:


© Steklov Math. Inst. of RAS, 2024