antifragile software and genetic improvement martin...
TRANSCRIPT
1Martin Monperrus, University of Lille & Inria, France
Martin MonperrusUniversity of Lille & Inria, France
Antifragile Software and Genetic Improvement
CREST Open Workshop on Genetic ImprovementJan 2016
3Martin Monperrus, University of Lille & Inria, France
Exception Handling Analysis and Transformation Using Fault Injection: Study of Resilience Against Unanticipated Exceptions (IST 2014)
try { prepare_meringue() add_cream() make_balls() add_chocolate_shavings()} catch (MissingChocolateEx e) { use_nutella();}
« Anticipated errors »
4Martin Monperrus, University of Lille & Inria, France
● Test colors
– Pink– Blue- White
Expected errors in test suites
Blue and white tests specify anticipated errorsWhite tests specify resilience
5Martin Monperrus, University of Lille & Inria, France
Empirical results
3950 2046 2031 481 406 339 191 135 1000%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
white
blue
pink
6Martin Monperrus, University of Lille & Inria, France
Our intuition: simulating
unforeseen errors by perturbing test case execution
7Martin Monperrus, University of Lille & Inria, France
Why ?
8Martin Monperrus, University of Lille & Inria, France
Short circuit testing: Exception injection in test suites
+ =White test throw new X()
9Martin Monperrus, University of Lille & Inria, France
The try-catch blocks that keep the tests passing under exception injection are capable to handle unanticipated errors.
We call them ''source-independent''.
Source-Independence
We call them ''source-independent''.
Empirical assessment of resilience against unforeseen errors
10Martin Monperrus, University of Lille & Inria, France
shindig-java-gadgetsCommons-lang
commons-codecsonar core
shindig-commonjbehave core
joda timesonar plugin api
spojo core
0
5
10
15
20
25
30
35
40
45
non agnostique
agnostique
Empirical Evaluation
dependent independent
11Martin Monperrus, University of Lille & Inria, France
Test driver
try{ // instrumentation code if(Controller.isCurrentTryCatchWithInjection()) throw new Exception(); }
... //normal try body...} catch ( Exception e ) {... //normal catch body}
IO
IO
// Genetic Improvement
12Martin Monperrus, University of Lille & Inria, France
Limit cases
Stack of try-catch at runtime
// originalCatch (OufofMemory) { Catch (NullPointer) { Catch (IOException) { } }}
// stretchedCatch (OufofMemory) { Catch (NullPointer) { Catch (Exception) { } }}
throw new NullPointerException()
13Martin Monperrus, University of Lille & Inria, France
Empirical Evaluation
dependent independent
commons-lang
commons-codec
joda time
spojo core
sonar core
sonar plugin
jbehave core
shindig-java-gadgets
shindig-common
0 5 10 15 20 25 30 35
unstretchable
stretchable
14Martin Monperrus, University of Lille & Inria, France
Take-away
“We inject exceptions during test suite execution to assess and improve
resilience”References:
Exception Handling Analysis and Transformation Using Fault Injection: Study of Resilience Against Unanticipated Exceptions (Benoit Cornu, Lionel Seinturier, Martin Monperrus), In Information and Software Technology, Elsevier, 2014.
15Martin Monperrus, University of Lille & Inria, France
Definition
A thing is antifragile if it becomes
better with stressors, shocks, volatility, noise, mistakes, faults, attacks, failures . . .(Antifragile, N. N. Taleb, 2013)
16Martin Monperrus, University of Lille & Inria, France
A software system is antifragile if it becomes
better with failures, attacks, failures, misconfigurations, weird usages . . .
(Principles of Antifragile Software, M. Monperrus, 2014)
17Martin Monperrus, University of Lille & Inria, France
Short circuit testing is antifragile:● Better with exception injection
●Does not try to anticipate or predict
18Martin Monperrus, University of Lille & Inria, France
Chaos Monkey
// Chaos Engineering// principlesofchaos.org, 2015
hypothesis ← perturbation, measurewhile (true) { perturb if (measure unacceptable) { report failure }}
19Martin Monperrus, University of Lille & Inria, France
Antifragile software engineering
Core model:● perturbation model● perturbation controller● perturbation cost● perturbation gain
http://www.monperrus.net/martin/antifragile-software