Effective Techniques for Static Race Detection in Java Parallel Loops

Despite significant progress in recent years, the important problem of static race detection remains open. Previous techniques took a general approach and looked for races by analyzing the effects induced by low-level concurrency constructs (e.g., java.lang.Thread). But constructs and libraries for expressing parallelism at a higher level (e.g., fork-join, futures, parallel loops) are becoming available in all major programming languages. We claim that specializing an analysis to take advantage of the extra semantic information provided by the use of these constructs and libraries improves precision and scalability. We present IteRace, a set of techniques that are specialized to use the intrinsic thread, safety, and dataflow structure of collections and of the new loop parallelism mechanism introduced in Java 8. Our evaluation shows that IteRace is fast and precise enough to be practical. It scales to programs of hundreds of thousands of lines of code and reports very few race warnings, thus avoiding a common pitfall of static analyses. In five out of the seven case studies, IteRace reported no false warnings. Also, it revealed six bugs in real-world applications. We reported four of them: one had already been fixed, and three were new and the developers confirmed and fixed them. Furthermore, we evaluate the effect of each specialization technique on the running time and precision of the analysis. For each application, we run the analysis under 32 different configurations. This allows to analyze each technique's effect both alone and in all possible combinations with other techniques.

[1]  Thomas R. Gross,et al.  Object race detection , 2001, OOPSLA '01.

[2]  Tomofumi Yuki,et al.  Array dataflow analysis for polyhedral X10 programs , 2013, PPoPP '13.

[3]  Martin D. Westhead,et al.  A benchmark suite for high performance Java , 2000, Concurr. Pract. Exp..

[4]  Kathryn S. McKinley,et al.  Data flow analysis for software prefetching linked data structures in Java , 2001, Proceedings 2001 International Conference on Parallel Architectures and Compilation Techniques.

[5]  Wenguang Chen,et al.  RACEZ: a lightweight and non-invasive race detection tool for production applications , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[6]  Michael D. Ernst,et al.  Refactoring sequential Java code for concurrency via concurrent libraries , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[7]  Clark Verbrugge,et al.  Component-Based Lock Allocation , 2007, 16th International Conference on Parallel Architecture and Compilation Techniques (PACT 2007).

[8]  Alexander Aiken,et al.  Conditional must not aliasing for static race detection , 2007, POPL '07.

[9]  Danny Dig,et al.  How do developers use parallel libraries? , 2012, SIGSOFT FSE.

[10]  Yu Lin,et al.  CHECK-THEN-ACT Misuse of Java Concurrent Collections , 2013, 2013 IEEE Sixth International Conference on Software Testing, Verification and Validation.

[11]  Edith Schonberg,et al.  On-the-fly detection of access anomalies , 2018, PLDI '89.

[12]  Yun Zhang,et al.  Static data race detection for concurrent programs with asynchronous calls , 2009, ESEC/FSE '09.

[13]  Gustavo Pinto,et al.  Are Java programmers transitioning to multicore?: a large scale study of java FLOSS , 2011, SPLASH Workshops.

[14]  Patrice Quinton,et al.  ompVerify: Polyhedral Analysis for the OpenMP Programmer , 2011, IWOMP.

[15]  Jeffrey S. Foster,et al.  LOCKSMITH: context-sensitive correlation analysis for race detection , 2006, PLDI '06.

[16]  Stephen N. Freund,et al.  Type-based race detection for Java , 2000, PLDI '00.

[17]  Jong-Deok Choi,et al.  Techniques for debugging parallel programs with flowback analysis , 1991, TOPL.

[18]  Michael Hicks,et al.  LOCKSMITH: Practical static race detection for C , 2011, TOPL.

[19]  Hiroyasu Nishiyama,et al.  Detecting Data Races Using Dynamic Escape Analysis Based on Read Barrier , 2004, Virtual Machine Research and Technology Symposium.

[20]  Rupak Majumdar,et al.  Interprocedural analysis of asynchronous programs , 2007, POPL '07.

[21]  Michael Hicks,et al.  Dynamic inference of polymorphic lock types , 2005, Sci. Comput. Program..

[22]  Stephen N. Freund,et al.  FastTrack: efficient and precise dynamic race detection , 2009, PLDI '09.

[23]  Ralph E. Johnson,et al.  Relooper: refactoring for loop parallelism in Java , 2009, OOPSLA Companion.

[24]  Ian H. Witten,et al.  The WEKA data mining software: an update , 2009, SKDD.

[25]  Martín Abadi,et al.  Types for safe locking: Static race detection for Java , 2006, TOPL.

[26]  Jong-Deok Choi,et al.  Efficient and precise datarace detection for multithreaded object-oriented programs , 2002, PLDI '02.

[27]  Thomas R. Gross,et al.  Static conflict analysis for multi-threaded object-oriented programs , 2003, PLDI '03.

[28]  Satish Narayanasamy,et al.  LiteRace: effective sampling for lightweight data-race detection , 2009, PLDI '09.

[29]  Jong-Deok Choi,et al.  Static Datarace Analysis for Multithreaded Object-Oriented Programs , 2001 .

[30]  Thomas A. Henzinger,et al.  Race checking by context inference , 2004, PLDI '04.

[31]  Dawson R. Engler,et al.  RacerX: effective, static detection of race conditions and deadlocks , 2003, SOSP '03.

[32]  Rahul Agarwal,et al.  Type Inference for Parameterized Race-Free Java , 2004, VMCAI.

[33]  Michael Hind,et al.  Pointer analysis: haven't we solved this problem yet? , 2001, PASTE '01.

[34]  Koen De Bosschere,et al.  TRaDe: A Topological Approach to On-the-Fly Race Detection in Java Programs , 2001, Java Virtual Machine Research and Technology Symposium.

[35]  Thomas W. Reps,et al.  Precise interprocedural dataflow analysis via graph reachability , 1995, POPL '95.

[36]  Amer Diwan,et al.  The DaCapo benchmarks: java benchmarking development and analysis , 2006, OOPSLA '06.

[37]  Sorin Lerner,et al.  RELAY: static race detection on millions of lines of code , 2007, ESEC-FSE '07.

[38]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multithreaded programs , 1997, TOCS.

[39]  Assaf Schuster,et al.  MultiRace: efficient on‐the‐fly data race detection in multithreaded C++ programs , 2007, Concurr. Comput. Pract. Exp..

[40]  Dan Grossman,et al.  Type-safe multithreading in cyclone , 2003, TLDI '03.

[41]  Raja Das,et al.  MulticoreSDK: a practical and efficient data race detector for real-world applications , 2009, PADTAD '09.

[42]  Eric Bodden,et al.  Racer: effective race detection using aspectj , 2008, ISSTA '08.

[43]  Edith Schonberg,et al.  An empirical comparison of monitoring algorithms for access anomaly detection , 2011, PPOPP '90.

[44]  Mayur Naik,et al.  A dynamic evaluation of the precision of static heap abstractions , 2010, OOPSLA.

[45]  Martin C. Rinard,et al.  A parameterized type system for race-free Java programs , 2001, OOPSLA '01.

[46]  Yannis Smaragdakis,et al.  Sound predictive race detection in polynomial time , 2012, POPL '12.

[47]  Paul Feautrier,et al.  Dataflow analysis of array and scalar references , 1991, International Journal of Parallel Programming.

[48]  Stephen N. Freund,et al.  Type inference against races , 2004, Sci. Comput. Program..

[49]  Koen De Bosschere,et al.  RecPlay: a fully integrated practical record/replay system , 1999, TOCS.

[50]  Danny Dig,et al.  Practical static race detection for Java parallel loops , 2013, ISSTA.

[51]  Jong-Deok Choi,et al.  Hybrid dynamic data race detection , 2003, PPoPP '03.

[52]  Stephen N. Freund,et al.  Detecting race conditions in large programs , 2001, PASTE '01.

[53]  Vivek Sarkar,et al.  Efficient data race detection for async-finish parallelism , 2012, Formal Methods Syst. Des..

[54]  Dinghao Wu,et al.  KISS: keep it simple and sequential , 2004, PLDI '04.

[55]  Alexander Aiken,et al.  Effective static race detection for Java , 2006, PLDI '06.

[56]  Grigore Rosu,et al.  jPredictor: a predictive runtime analysis tool for java , 2008, ICSE '08.

[57]  Martin C. Rinard,et al.  ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), November 2002 Ownership Types for Safe Programming: Preventing Data Races and Deadlocks , 2022 .

[58]  Vivek Sarkar,et al.  Scalable and precise dynamic datarace detection for structured parallelism , 2012, PLDI.

[59]  Dan Roth,et al.  Understanding the Value of Features for Coreference Resolution , 2008, EMNLP.

[60]  Barton P. Miller,et al.  Detecting Data Races on Weak Memory Systems , 1991, ISCA.

[61]  Danny Dig,et al.  Crossing the gap from imperative to functional programming through refactoring , 2013, ESEC/FSE 2013.

[62]  Barbara G. Ryder,et al.  Parameterized object sensitivity for points-to analysis for Java , 2005, TSEM.

[63]  Giovanni Denaro,et al.  ACM Transactions on Software Engineering and Methodology : Volume 22, Nomor 4, 2013 , 2014 .

[64]  John M. Mellor-Crummey,et al.  On-the-fly detection of data races for programs with nested fork-join parallelism , 1991, Proceedings of the 1991 ACM/IEEE Conference on Supercomputing (Supercomputing '91).