Large-Scale API Protocol Mining for Automated Bug Detection

Similar documents
Statically Checking API Protocol Conformance with Mined Multi-Object Specifications

Leveraging Test Generation and Specification Mining for Automated Bug Detection without False Positives

Adaptive Multi-Level Compilation in a Trace-based Java JIT Compiler

The RV System Tutorial

Plural and : Protocols in Practice. Jonathan Aldrich Workshop on Behavioral Types April School of Computer Science

Chronicler: Lightweight Recording to Reproduce Field Failures

How Good Are the Specs?

Trace-based JIT Compilation

A Trace-based Java JIT Compiler Retrofitted from a Method-based Compiler

MOPBox: A Library Approach to Runtime Verification

Lu Fang, University of California, Irvine Liang Dou, East China Normal University Harry Xu, University of California, Irvine

Management. Software Quality. Dr. Stefan Wagner Technische Universität München. Garching 28 May 2010

Engineering Abstractions in Model Checking and Testing. Michael Achenbach Klaus Ostermann

A Dynamic Evaluation of the Precision of Static Heap Abstractions

IBM Research - Tokyo 数理 計算科学特論 C プログラミング言語処理系の最先端実装技術. Trace Compilation IBM Corporation

File IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20

Static Detection of Brittle Parameter Typing

Each command-line argument is placed in the args array that is passed to the static main method as below :

Dynamic Vertical Memory Scalability for OpenJDK Cloud Applications

Probabilistic Calling Context

Identifying the Sources of Cache Misses in Java Programs Without Relying on Hardware Counters. Hiroshi Inoue and Toshio Nakatani IBM Research - Tokyo

Detecting and Fixing Memory-Related Performance Problems in Managed Languages

Automatic Generation of Program Specifications

Java Input/Output. 11 April 2013 OSU CSE 1

RV: A Run'me Verifica'on Framework for Monitoring, Predic'on and Mining

Darshan Institute of Engineering & Technology for Diploma Studies

1 Runtime Verification using JavaMOP

Course 7 25 November Adrian Iftene

NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness

String Deduplication for Java-based Middleware in Virtualized Environments

Phosphor: Illuminating Dynamic. Data Flow in Commodity JVMs

Towards Parallel, Scalable VM Services

Combined Static and Dynamic Automated Test Generation

A Story of Parametric Trace Slicing, Garbage and Static Analysis

Static Analysis of C++ Projects with CodeSonar

A staged static program analysis to improve the performance of runtime monitoring

Program Testing and Analysis: Manual Testing Prof. Dr. Michael Pradel Software Lab, TU Darmstadt

Software Architecture and Engineering: Part II

Programming Languages and Techniques (CIS120)

Automatic Testing of Sequential and Concurrent Substitutability

Towards Categorizing and Formalizing the JDK API

Input from Files. Buffered Reader

Lightweight Data Race Detection for Production Runs

COMP 213. Advanced Object-oriented Programming. Lecture 20. Network Programming

The Checker Framework: pluggable static analysis for Java

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak

Joint Entity Resolution

Continuous Object Access Profiling and Optimizations to Overcome the Memory Wall and Bloat

Toward Efficient Strong Memory Model Support for the Java Platform via Hybrid Synchronization

Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems)

A Serializability Violation Detector for Shared-Memory Server Programs

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

Profile-Guided Program Simplification for Effective Testing and Analysis

Preventing Defects. SWE 795, Spring 2017 Software Engineering Environments

context free grammars

Code verification. CSE 331 University of Washington. Michael Ernst

Outline. iterator review iterator implementation the Java foreach statement testing

Using Type Annotations to Improve Your Code

CS-152: Software Testing

MEMORY MANAGEMENT TEST-CASE GENERATION OF C PROGRAMS USING BOUNDED MODEL CHECKING

Optimizing for Bugs Fixed

Sri Vidya College of Engineering & Technology Question Bank

Core Java Contents. Duration: 25 Hours (1 Month)

SourcererCC -- Scaling Code Clone Detection to Big-Code

