effectiveness and challenges in generating concurrent
play

Effectiveness and Challenges in Generating Concurrent Tests for - PowerPoint PPT Presentation

Effectiveness and Challenges in Generating Concurrent Tests for Thread-Safe Classes Valerio Terragni * Mauro Pezz* Universit di Milano Bicocca, * USI Universit della Svizzera italiana, Switzerland Italy


  1. Effectiveness and Challenges in Generating Concurrent Tests for Thread-Safe Classes Valerio Terragni * Mauro Pezzè* ◇ ◇ Università di Milano Bicocca, * USI Università della Svizzera italiana, Switzerland Italy 5 September, Montpellier, France

  2. Concurrent Programming is Pervasive performance correctness

  3. Thread-Safe Classes “A class that encapsulates synchronizations that ensure a performance correct behavior when the same instance of the class is accessed from multiple threads” public class C1 { private int x; private int y; public C1() { … } public synchronized void m1() {….} public void m2() { … synchronized(this){…} … } 3

  4. Achieving Optimal Synchronization is Challenging Performance Correctness

  5. Thread-Safe Classes are Buggy 5

  6. Example of a Thread-Safety Violation Thread 1 Thread 2 public void setFilter(Filter f) { public void log(LogRecord r) { this.filter = f; synchronized(this) { if(filter != null) { } if(!filter.isLoggable(r)) { = null return; } } } } NullPointer exception 6

  7. Concurrent Test Generation Set of method call sequences that exercise the public interface of a class from multiple threads Logger sout = Logger.getAnonymousLogger(); Filter filter0 = new Filter(); sout.setFilter(filter0); Thread 2 Thread 1 sout.info(""); sout.setFilter(null); 7

  8. Concurrent Test Generation State of the Art ConSuite@ICST Narada@PLDI CovCon@ICSE Intruder@FSE 2012 2013 2014 2015 2016 2017 Ballerina@ICSE Omen@FSE AutoConTest@ICSE ConTeGe@PLDI Minion@OOPSLA 8

  9. Concurrent Test Generation 9

  10. Contributions (Outline) 1. A survey on existing concurrent test generators 2. A large-scale experimental evaluation of 6 generators 3. Analysis of their limitations 4. Guidelines for future research in this area 10

  11. State of the Art Tool name Venue Year Category Ballerina ICSE 2012 Random-based ConTeGe PLDI 2012 ConSuite ICST 2013 AutoConTest ICSE 2016 Coverage-based CovCon ICSE 2017 Omen OOPSLA 2014 Narada PLDI 2015 Sequential-test-based Intruder FSE 2015 Minion OOPSLA 2016 11

  12. Random-Based Tool name Venue Year Category Ballerina ICSE 2012 Random-based ConTeGe PLDI 2012 ConSuite ICST 2013 AutoConTest ICSE 2016 Coverage-based CovCon ICSE 2017 Omen OOPSLA 2014 Narada PLDI 2015 Low computational analysis Sequential-test-based Intruder FSE 2015 Many randomly generated tests are needed Minion OOPSLA 2016 Many redundant tests are generated 12

  13. Coverage-Based Tool name Venue Year Category Ballerina ICSE 2012 Random-based ConTeGe PLDI 2012 ConSuite ICST 2013 AutoConTest ICSE 2016 Coverage-based CovCon ICSE 2017 Omen OOPSLA 2014 Narada PLDI 2015 Sequential-test-based Intruder FSE 2015 Limited number of redundant tests Minion OOPSLA 2016 Difficult trade-off between: A precise computation of coverage targets Low analysis computational cost 13

  14. Sequential-Test Based Tool name Venue Year Category Ballerina ICSE 2012 Random-based Generate only those tests that reveal ConTeGe PLDI 2012 the considered type of bug ConSuite ICST 2013 Require a seeded sequential test AutoConTest ICSE 2016 Coverage-based suites in input CovCon ICSE 2017 Omen OOPSLA 2014 Narada PLDI 2015 Sequential-test- based Intruder FSE 2015 Minion OOPSLA 2016 14

  15. Interleaving Exploration & Thread-Safety Oracle Interleaving Explorer Thread-Safety Oracle Random Tool name Venue Year Selective Exhaustive Implicit Internal Ballerina ICSE 2012 ConTeGe PLDI 2012 ConSuite ICST 2013 AutoConTest ICSE 2016 CovCon ICSE 2017 Omen OOPSLA 2014 Narada PLDI 2015 Intruder FSE 2015 Minion OOPSLA 2016 15

  16. Contributions (Outline) 1. A survey on existing concurrent test generators 2. A large-scale experimental evaluation of 6 generators 3. Analysis of their limitations 4. Guidelines for future research in this area 16

  17. Subjects ASE 2015 Code base (label) # of subjects Description (bugs) Apache DBCP (dbcp) 4 Database connection pool Apache Derby (derby) 5 Relational database Apache Groovy (groovy) 6 Dynamic language for JVM OpenJDK (jdk) 20 Java Development Kit Apache Log4J (log4j) 5 Logging library Apache Lucene (lucene) 2 Search library Apache Pool (pool) 5 Object-pooling API Total 47 17

  18. Evaluation Setup JaConTeBe 47 subjects Class Under Test (CUT) Auxiliary classes Buggy Manually- Bug code base written test report Time budget one hour per subject 10 runs per subject 18

  19. Fault Type Failure Type ConTeGe ConTeGeJPF AutoConTest CovCon CovConJPF Omen Narada Intruder

  20. Fault Type Failure Type ConTeGe ConTeGeJPF AutoConTest CovCon CovConJPF Omen Narada Intruder inconsistent endless loop synchronization logic endless loop exception race atomicity violations logic resource endless hang deadlock wait-notify endless hang deadlock

  21. Fault Type Failure Type ConTeGe ConTeGeJPF AutoConTest CovCon CovConJPF Omen Narada Intruder inconsistent endless loop synchronization logic endless loop exception race atomicity violations logic • Automated concurrent test generators find (8 out of 47) 17% of the faults • None of them alone finds more than (6 out of 47) 13% of the faults resource endless hang deadlock wait-notify endless hang deadlock

  22. Contributions (Outline) 1. A survey on existing concurrent test generators 2. A large-scale experimental evaluation of 6 generators 3. Analysis of their limitations 4. Guidelines for future research in this area 22

  23. Analysis of the Tools Limitations JaConTeBe 47 subjects Buggy Manually- Bug code base written test report Manual Investigation 23

  24. Common Issue 1: Invalid Assumptions 40% faults violate at least one of the following assumptions • Two threads only One shared object under test • No static invocations • manually-written test : derby5 … storePage.setExclusive(baseContainerHandle); baseContainerHandle.addObserver(storePage); Thread 2 Thread 1 storePage.releaseExclusive(); baseContainerHandle.close(); Assumption violated : 2 shared objects under test 24

  25. Common Issue 2: Environmental Dependencies 25% of the faults require environmental dependencies (DB, files …) manually-written test : jdk6_2 String dirA = projectBase + “/base/a”; String dirB = projectBase + “/base/b”; Thread 2 Thread 1 File fileA = new File(dirA); File fileB = new File(dirB); fileA.mkdirs(); fileB.mkdirs(); 25

  26. Common Issue 3: Inadequacy for Wait-Notify 19 % of the faults require the execution of wait()-notify() (Step 1) Feedback-directed approach Sequential (single-thread) execution of call sequences Discards sequences that throw exceptions or never terminates (time-out) ClassA sout = new ClassA(); sout.m1(); sout.m2(); public void m3() { sout.m3(); … lock.wait(); … } 26

  27. Contributions (Outline) 1. A survey on existing concurrent test generators 2. A large-scale experimental evaluation of 6 generators 3. Analysis of their limitations 4. Guidelines for future research in this area 27

  28. Adaptive Configuration Automatically identify a proper configuration for a given class under test

  29. Search Space Reduction Reduce the search space by identifying methods whose concurrent interactions cannot lead to concurrency failures 29

  30. Handling Wait and Notify Revise the 4 steps framework to handle wait/notify synchronization primitives

  31. Handling Wait and Notify Revise the 4 steps framework to handle wait/notify synchronization primitives 31

  32. Conclusion 32

  33. Artifact is available! http://star.inf.usi.ch/star/software/contest2018 - Runnable scripts - Experimental data 33

  34. Contributions (Outline) 1. A survey on existing concurrent test generators 2. A large-scale experimental evaluation of 6 generators 3. Analysis of their limitations 4. Guidelines for future research in this area 34

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend