27
A Guided Genetic Algorithm for Automated Crash Reproduction Mozhan Soltani Annibale Panichella Arie van Deursen

ICSE 2017 - Evocrash

Embed Size (px)

Citation preview

Page 1: ICSE 2017 - Evocrash

A Guided Genetic Algorithm for Automated Crash Reproduction

MozhanSoltani AnnibalePanichella Arie vanDeursen

Page 2: ICSE 2017 - Evocrash

Software systems fail!

2

Page 3: ICSE 2017 - Evocrash

When Debugging, Crash Reproducible Tests are Required!

3

!

Page 4: ICSE 2017 - Evocrash

4

STAR

Automated Crash Reproduction

JCHARMING MuCrash

Nayrolles etal.,J.Softw.Evol.andProc.,2016

Chen,andKim,TSE2015 Xuanetal.,ESEC/FSE2015

Page 5: ICSE 2017 - Evocrash

5

STARJCHARMING MuCrash

Automated Crash Reproduction

ASampleStackTrace

Page 6: ICSE 2017 - Evocrash

6

Automated Crash Reproduction via JCHARMING

JCHARMINGApproach:1) Deriveapartialmodelofthesystem2) Identifythestatementsthattriggerthecrash

Limitation:Requiresexpensivecomputation!

Nayrolles etal.,J.Softw.Evol.andProc.,2016

Page 7: ICSE 2017 - Evocrash

7

Automated Crash Reproduction via STAR

Approach:1) Computethecrashpreconditions,usingBSE2) Generateatestthatsatisfiesthepreconditions

Limitation:Maynotscaledueto:• Pathexplosion• LimitationsofSMTsolvers

STAR

Chen,andKim,TSE2015

Page 8: ICSE 2017 - Evocrash

8

Automated Crash Reproduction via MuCrash

Approach:Mutateexistingtestsuntilonereproducesthecrash

Limitation:Lackofeffectivemutationoperators

MuCrash

Xuanetal.,ESEC/FSE2015

Page 9: ICSE 2017 - Evocrash

9

Crash Reproduction via Search-Based Software Testing!

Page 10: ICSE 2017 - Evocrash

10

ASampleStackTraceSearchproblem:Findingacrashreproducible unittest!

Metaheuristicoptimization:AGuided GeneticAlgorithm

LeveragingEVSUITE

Crash Reproduction via EvoCrash!

Page 11: ICSE 2017 - Evocrash

Guided Genetic Algorithm - GGA

11

EvaluateFitness

Selection GuidedCrossover

InitializePopulation

F=0|| T

GuidedMutation

CreatetheNextGeneration

Re-insertion

Page 12: ICSE 2017 - Evocrash

Guided Genetic Algorithm - GGA

12

EvaluateFitness

Selection GuidedCrossover

InitializePopulation

F=0|| T

GuidedMutation

CreatetheNextGeneration

Re-insertion

Howisthisaguided geneticalgorithm?

Page 13: ICSE 2017 - Evocrash

Guided Initialization

13

Eachgeneratedtestshallincludeatleastonecalltothetargetfailingmethod!

ASampleStackTrace

Thetargetfailingmethod

Page 14: ICSE 2017 - Evocrash

Anidealtestcaseleadsto:1. Theexecutionofline1902. TheIllegalArgumentException beingthrown3. Similarstacktracebeinggenerated

14

Fitness Evaluation

ASampleStackTrace

Targetfailingmethod

Page 15: ICSE 2017 - Evocrash

Guided Genetic Algorithm - GGA

15

EvaluateFitness

Selection Crossover

InitializePopulation

F=0|| T

Mutation

CreatetheNextGeneration

Whatifthereisnocrashreproducibletestinthepopulation?

Page 16: ICSE 2017 - Evocrash

16

Single-Point Crossover

Parent#1

Parent#2

Offspring#1

Offspring#2

Thetargetcallislost!

Page 17: ICSE 2017 - Evocrash

17

Parent#1

Parent#2

Offspring#1

Offspring#2

Thetargetcallislost!

What if the target call is lost?

Callincluded?GuidedCrossover

Taketheparents

Takethechildren

Page 18: ICSE 2017 - Evocrash

18

Mutation

BeforeMutation

Assignanewobject/value

Removeastatement

Addastatement

Page 19: ICSE 2017 - Evocrash

19

BeforeMutation

Assignanewstatement(constructor)

Removeastatement

Addastatement

What if the target call is lost?

Callincluded?GuidedMutation

MutationAccepted

Page 20: ICSE 2017 - Evocrash

Is the test useful for debugging?

20

UsefulnessCriterion:

1

34

2

Ausefultestreveals thebug!

5

TheTargetCrashTraceAUsefulCrashReproducibleTest

Chen,N.,&Kim,S.(2015).Star:Stacktracebasedautomaticcrashreproductionviasymbolicexecution.IEEETransactionsonSoftwareEngineering.

Page 21: ICSE 2017 - Evocrash

Guided Genetic Algorithm - GGA

21

EvaluateFitness

Selection Crossover

InitializePopulation

F=0|| T

Mutation

CreatetheNextGeneration

HowmanycrashescanEvoCrash successfully reproduce?

HowdoesEvoCrash performcomparedtothestate-of-the-artapproachestocrashreproduction?

Page 22: ICSE 2017 - Evocrash

Empirical Study

Project NumberofCrashes

ApacheCommonsCollections 12

ApacheAnt 20

ApacheLog4j 18

22

ExceptionTypes

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException

StringIndexOutOfBoundsException

UnsupportedOperationException

IllegalStateException

ConcurrentModificationException

Page 23: ICSE 2017 - Evocrash

UsefulReproduction

Reproduced

How many crashes can EvoCrashsuccessfully reproduce?

230

5

10

15

20

ACC ANT LOG

• 82%werereproduced,and• ~80%ofthemwereuseful(inaverage)

Results:

20%

28%

34%

90% 71%

88%

Page 24: ICSE 2017 - Evocrash

24

An Example: ACC-104

Reproductionrate:4/50Challenge: settingboundedFifoBuffer0intherightstate

ThetestbyEvoCrash forACC-104

ThecrashstacktraceforACC-104

Page 25: ICSE 2017 - Evocrash

How does EvoCrash perform compared to the state-of-the-art approaches?

250

10

20

30

40

50

Total,JCHARMING,EvoCrash Total,STAR,EvoCrash Total,MuCrash,EvoCrash

EvoCrash out-performedthestate-of-the-art!

75% 100%8

50

58%

82%

1266% 83%

ReproductionrateforothertoolsReproductionrateforEvoCrash

Totalnumberofcases

Page 26: ICSE 2017 - Evocrash

26

EvoCrash Addresses the Limitations!

BackwardSymbolicExecution:• Pathexplosion• LimitationsofSMT solvers

DirectedModelChecking:Expensivecomputations

TestCaseMutation:Limitedmutationoperators

Page 27: ICSE 2017 - Evocrash

EvoCrash is Available!

27

www.evocrash.org