Efficient Parametric Runtime Verification with Deterministic String Rewriting

Exceptions. Produced by. Introduction to the Java Programming Language. Eamonn de Leastar

ITI Introduction to Computing II

Shin Hwei Tan Darko Marinov Lin Tan Gary T. Leavens University of Illinois. University of Illinois

DLint: Dynamically Checking Bad Coding Practices in JavaScript

Fully Automatic and Precise Detection of Thread Safety Violations

Lecture 4: Exceptions. I/O

CS 251 Intermediate Programming Java I/O Streams

CS193j, Stanford Handout #26. Files and Streams

I/O STREAM (REQUIRED IN THE FINAL)

Today Program Analysis for finding bugs, especially security bugs problem specification motivation approaches remaining issues

Today. Book-keeping. File I/O. Subscribe to sipb-iap-java-students. Inner classes. Debugging tools

ITI Introduction to Computing II

CSCE 548 Building Secure Software Software Analysis Basics

Towards Garbage Collection Modeling

Object-Oriented Programming Design. Topic : Streams and Files

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

Transaction Management: Concurrency Control, part 2

Locking for B+ Trees. Transaction Management: Concurrency Control, part 2. Locking for B+ Trees (contd.) Locking vs. Latching

Static Analysis in Practice

Tirgul 1. Course Guidelines. Packages. Special requests. Inner classes. Inner classes - Example & Syntax

Checking Framework Interactions with Relationships. Ciera Jaspan Advised by Jonathan Aldrich OOPSLA Doctoral Symposium

Debugging Reinvented: Asking and Answering Why and Why Not Questions about Program Behavior

PIC 20A Streams and I/O

CS 201, Fall 2016 Dec 2nd Exam 3

Seminar in Software Engineering Presented by Dima Pavlov, November 2010

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages

Midterm Logistics. Midterm tonight, 7PM 10PM Exam location by last name:

Socket programming. Complement for the programming assignment INFO-0010

ITI Introduction to Computing II

Safety Checks and Semantic Understanding via Program Analysis Techniques

Related reading: Effectively Prioritizing Tests in Development Environment Introduction to Software Engineering Jonathan Aldrich

6.092 Introduction to Software Engineering in Java January (IAP) 2009

CMPT 473 Software Quality Assurance. Managing Bugs. Nick Sumner

6.005 Elements of Software Construction Fall 2008

7. Testing and Debugging Concurrent Programs

Transcription:

Large-Scale API Protocol Mining for Automated Bug Detection Michael Pradel Department of Computer Science ETH Zurich 1

Motivation LinkedList pinconnections =...; Iterator i = pinconnections.iterator(); while ( i.hasnext() ) { PinLink curr = (PinLink) i.next(); if (... ) { pinconnections.remove(curr); } } (from DaCapo benchmarks) 2

Motivation LinkedList pinconnections =...; Iterator i = pinconnections.iterator(); while ( i.hasnext() ) { PinLink curr = (PinLink) i.next(); if (... ) { pinconnections.remove(curr); } } (from DaCapo benchmarks) Don t modify a collection while iterating over it! 2

API Usage Constraints Program Constraints API call x before y eventually call x don t call x while calling y and z 3

API Usage Constraints Program Constraints API call x before y eventually call x Protocols! x don t call x while calling y and z y z 3

Protocol Mining Problem: No protocols specified API Training Programs 4

Protocol Mining Problem: No protocols specified API Training Programs Mining x y z 4

Protocol Mining Problem: No protocols specified API Target Program Training Programs Mining x y Bug finding z 4

Big Picture Protocol mining Bug finding 5

Big Picture Protocol mining Bug finding Other applications 5

Big Picture Protocol mining Bug finding Other applications 5

Big Picture static vs. dynamic Protocol mining API-based vs. client-based Bug finding single- vs. multi-object Other applications 5

Big Picture static vs. dynamic Protocol mining single- vs. multi-object API-based vs. client-based Bug finding static Other applications verification dynamic testing verification testing 5

Big Picture static vs. dynamic Protocol mining single- vs. multi-object API-based vs. client-based Bug finding static Other applications verification dynamic testing verification testing 5

Part 1: Protocol Mining 6

Protocol Mining - Overview Program & Input Protocols Execution trace Subtraces 7

Protocol Mining - Overview Program & Input Protocols Execution trace Subtraces 7

Execution Traces List l = new LinkedList(); l.add(new Foo()); Iterator i = l.iterator(); OutputStream s = new FileOutputStream("f"); while (i.hasnext()) { Foo f = i.next(); if (f.isok()) s.write(f.getdata()); } s.close(); 8

Execution Traces List l = new LinkedList(); l.add(new Foo()); Iterator i = l.iterator(); OutputStream s = new FileOutputStream("f"); while (i.hasnext()) { Foo f = i.next(); if (f.isok()) s.write(f.getdata()); } s.close(); AspectJ instrumentation 8

Execution Traces List l = new LinkedList(); l.add(new Foo()); Iterator i = l.iterator(); OutputStream s = new FileOutputStream("f"); while (i.hasnext()) { Foo f = i.next(); if (f.isok()) s.write(f.getdata()); } s.close(); AspectJ instrumentation new LinkedList 1 1.add(2) 3 1.iterator 4 new FileOS(6) 5 4.hasNext 4.next 5.write(7) 4.hasNext 5.close 8

Protocol Mining - Overview Program & Input Protocols Execution trace Subtraces 9

Protocol Mining - Overview Program & Input Protocols Execution trace Subtraces 9

Subtraces new LinkedList 1 1.add(2) 3 1.iterator 4 new FileOS(6) 5 4.hasNext 4.next 5.write(7) 4.hasNext 5.close 10

Subtraces new LinkedList 1 1.add(2) 3 1.iterator 4 new FileOS(6) 5 4.hasNext 4.next 5.write(7) 4.hasNext 5.close Different API usages intermingled! 10

Subtraces new LinkedList 1 1.add(2) 3 1.iterator 4 new FileOS(6) 5 4.hasNext 4.next 5.write(7) 4.hasNext 5.close Core object x: Calls to x Calls to parameters passed to x Calls to objects returned by x 10

Subtraces new LinkedList 1 1.add(2) 3 1.iterator 4 new FileOS(6) 5 4.hasNext 4.next 5.write(7) 4.hasNext 5.close new LinkedList 1 1.add(2) 3 1.iterator 4 4.hasNext 4.next 4.hasNext 4.hasNext 4.next 4.hasNext new FileOS(6) 5 5.write(7) 5.close 10

Protocol Mining - Overview Program & Input Protocols Execution trace Subtraces 11

Protocol Mining - Overview Program & Input Protocols Execution trace Subtraces 11

Group Subtraces Group by set of involved types LinkedList, Iterator Iterator FileOS 12

Generate Protocols Finite state machine Method state Consecutive call transition 13

Generate Protocols Finite state machine Method state Consecutive call transition new LinkedList l l.add l.add l.iterator i i.hasnext i.hasnext i.next l.add l.add i.hasnext l.add 13

Generate Protocols Finite state machine Method state Consecutive call transition new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next l.add 13

Scalability Bottleneck: Large execution traces 14

Scalability Bottleneck: Large execution traces Pass 1: Find core objects and associated objects 14

Scalability Bottleneck: Large execution traces Pass 1: Find core objects and associated objects Pass 2: Extract calls for each subtrace 14

Scalability Bottleneck: Large execution traces Pass 1: Find core objects and associated objects Pass 2: Extract calls for each subtrace Mine millions of events in a few minutes 14

Examples ZipFile and Enumeration e.hasmore Elements new ZipFile f f.entries e e.hasmore Elements f.close e.hasmore Elements e.next Element 15

Examples URL and InputStream new URL u u.openstream s s.close 16

Evaluation Are examples convincing enough? 20+ mining approaches OK/ Not OK Use for some task 17

Evaluation Are examples convincing enough? 20+ mining approaches OK/ Not OK Use for some task Neither reproducible nor comparable! 17

Evaluation Framework? Precision and recall OK 18

Evaluation Framework? Precision and recall Method constraint groups OK 18

Example Mined protocol M format println close Formatter println Reference protocol Formatter format locale, out, ioexception flush close ioexception close format, locale, out, ioexception 19

Example Mined protocol M format println close Formatter println Reference protocol Formatter format locale, out, ioexception flush close ioexception Precision: How much of M is correct? 23% format, locale, out, ioexception close 19

Example Mined protocol M format println close Formatter println Reference protocol Formatter format locale, out, ioexception flush close ioexception Recall: How complete is M? 9% format, locale, out, ioexception close 19

Results 12 training programs 32 reference protocols 20

Learn More from Many Teachers? Empirical study: How does mining more programs influence the results?.... 12 programs 21

API Coverage Types and methods covered in mined protocols 22

API Coverage Types and methods covered in mined protocols More programs Higher coverage 22

Recall Recall of mined protocols 23

Recall Recall of mined protocols More programs Higher recall 23

Part 2: Bug Finding 24

Bug Finding API Target Program Training Programs Mining x y Bug finding z 25

Bug Finding API Target Program Training Programs Mining x y Bug finding z 25

Overview Analysis 26

Overview Analysis Runtime verification Static checking 26

Overview Analysis What is a protocol violation? Runtime verification Static checking 26

Overview Analysis What is a protocol violation? Runtime verification Static checking 26

Incomplete Specifications Protocols = Incomplete specifications new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next l.add 27

Incomplete Specifications Protocols = Incomplete specifications new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next i.hasnext? l.add 27

What is a Protocol Violation? new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next l.add Setup phase: bind parameters Liable phase: all parameters bound violation: take non-existing transition end in non-final state 28

State Partitioning Protocol transformation: Setup states vs. liable states new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next l.add 29

State Partitioning Protocol transformation: Setup states vs. liable states new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next setup l.add 29

State Partitioning Protocol transformation: Setup states vs. liable states new LinkedList l l.add l.iterator i liable i.hasnext i.hasnext l.add i.next l.add 29

State Partitioning Protocol transformation: Setup states vs. liable states new LinkedList l l.add l.iterator i i.hasnext i.hasnext l.add i.next ambiguous split l.add 29

State Partitioning Protocol transformation: Setup states vs. liable states new LinkedList l l.add l.iterator i i.hasnext i.hasnext i.next l.add l.add l.add 29

State Partitioning Protocol transformation: Setup states vs. liable states new LinkedList l l.add l.iterator i i.hasnext i.hasnext i.next setup l.add l.add liable l.add 29

Overview Analysis Runtime verification Static checking 30

Overview Analysis Runtime verification Static checking 30

Dynamic Protocol Checking Input Runtime verification (JavaMOP) 31

Dynamic Protocol Checking Input Runtime verification (JavaMOP) Challenge 1: Check many different execution paths 31

Dynamic Protocol Checking Input Runtime verification (JavaMOP) Challenge 1: Check many different execution paths Challenge 2: Monitoring mined protocols 31

Randomly Generated Input Challenge 1: Check many different execution paths Input 32

Randomly Generated Input Challenge 1: Check many different execution paths Input Random test generation 32

Randomly Generated Input Challenge 1: Check many different execution paths Input Random test generation Call sequences that trigger an exception 32

Randomly Generated Input Challenge 1: Check many different execution paths Input Non-exceptional sequences Random test generation Call sequences that trigger an exception 32

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() new LinkedList l i.iterator i i.hasnext i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() new LinkedList l i.iterator i i.hasnext l i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() new LinkedList l i.iterator i i.hasnext l i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() Violation!? new LinkedList l i.iterator i i.hasnext l i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() i1 = l.iterator() i2.next() new LinkedList l i.iterator i i.hasnext l i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() i1 = l.iterator() i2.next() new LinkedList l i.iterator i i.hasnext (l,i1) i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() i1 = l.iterator() i2.next() new LinkedList l i.iterator i i.hasnext i2 (l,i1) i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() i1 = l.iterator() i2.next() Violation!? new LinkedList l i.iterator i i.hasnext i2 (l,i1) i.next 33

Protocol Monitoring Challenge 2: Monitoring mined protocols l = new LinkedList() i1 = l.iterator() i2.next() Naive approach Violation!? gives too many violations new LinkedList l i.iterator i i.hasnext i2 (l,i1) i.next 33

Explicit Fail Transitions Fail only in liable states new LinkedList l i.iterator i i.hasnext i.next i.next i.hasnext F 34

Explicit Fail Transitions Fail only in liable states new LinkedList l i.iterator i i.hasnext i.next Violation: Reach fail state End in non-final, liable state i.next F i.hasnext 34

Evaluation Questions Find relevant issues by monitoring mined protocols? How useful is generated input? Setup: DaCapo benchmarks, 1.6 MLOC Java 35

Results Randomly generated Protocol violations Program Test cases Total Relevant avrora 15,753 5 4 batik 3,477 0 0 daytrader 32,446 0 0 eclipse 816 0 0 fop 6,536 52 50 h2 7,584 14 7 lucene 1,985 0 0 pmd 1,286 0 0 sunflow 4,300 1 0 tomcat 14,627 1 1 xalan 21,083 1 1 Bug (exception, unexpected behavior) or code smell (performance/maintainability problem) Sum 160,857 74 63 36

Results Randomly generated Protocol violations Program Test cases Total Relevant avrora 15,753 5 4 batik 3,477 0 0 daytrader 32,446 0 0 eclipse 816 0 0 fop 6,536 52 50 h2 7,584 14 7 lucene 1,985 0 0 pmd 1,286 0 0 sunflow 4,300 1 0 tomcat 14,627 1 1 xalan 21,083 1 1 Sum 160,857 74 63 Bug (exception, unexpected behavior) or code smell (performance/maintainability problem) 85% true positives 36

Examples try { is = u.openstream(); r = new InputStreamReader(is, "UTF-8"); br = new BufferedReader(r); } finally { if ( is!= null ){ try { is.close(); } catch ( IOException ignored ){} is = null; } if ( r!= null ){ try{ r.close(); } catch ( IOException ignored ){} r = null; } if ( br == null ){ try{ br.close(); } catch ( IOException ignored ){} br = null; } } 37

Examples try { is = u.openstream(); r = new InputStreamReader(is, "UTF-8"); br = new BufferedReader(r); } finally { if ( is!= null ){ try { is.close(); } catch ( IOException ignored ){} is = null; } if ( r!= null ){ try{ r.close(); } catch ( IOException ignored ){} r = null; } if ( br == null ){ try{ br.close(); } catch ( IOException ignored ){} br = null; } } Reader never closed 37

Examples Iterator i = pinconnections.iterator(); PinLink currlink = (PinConnect.PinLink) i.next(); currlink.propagatesignals(); while (i.hasnext()) { currlink = (PinConnect.PinLink) i.next(); currlink.propagatesignals(); } 38

Examples Iterator i = pinconnections.iterator(); PinLink currlink = (PinConnect.PinLink) i.next(); currlink.propagatesignals(); while (i.hasnext()) { currlink = (PinConnect.PinLink) i.next(); currlink.propagatesignals(); } Incorrect iterator usage 38

Normal vs. Generated Input 39

Overview Analysis Runtime verification Static checking 40

Overview Analysis Runtime verification Static checking 40

State of the Art + specification Typestate checking Anomaly detection 41

State of the Art + specification Typestate checking + Precise - Needs specification Anomaly detection + Automatic - Imprecise 41

State of the Art + specification Typestate checking + Precise - Needs specification Anomaly detection + Automatic - Imprecise Combine both! Precise checker for mined multi-object protocols 41

Static Protocol Checking @Constraint( requires="..." ) Relationship constraints Fusion analysis f() g() h() Pruning f() g() h() Joint work with Ciera Jaspan and Jonathan Aldrich (ISR, CMU) 42

Fusion Static analysis to check API usages Good match with mined protocols: Reasons about interacting objects Distinguishes setup from checking C. Jaspan and J. Aldrich Checking Framework Interactions with Relationships ECOOP 09 43

Relationship-based Analysis Relationships = Tuples of objects void m() { }.. Effects: Add/remove objects Requirements: Check before call 44

Relationship-based Analysis Relationships = Tuples of objects Keep track of protocol execution (e.g., current state) void m() { }.. Effects: Add/remove objects Requirements: Check before call Check protocol constraints if in liable state 44

Example LinkedList l = new LinkedList(); Iterator i = l.iterator(); i.next(); new LinkedList l i.iterator i i.hasnext 1 2 3 4 i.next 45

Example LinkedList l = new LinkedList(); l r state2, l r iterator Iterator i = l.iterator(); i.next(); new LinkedList l i.iterator i i.hasnext 1 2 3 4 i.next 45

Example LinkedList l = new LinkedList(); Iterator i = l.iterator(); i.next(); l r state2, l r iterator l r state3, i r state3, i r hasnext, (l, i) r protocol new LinkedList l i.iterator i i.hasnext 1 2 3 4 i.next 45

Example LinkedList l = new LinkedList(); l r state2, l r iterator Iterator i = l.iterator(); l r state3, i r state3, i r hasnext, (l, i) r protocol i.next(); i / r next new LinkedList l i.iterator i i.hasnext 1 2 3 4 i.next 45

Results Program Warnings Total Bugs Code smells True pos. exception or unexpected behavior avrora 13 9 0 69% batik 1 0 0 0% daytrader 0 0 0 eclipse 15 2 1 20% fop 13 8 1 69% h2 1 0 0 0% jython 7 2 1 43% lucene 13 3 3 46% pmd 15 2 8 67% sunflow 0 0 0 tomcat 2 0 0 0% xalan 1 0 1 100% maintainability or performance issue Total 81 26 15 51% 46

Results Program Warnings Total Bugs Code smells True pos. exception or unexpected behavior avrora 13 9 0 69% batik 1 0 0 0% daytrader 0 0 0 eclipse 15 2 1 20% fop 13 8 1 69% h2 1 0 0 0% jython 7 2 1 43% lucene 13 3 3 46% pmd 15 2 8 67% sunflow 0 0 0 tomcat 2 0 0 0% xalan 1 0 1 100% Total 81 26 15 51% maintainability or performance issue Few false positives! 46

Examples LinkedList pinconnections =...; Iterator i = pinconnections.iterator(); while ( i.hasnext() ) { PinLink curr = (PinLink) i.next(); if (... ) { pinconnections.remove(curr); } } 47

Examples LinkedList pinconnections =...; Iterator i = pinconnections.iterator(); while ( i.hasnext() ) { PinLink curr = (PinLink) i.next(); if (... ) { pinconnections.remove(curr); } } Concurrent modification 47

Examples BufferedReader in = null; try { in = new BufferedReader(...);... in.close(); } finally { if (in!= null) { try { in.close(); } catch (IOException e) {... } } } 48

Examples BufferedReader in = null; try { in = new BufferedReader(...);... in.close(); } finally { if (in!= null) { try { in.close(); } catch (IOException e) {... } } } Duplicate close 48

Summary: Bug Finding Clear definition of protocol violation setup liable Static and dynamic checking: Both are practical Complement each other 49

Conclusion An attractive tool to help programmers understand large systems pinpoint problem areas Supplements other approaches: Reveals multi-object bugs Easy to use 50

Thank you! michael@binaervarianz.de 51

52

What is a Violation? hasnext hasnext next next vs. next new write Writer close Negative protocols Positive protocols 53

What is a Violation? hasnext hasnext next next vs. next write new Writer close Negative protocols Positive protocols Reaching final state Taking non-existing transition Not reaching final state 53

Related Work (Mining) Gabel & Su, FSE 2008 Language learning algorithm with pre-defined micro-patterns Don t consider dataflow Lee, Chen & Rosu, ICSE 2011 First, learn related events; then, mine sliced trace with PFSA learner Require unit tests for first step 54

Template 55

Template 56

Template 57

Template 58

Template 59

60