Spectrum-based Diagnosis for Run-time Systems
Full text
Spectrum-based Diagnosis for Run-time Systems Nuno Cardoso Supervisor: Professor Rui Abreu Co-Supervisor: Professor David Garlan Doctoral Programme in Informatics Engineering May 27, 2016
c Nuno Cardoso: May 27, 2016
Engineering Faculty, University of Porto Spectrum-based Diagnosis for Run-time Systems Nuno Cardoso Dissertation submitted to Faculdade de Engenharia da Universidade do Porto to obtain the degree of Doctor Philosophiae in Informatics Engineering Supervisor: Professor Rui Abreu Co-Supervisor: Professor David Garlan President: Professor Eugénio Oliveira University of Porto, Portugal Referee: Professor Jorge Barbosa University of Porto, Portugal Referee: Professor Rogério de Lemos University of Kent, UK Referee: Professor João Marques e Silva University of Lisbon, Portugal University College Dublin, Ireland May 27, 2016
D
The work developed for this thesis was co-supported by the National Science Foundation under Grant No. CNS 1116848, and by the scholarship number SFRH/BD/79368/2011 from Fundação para a Ciência e Tecnologia. HASLab INESCTEC
acordo com a probabilidade de serem a verdadeira explicação para o comportamento observado. Concretamente, o nosso objetivo nesta tese prende-se com a otimização destas duas tarefas. Para tal propusemo-nos a resolver 3limitações de forma a tornar o SFL mais rápido e preciso. Em primeiro lugar, o problema de geração de candidatos pertence à categoria de complexidade NP-hard, sendo assim o bottleneck do SFL. Tendo em conta este facto, propusemos um novo algoritmo, denominado de MHS2, que não só é mais eficiente do que o algoritmo existente (Staccato) mas também é capaz de fazer uso de múltiplos CPUspara resolver o problema de forma mais rápida. Na prática, esta melhoria traduz-se em: (1) melhoria da precisão do diagnóstico ao definir um cutoff baseado em tempo, devido ao facto de que ao calcular mais candidatos a probabilidade de encontrar o candidato diagnóstico correto aumenta e, (2) menor latência de diagnóstico ao definir cutoff baseado no tamanho da solução, devido ao facto de que o cálculo de um número fixo de candidatos levar menos tempo com o MHS2do que com o Staccato. Em segundo lugar, o SFL abstrai o resultado das transações em termos de comportamento correto/incorreto. Embora a abstração binária de erro seja capaz de codificar corretamente erros funcionais, na presença de erros não funcionais, os sintomas de erro (como por exemplo a degradação de desempenho) são completamente abstraídos, prejudicando assim a precisão do diagnóstico. Nesta tese propomos uma abordagem baseada em lógica difusa, denominada de Fuzzinel, para codificar e diagnosticar tanto erros funcionais como não funcionais. Em primeiro lugar, propusemos a substituição da lógica binária para lógica difusa no processo de deteção/codificação de estados de erro. Esta abordagem codifica o estado de erro como sendo uma variável contínua, assumindo valores entre 0e1(correspondendo aos estados nominais e faltosos, respetivamente), permitindo assim uma representação mais precisa dos estados de desempenho não ótimo. Em segundo lugar, generalizamos o SFL para incorporar esta informação adicional. Nas experiências realizadas, e quando comparado com a abordagem anterior, o Fuzzinel melhorou a qualidade de diagnóstico em 65% dos casos de teste. Em terceiro lugar, o SFL lida com o facto de os componentes defeituosos poderem falhar intermitentemente considerando um parâmetro (denominado de goodndess) que quantifica a probabilidade de um componente defeituoso apresentar um comportamento correto. No entanto, a abordagem atual assume que (1) essa probabilidade é independente do contexto de execução e (2) não tem em conta experiência passada diagnóstico no cálculo dessa probabilidade. Nesta tese apresentamos uma nova abordagem, denominada de NFGE, com o objetivo de mitigar estas limitações. A resolução para a primeira limitação passou por generalizar tanto a abstração do sistema bem como generalizar o SFL para usar a informação sobre o estado do sistema no processo de diagnóstico. Para resolver a segunda limitação, propusemos abordagem baseada numa técnica denominada de Kernel Density Estimates que utiliza observações de feedback para modelar as goodnesses dos componentes como uma função não linear do estado do sistema. Avaliamos a abordagem com dois casos de estudo, nos quais observamos erros de estimativa menores, aumentando consequentemente a qualidade do diagnóstico.
Contents ++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]>>>+++.>> +++++++++++++++.-.++++++.---------------.+++++++++.++++++.-.[>]<[[-]<] Contents i List of Figures iii List of Algorithms v List of Acronyms vii 1 Introduction 1 1.1 Diagnostic Problem ............................... 4 1.1.1 Heuristic-based Diagnosis ........................ 5 1.1.2 Model-based Diagnosis ......................... 7 1.2 Spectrum-based Fault Localization ....................... 9 1.2.1 Candidate Generation .......................... 12 1.2.2 Candidate Ranking ............................ 17 1.3 Research Goals ................................. 19 1.3.1 Candidate Generation .......................... 19 1.3.1.1 Algorithmic Efficiency ..................... 20 1.3.1.2 Horizontal Scalability ..................... 20 1.3.2 Candidate Ranking ............................ 20 1.3.2.1 Fuzzy Errors .......................... 21 1.3.2.2 System State .......................... 23 1.4 Origin of Chapters ................................ 23 1.5 Thesis Outline .................................. 24 2MHS2– Optimizations 27 2.1 Approach ..................................... 27 2.2 Algorithm Analysis ................................ 30 2.2.1 Completeness/Soundness analysis .................. 30 2.2.2 Complexity Analysis ........................... 32 2.3 Data structures .................................. 32 2.3.1 Encoding (U, S)............................. 33 2.3.2 Encoding D................................ 34 i
2.4 Practical Considerations ............................. 37 2.4.1 Heuristics ................................. 37 2.4.2 Ambiguity Group Removal ........................ 38 2.4.3 Problem Minimization .......................... 40 2.5 Benchmark .................................... 41 2.5.1 Small problems .............................. 42 2.5.2 Large problems .............................. 44 2.6 Summary ..................................... 45 3MHS2– Parallelization 47 3.1 Approach ..................................... 47 3.2 Benchmark .................................... 50 3.2.1 Small Problems .............................. 51 3.2.2 Large Problems ............................. 53 3.3 Summary ..................................... 55 4Fuzzinel 57 4.1 Approach ..................................... 57 4.1.1 Fuzzy Error Detection .......................... 57 4.1.2 Fuzzy Error Diagnosis .......................... 60 4.2 Benchmark .................................... 62 4.2.1 Setup ................................... 62 4.2.2 Evaluation Metric ............................. 65 4.2.3 Results .................................. 66 4.3 Summary ..................................... 69 5NFGE 71 5.1 Approach ..................................... 71 5.1.1 Modeling ˘gj(st).............................. 71 5.1.2 Ranking using ˘gj(st)........................... 74 5.2 Benchmark .................................... 76 5.2.1 Prediction Error Study .......................... 77 5.2.2 Diagnostic Study ............................. 78 5.3 Summary ..................................... 80 6 Related Work 81 6.1 Traditional Debugging .............................. 81 6.2 Software Testing ................................. 82 6.3 Instrumentation .................................. 84 6.4 Automated Diagnosis .............................. 88 7 Conclusions 93 7.1 Research Questions ............................... 93 7.2 Contributions ................................... 96 7.3 Future Work .................................... 96 7.3.1 Goodness Modeling ........................... 96 7.3.2 Candidate Generation ..........................100 7.3.3 Candidate Ranking ............................101 References 107 ii
List of Figures ++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]>>>>----. >+++++++++.++++++++++.+.<<<<.>>>>-----.---------.<<<<.>>++++++.>>+++.- -.++++++++++++++.---.-------------.++++++++++++++.[>]<[[-]<]-<>+>>>+>< 1.1 Relations and properties of self-healing research (adapted from [Psaier and Dustdar, 2011]) ............................... 2 1.2 MAPE-K control loop .............................. 3 1.3 Bug example ................................... 5 1.4 is_freezing_ffunction trace .......................... 5 1.5 Irrigation system example ............................ 6 1.6 Irrigation system example – Sensors ...................... 7 1.7 Diagnostic process ................................ 9 1.8 Spectrum with Mcomponents and Ntransactions .............. 10 1.9 Hit spectrum example .............................. 10 1.10 Irrigation system example – SFL ........................ 11 1.11 Example ...................................... 13 1.12 Candidate generation flowchart ........................ 15 1.13 Example search tree (pre-order traversal, from top to bottom) ........ 16 1.14 Candidate ranking flowchart ........................... 17 1.15 Likelihood plots .................................. 19 1.16 Irrigation system example – Fuzzy errors ................... 21 1.17 Skype call quality rating (screenshot) ...................... 22 1.18 Thesis outline ................................... 25 2.1 Optimizations’ visual intuition .......................... 29 2.2 Search space size comparison ......................... 30 2.3 Example search tree showing binary matrix for (U, S)(no optimizations) . . 34 2.4 Filter with 4elements ............................... 35 2.5 A trie encoding 6HSs .............................. 35 2.6 Example search tree with heuristic values (with optimizations) ........ 39 2.7 (M, N, R)parameters’ impact .......................... 41 2.8 Small problems’ results ............................. 43 2.9 Large problems’ results ............................. 45 3.1 MHS2Map-Reduce workflow .......................... 47 3.2 Lparameter intuition ............................... 49 3.3 Skip functions intuition ............................. 49 iii
3.4 Balancing problem when using the Stride function .............. 50 3.5 Small problems’ results ............................. 52 3.6 Large problems’ results ............................. 53 3.7 Large problems’ results with x-axis transformation .............. 54 4.1 Crisp vs. fuzzy sets ............................... 58 4.2 Arbitrary membership functions ......................... 59 4.3 Error detection sensitivity intuition ....................... 59 4.4 Fuzzy error hit spectrum example ....................... 60 4.5 Likelihood function plot .............................. 61 4.6 Likelihood plots ................................. 62 4.7 Probabilistic topology model ........................... 63 4.8 N-tier service architecture ............................ 64 4.9 Example diagnostic report ............................ 65 4.10 Benchmark results ................................ 67 4.11 Benchmark results (detailed view) ....................... 68 4.12 Quality improvement density plot ........................ 69 5.1 Density estimation and underlying kernels ................... 72 5.2 Impact of bw value ................................ 73 5.3 Goodness vs. pass/fail KDEs.......................... 73 5.4 Estimation model confidence vs. time ..................... 75 5.5 NFGE example .................................. 76 5.6 Prediction errors ................................. 78 6.1 Instrumentation code insertion (adapted from [Tikir and Hollingsworth, 2002]) 85 6.2 Delta debugging example (adapted from [Zeller and Hildebrandt, 2002] and [Perez et al., 2014]) ............................... 88 7.1 State spectrum .................................. 97 7.2 State categorization ............................... 97 7.3 KNN-based feedback spectrum extraction example .............. 98 7.4 Variable model confidence example ...................... 99 7.5 npq(j)comparison ................................101 7.6 Similarity coefficients’ comparison .......................102 7.7 Confidence hit spectrum example .......................103 7.8 Likelihood function plot ..............................103 7.9 Likelihood plots .................................104 iv
List of Algorithms ++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]>>>>----. >+++++++++.++++++++++.+.<<<<.>>>>-----.---------.<<<<.>>+.>>++++++.--- --.++++++++.+++.---------.+++++++++++.------------.+++++.++++++.[>]<[[ -]<]>><+>>>-<+<<-<->->+>><>>+>+<<<<>>-++<>+<++>-<>+>--+>>>>-<--<>++><> 1.1 Staccato ...................................... 14 2.1 MHS2– Optimizations .............................. 28 2.2 isMinimal .................................... 36 2.3 purgeSuperSets ................................. 37 3.1 MHS2– Map task ................................. 48 3.2 MHS2– Reduce task ............................... 50 v
vi
List of Acronyms ++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]>>>>----. >+++++++++.++++++++++.+.<<<<.>>>>-----.---------.<<<<.>>+.>>---.++++++ +++++++++.---.-.+++++++++++.------------.++++++.[>]<[[-]<]<->-+-<->->+ ADL Architecture Definition Language CPU Central Processing Unit DCC Dynamic Code Coverage GUI Graphical User Interface HS Hitting Set KDE Kernel Density Estimate KNN K-Nearest Neighbors MAPE-K Monitor, Analyze, Plan, Execute and Knowledge MBD Model-based Diagnosis MHS2Map-Reduce Heuristic-driven Search for Minimal Hitting Sets MHS Minimal Hitting Set MLE Maximum Likelihood Estimation NFGE Non-linear Feedback-based Goodness Estimate SFL Spectrum-based Fault Localization TMR Triple Modular Redundancy vii
viii
1 Introduction -[------->+<]>.+[--->+<]>.++++++.--.---.-----------.--[--->+<]>-.+[->+ ++<]>+.-[--->+<]>--.-----------.++++++.-.-><>>++>>+<-->-<<+<>>+>-<<-++ ->--++<>+-<>+><>-<><-+-<+>><>---->><->+--<<>->->><<--+<<+-<><++-<+<<-< Modern society is increasingly dependent on technology and, with the appearance of low-cost computing environments, this dependency has experienced an exponential growth. Within a half-century span, computers evolved from a state where they were only able to interact with nearby systems to the point where they can communicate within a matter of seconds despite their distance [Allan,2001,Polsson,2015]. Furthermore, with the availability of low-cost high-speed interconnections, software systems grew to global scales and gradually infiltrated most aspects of the modern life style. The rapid growth of software systems in terms of both size and number happens mainly due to the fact that computers are an extremely versatile tool, which can be used to more efficiently solve a large variety of tasks in different domains. One side effect of the large scope of software systems is the increase in complexity [Horn,2001]. The rise in complexity almost unavoidably leads to a growing number of bugs which, in turn, can eventually cause errors/failures [Salehie and Tahvildari,2005]. When unexpected behavior is observed, developers need to identify the root cause(s) that made the system deviate from its intended behavior. This task (also known as software debugging, fault localization, or error diagnosis) is the most time-intensive and expensive phase of the software development cycle [Hailpern and Santhanam,2002], and has been a concern since the beginning of computer history1. In fact, it was estimated that the global cost of debugging software has risen to $312 billion annually2. To put this value into perspective, that is equivalent to the cost of 729 “Airbus A380” aircrafts3. The high cost of debugging software is related to the fact that the process of detecting, locating and fixing faults is both non-trivial and error-prone. It was estimated that a 1In 1946, the term bug was first used in the scope of computer science by Grace Hopper to document a problem in the Mark II computer. In fact, the source of the problem was an actual bug (more specifically a moth) that was trapped in a relay, impeding its correct functioning. 2University of Cambridge, "Financial content: Cambridge University study states software bugs cost economy $312 billion per year", http://www.prweb.com/releases/2013/1/prweb10298185. htm, accessed October 06, 2015. 3$428 million per unit, https://en.wikipedia.org/wiki/Airbus_A380, accessed October 06, 2015. 1
1 Introduction The existence of such a model enables the diagnostic system to successfully cope (from a theoretical point-of-view) with new error symptoms (such as the patient with the glowing eye). Whenever the observed system behavior for a particular scenario (i.e., a specific assignment over variables in OBS) conflicts with the behavior predicted by the model SD, the diagnostic reasoning revolves around finding sets of components that, by assuming their faultiness, would explain the erroneous behavior. To guarantee generality, MBD algorithms reason in terms of conflicts. Informally, a conflict represents a set of components that cannot be simultaneously healthy to explain the observed erroneous behavior. Definition 2 (h-literal).An h-literal, denotes the component’s health. The positive h-literal hcorresponds to a healthy component whereas, the negative h-literal ¬hcorresponds to an unhealthy one. Definition 3 (Conflict).Let HL+(C) = Vj∈Chjbe the conjunction of positive h-literals for a set of components C⊆COMPS and obs an observation term over variables in OBS.C is a conflict for (DS, obs)if and only if: SD ∧obs ∧HL+(C)(1.1) is inconsistent. In other words, a conflict is a set of components that cannot be simultaneously healthy for the observed erroneous behavior to occur. Definition 4 (Diagnostic Candidate).Let C⊆COMPS be a set of components. We define d(C)to be the conjunction: ^ m∈C ¬hm∧^ m∈COMPS\C hm(1.2) Given an observation term obs over variables in OBS, a diagnostic candidate for DS is a conjunction d(C)such that: SD ∧obs ∧d(C)(1.3) is consistent. In the remainder we refer to d(C)simply as d, which we identify with the set C. In this context, a diagnostic candidate is thereby a set of components that is conjectured to be unhealthy, resolving all conflicts entailed by SD ∧obs. A problem with the above definition is related to the fact that a candidate dcontaining all of the system’s components (i.e.,d=COMPS) always resolves every conflict by SD ∧obs. Intuitively, this is equivalent to saying that the whole system is faulty which, in practice, is not a very helpful conclusion. To apply the concept of a diagnostic candidate to real systems with success, one must refine the definition so that the candidate contains the minimum number of components while still solving all the conflicts. Definition 5 (Minimal Diagnostic Candidate).A candidate dis minimal if and only if @d0: d0⊂dsuch that d0is a diagnostic candidate. 8
1.2 Spectrum-based Fault Localization The end result of the diagnostic reasoning is the diagnostic report. A diagnostic report features a set of explanations for the erroneous behavior (i.e., the diagnostic candidates) as well as a measure of how likely each explanation is. The process of calculating a diagnostic report can be broadly divided in two stages, as depicted in Figure 1.7. Diagnostic Engine Observations Diagnostic Report Candidate Generation Candidate Ranking Figure 1.7: Diagnostic process Definition 6 (Diagnostic Report).A diagnostic report D= (d1, . . . , dk, . . . , dK)is an ordered set of Kdiagnostic candidates, such that: ∀dk∈D:Pr(dk|obs)≥Pr(dk+1 |obs)(1.4) 1.2 Spectrum-based Fault Localization A limitation of traditional MBD approaches is the necessity of a detailed system model which, in practice and due to the large complexity of modern computer systems, normally entails a large modeling effort/cost, thus narrowing its range of application [Pietersma et al.,2006,Horn,2001]. To overcome the complexity of creating precise system models, Spectrum-based Fault Localization (SFL)5approaches were proposed [Abreu et al., 2009a,De Kleer,2009,Casanova et al.,2013]. Instead of relying on a fine grained model of the system (i.e.,SD ∈DS) to generate conflict sets, SFL infer conflicts by performing a dynamic analysis of the system. To apply SFL to a system, it must be abstracted in terms of two general concepts: component, and transaction. A component is an element of the system that, for diagnostic purposes, is considered to be atomic6. A transaction is a set of component activations that (1) share a common goal, and (2) the correctness of the provided service can be verified. The error detection mechanism, from a SFL perspective, is treated as a black box. To gather all the required information to perform diagnosis, the system under analysis must be instrumented (see Section 6.3). The instrumentation’s output, commonly known as spectrum [Harrold et al.,1998], is defined as the pair (A, e)(Figure 1.8), where: •A(activity matrix) encodes the involvement of components in transactions. •e(error vector) encodes the correctness of each individual transaction. 5For simplicity and unless stated otherwise, we use the acronym SFL to refer to a particular SFL approach known as Spectrum-based Reasoning for Fault Localization. In Section 6.4 (page 89) an alternative and more common SFL approach is presented. 6In a software environment, a component can be for instance a statement, a function, a class, a service, etc.. 9
1 Introduction activity matrix A11 A12 · · · A1M A21 A22 · · · A2M . . .. . ..... . . AN1AN2· · · ANM error vector e1 e2 . . . eN Figure 1.8: Spectrum with Mcomponents and Ntransactions Even though several types of spectra exist, the most commonly used is called a hit spectrum [Harrold et al.,1998,Yilmaz et al.,2008,Santelices et al.,2009]. Definition 7 (Hit Spectrum).The hit spectrum abstraction encodes the components’ activity in terms of hit/not hit and the transactions’ correctness in terms of pass/fail. Using the hit spectrum abstraction, Aand eare defined as: Aij =(1,if component jwas involved in transaction i 0,otherwise (1.5) ei=(1,if transaction ifailed 0,otherwise (1.6) For convenience, in this thesis we may treat Aias a set containing the indices of all components involved in transaction i. Formally, Aican also be defined as: Ai={j|if component jwas involved in transaction i}(1.7) Since both forms encode the same information, we can use the two forms interchangeably. Whenever we apply set operations to A, we are implicitly using the set form. In Figure 1.9 an example hit spectrum in both forms is presented. iAe c1c2c3 1 1 1 0 1 2 1 0 1 1 3 1 1 1 0 (a) Matrix form i A e 1{1,2}1 2{1,3}1 3{1,2,3}0 (b) Set form Figure 1.9: Hit spectrum example 10
1.2 Spectrum-based Fault Localization c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 (a) Components s1 s2 s3 s4 Active Sensor (b) Transaction iAe c1c2c3c4c5c6c7c8c9c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 1• • .• • ....••••••...• • 2.• • .• • .....••••••••. 3...• • .• • . . •••.•...•. 4....• • .• • . . • • .•.• • • • (c) Hit spectrum (0’s and 1’s were replaced by “.” and “•” for readability) Figure 1.10: Irrigation system example – SFL To illustrate how SFL can be used in an arbitrary system, consider again the example in Figure 1.6. For this system, the set of all components is composed of 19 elements (Figure 1.10a): 9sprinklers (c1through c9), 9piping elements (c10 through c18) and the water supply (c19). There are 4different transaction types (one for each sensor). Each of those transactions consists of the activation of all the surrounding sprinklers as well as the piping elements used to by those sprinklers, as depicted in Figure 1.10b. A possible approach to evaluate the success of each transaction would be to compare the humidity value obtained by the corresponding sensor to an arbitrary threshold interval. If the humidity on the ground is either too high or too low, the transaction fails. Consider a scenario where, for the described system, sensors s1and s4(see Figure 1.10b) detect an incorrect humidity level whereas, the remaining sensors, detect a corrected humidity level. The spectrum corresponding to this scenario is depicted in Figure 1.10c. The spectrum contains 4transactions (each transaction icorresponds to the sensor si) and both transactions 1and 4are marked as erroneous. Additionally, for 11
1 Introduction each transaction, all the sprinklers adjacent to the corresponding sensor as well as the piping elements needed to feed such sprinklers are marked as active. In the next sub-sections we present the relevant details of existent SFL algorithms to solve both the candidate generation and ranking problems. 1.2.1 Candidate Generation In a naïve approach, the candidate generation problem can be addressed by computing the power set of all components in the system (P(COMPS)). However, as |{P(COMPS)}| = 2{|COMPS|}, this approach becomes quickly ineffective. In practice, rather than iterating over all possible sets just to find that most are not minimal or even consistent with the observations, search algorithms are typically used to only consider sets that meet the minimal candidate criteria (see Definition 5). Despite the advantage of only computing minimal candidates, the problem is still remarkably hard. The calculation of minimal candidates, conceptually referred to as hitting sets, is a problem equivalent to the Minimal Hitting Set problem [Reiter,1987], which is known to be NP-Hard [Garey and Johnson,1990]. The formal definition of the Minimal Hitting Set problem goes as follows: Definition 8 (Hitting Set).Given a set Uof Melements (called the universe) and a collection Sof Nsets, a set dis said to be a Hitting Set (HS)of (U, S)if and only if: HS(U, S, d) := d⊆U∧∀s∈S:d∩s6=∅(1.8) Corollary 1.2.1. If @s∈S:s∩U=∅,UisaHS of S. Corollary 1.2.2. If ∃s∈S:s∩U=∅,HS(U, S, d)never holds. Corollary 1.2.3. d=∅is a hitting for S=∅. Corollary 1.2.4. HS(U, S, d)is associative: HS(U, S, d)∧HS(U0, S0, d0) =⇒HS(U∪U0, S ∪S0, d ∪d0)(1.9) Definition 9 (Minimal Hitting Set).A set dis a Minimal Hitting Set (MHS)of (U, S)if and only if: MHS(U, S, d) := HS(U, S, d)∧@d0⊂d:HS(U, S, d0)(1.10) i.e.,disaHS and no proper subset of disaHS. There may be several MHSsdkfor (U, S), which constitute the MHS collection D. The MHS problem consists thereby in computing Dfor a particular pair (U, S). Putting this definition in terms of the candidate generation problem, the set of all components of the system (COMPS) is equivalent to the set U, whereas the set of all conflicts entailed by SD ∧obs is equivalent to S. A MHS for all the conflicts entailed by SD ∧obs is, in fact, a diagnostic candidate for SD ∧obs [Reiter,1987]. 12
1.2 Spectrum-based Fault Localization Under the SFL abstraction, a conflict occurs whenever a failed transaction exists in the spectrum. The elements of the conflict set are the components activated in such transaction. Intuitively, since the transaction failed, it follows that at least one of the components must not be healthy for the erroneous behavior to occur. As an example, consider the hit spectrum in Figure 1.11a for which all 2Mpossible (but not necessarily valid) candidates (i.e.,P(COMPS)) are presented in Figure 1.11b. For this particular spectrum, two minimal candidates/MHSsexist: {1}and {2,3}. Even though the set {1,2,3}is also HS, it is not minimal as it can be subsumed either by {1}or {2,3}. i A e 1{1,2}1 2{1,3}1 3{1,2,3}0 (a) Hit spectrum {1,2,3} {2,3} {1,3} {1,2} {3} {2} {1} {} (b) Hasse diagram of P({1,2,3}) Figure 1.11: Example Being a NP-hard problem, the usage of exhaustive search algorithms (e.g., [Reiter, 1987,Wotawa,2001]), is prohibitive for most real-world problems. In order to solve the candidate generation problem in a reasonable amount of time, approaches that relax the strict minimality7constraint have been proposed [Abreu and Van Gemund,2009,De Kleer and Williams,1992,Feldman et al.,2008]. A simplified8version of the state-of-the-art SFL candidate generation algorithm (called Staccato) [Abreu and Van Gemund,2009] is presented in Algorithm 1.1 and Figure 1.12. The algorithm works in a divide and conquer fashion by, at each stage of its execution, performing one of two different tasks (lines 2,3, and 4or 6–8), depending on whether the set dis a HS. As we shall shortly see, due to the algorithm’s divide and conquer nature, dis a HS whenever S=∅. The first task, which is triggered whenever dis not a HS (line 1), aims at dividing the initial problem in smaller sub-problems. This goal is achieved by iteratively selecting an element j∈Ufrom a heuristically9ordered set (line 2) and creating a temporary collection S0 containing all the sets s∈S:j∈s,i.e., the sets hit by {j}(line 3). Finally, the algorithm makes a recursive call to solve the sub-problem S\S0with set d∪ {j}(line 4). The second task, which occurs whenever dis a HS (line 5), aims at collecting HSswhile guaranteeing that no HS in Dhas a proper subset also contained in D. The first step in this task is to check if dis minimal (line 6) with regard to the already discovered MHS collection D. If dis minimal, all super-sets of din Dare purged (line 7) and, finally, dis added to D(line 8). 7We use the term minimal in a more liberal way due to mentioned relaxation. A candidate dis said to be minimal if no other calculated candidate is contained in d. 8For simplicity, the cutoff conditions were omitted. 9The details of chosen heuristic are presented in Section 2.4.1. For now assume that the order is arbitrary and that, for every possible ordering, the algorithm computes the same result. 13
1 Introduction Algorithm 1.1 Staccato Inputs: (U, S, d =∅, D =∅) Output: Minimal hitting set collection D 1if S6=∅then #divide task 2for j∈Rank(U, S)do 3S0← {s|s∈S∧j∈s} 4D←Staccato(U\ {j}, S \S0, d ∪ {j}, D) 5else #conquer task 6if @d0∈D:d0⊆dthen 7D←D\ {d0|d0∈D∧d⊆d0} 8D←D∪ {d} 9return D To illustrate how Staccato works, consider the example in Figure 1.1310 which represents a possible search tree for Staccato with U={1,2,3}and S={{1,2},{1,3}} (Figure 1.11a). Each node in the search tree represents a call to the function (all the parameters as well as the return value are encoded as a table). Leaf nodes represent function calls for which dis a HS whereas intermediate nodes represent calls for which d is not a HS. In the outer call to the algorithm (the leftmost node), as S6=∅, the algorithm performs the divide task. After exploring the sub-tree starting with d={2}, the algorithm yields the collection D={{1,2},{2,3}}. We can see that at this point, if the execution were to be interrupted, {1,2}would be erroneously considered a MHS. However, after exploring the sub-tree starting with d= {1}, the set {1,2}is removed yielding the collection D={{1},{2,3}}. The inspection of the sub-tree starting with d={3}does not make further changes to collection D. On the one hand, the HS {1,3}is a proper super-set of {1}. On the other hand, the HS {2,3}is already contained in D. As expected, the result for this example would be the collection D={{1},{2,3}}. 10Note that the order of node exploration (and consequently the shape of the tree) was selected for illustrative purposes. 14
1.2 Spectrum-based Fault Localization S U d(current set) D(candidate set) Initially empty is S empty? is d minimal? yes:dis a candidate remove super-sets of dfrom D yes add dto D Return D no heuristically sort components no:dis not a candidate create temporary S0filtering transactions where cis active recursive call with S0,d∪ {c} update Dwith return value For each component c∈U Figure 1.12: Candidate generation flowchart 15
1 Introduction {3} ∅ {1,2} ∅ {{1,2}} {1} ∅ {2,3} {{1,2}} {{1,2},{2,3}} {2} ∅ {1,3} {{1},{2,3}} {{1},{2,3}} {1} ∅ {2,3} {{1},{2,3}} {{1},{2,3}} {1,3} {{1,3}} {2} ∅ {{1,2},{2,3}} {2,3} ∅ {1} {{1,2},{2,3}} {{1},{2,3}} {1,2} {{1,2}} {3} {{1},{2,3}} {{1},{2,3}} {1,2,3} {{1,2},{1,3}} ∅ ∅ {{1},{2,3}} U S d D Return Figure 1.13: Example search tree (pre-order traversal, from top to bottom) 16
1.2 Spectrum-based Fault Localization 1.2.2 Candidate Ranking The candidate ranking problem is normally addressed using a naïve Bayes classifier [Abreu et al.,2009a,De Kleer,2009]. Concretely, the posterior probability of each candidate d∈Dgiven the observed run-time behavior (Pr(d|obs)) is calculated assuming conditional independence throughout the process (Figure 1.14). Pr(d|A, e) = Pr(d)× |A| Y i=1 Pr(Ai, ei|d) Pr(Ai, ei) (Naïve Bayes Classifier) Estimate goodness parameters (Maximum likelihood estimation) For each candidate d∈D A, e (spectrum) D(candidate set) Sort D Figure 1.14: Candidate ranking flowchart Under a set of observations, the posterior probabilities are calculated according to Bayes rule as: Pr(d|obs) = Pr(d)×Pr(obs |d) Pr(obs)(1.11) Since for SFL obs = (A, e), we can rewrite the previous expression as: Pr(d|A, e) = Pr(d)×Pr(A, e |d) Pr(A, e) =Pr(d)×Y i∈1..N Pr(Ai, ei|d) Pr(A, e) (1.12) The denominator Pr(A, e)is a normalizing term that is identical for all d∈Dand is not considered for ranking purposes. To define Pr(d), let pjdenote the prior probability that a component cjis at fault11. Assuming that components fail independently, the prior probability for a particular candidate d∈Dis given by: Pr(d) = Y j∈d pj·Y j∈COMPS\d (1 −pj)(1.13) 11The value of pjis application dependent. In the context of development-time fault localization it is often approximated as pj= 1/1000,i.e.,1fault for each 1000 lines of code [Carey et al.,1999]. 17
1 Introduction Multi-core Software Engineering, Performance, and Tools (MUSEPAT)16 [Cardoso and Abreu,2013a]. Chapter 4is based on the work from [Cardoso and Abreu,2014b], which was published in the proceedings of the 25th International Workshop on Principles of Diagnosis (best paper award nominee). Chapter 5is based on the work from [Cardoso and Abreu,2013c], which was published in the proceedings of the 27th AAAI Conference on Artificial Intelligence (AAAI)17. 1.5 Thesis Outline In Figure 1.18 we present the thesis outline. We suggest a pre-order traversal of the tree, from top to bottom. 16http://eventos.fct.unl.pt/musepat2013/ 17http://www.aaai.org/Conferences/AAAI/aaai13.php 24
1.5 Thesis Outline SFL Section 1.2 Candidate Generation Section 1.2.1 Research Goals Section 1.3.1.1 MHS2 Chapter 2 Research Goals Section 1.3.1.2 MHS2 Chapter 3 Candidate Ranking Section 1.2.2 Research Goals Section 1.3.2.1 Fuzzinel Chapter 4 Research Goals Section 1.3.2.2 NFGE Chapter 5 Figure 1.18: Thesis outline 25
1 Introduction 26
2MHS2– Optimizations ++[---------->+<]>.-----.+++++++++++.>-[----->+<]>-.--[--->++<]>.--[-- >+++<]>.[--->++<]>++.[-->+++++<]>-.+[--->+<]>.++++.-----------.++++.-- --.-[--->+<]>++.[->+++++<]>-.--[--->+<]>-.-----------.++++++.-.+++++.- ---<->-<><+<+<+->-+<<++<-<>---<>+>><<+<>-<<+<><<+-+-<+<+><+<><>+-+-+>- In this chapter we present the sequential version our novel MHS generation algorithm, dubbed Map-Reduce Heuristic-driven Search for Minimal Hitting Sets (MHS2). As explained in Section 1.3.1.1 (page 20), our goal in this chapter is to improve the computational efficiency of the Staccato algorithm. This chapter is divided as follows. First, we introduce our MHS generation algorithm. Second, we provide a formal analysis of the proposed algorithm. Third, we discuss the data-structures used in the algorithm’s implementation. Fourth, we discuss some practical aspects of the algorithm’s utilization. Fifth and lastly, we evaluate the performance of our algorithm. 2.1 Approach The proposed algorithm consists of an improved version of the Staccato algorithm [Abreu and Van Gemund,2009] (see Algorithm 1.1, page 14). In contrast to the original algorithm, we propose 3optimizations that prevent redundant calculations (Figure 2.1). The first optimization (line 7and Figure 2.1a) prevents multiple evaluations of the same set, as it was the case of {2,3}in the example presented in Figure 1.13 (page 16). Removing element jfrom U(and, consequently, from S) after its evaluation has the practical effect of reducing the search space to a spanning tree of the original search tree. To see the effect of this optimization, consider the example in Figure 2.1a. The example depicts the largest search trees for U={1,2,3}with and without optimization 1. Each box represents a call to algorithm and the value contained inside each box represents the value of dfor that particular call. Without the proposed optimization, a large amount of redundant work would be performed (e.g.,8evaluations of the set {1,2,3}). With the proposed optimization, it is guaranteed 27
2MHS2– Optimizations Algorithm 2.1 MHS2– Optimizations Inputs: (U, S, d =∅, D =∅) Output: Minimal hitting set collection D 1if ∃s∈S:s∩U=∅then #Opt 3 2return D 3if S6=∅then 4U←U\ {j|j∈U∧(@s∈S:j∈s)}#Opt 2 5for j∈Rank(U, S)do 6S0← {s|s∈S∧j∈s} 7U←U\ {j}#Opt 1 8D←MHS2(U, S \S0, d ∪ {j}, D) 9else 10 if @d0∈D:d0⊆dthen 11 D←D\ {d0|d0∈D∧d⊆d0} 12 D←D∪ {d} 13 return D that every set is evaluated at most once. Concretely, the upper-bound size of the search space without optimizations can be described with the following expression: a(U) = 1 + b(|U|)(2.1) b(x) = (x+x∗b(x−1) if x > 0 0otherwise (2.2) b(x)is described on the On-Line Encyclopedia of Integer Sequences as the number of permutations of nonempty subsets of a set with size x. Since the empty set may also be a solution for a given problem, it is necessary to add 1to the result of b(x)(see https://oeis.org/A007526 for further information). On the other hand, the upper-bound size of the search space for the optimized algorithm is given by the following expression: c(U)=2|U|(2.3) To illustrate both upper-bound search space sizes, both functions are plotted in Figure 2.2. We can clearly see that a(U)grows much faster than c(U)(note the log scale). The second optimization (line 4and Figure 2.1b) preemptively filters elements of U not contained in any set in S. As this filtering process reduces the size of Uand, consequently, the size of the data structures holding (U, S), the operations performed on (U, S), such as the ranking calculation, become faster. 28
2.1 Approach {} {c3} {c2, c3} {c1, c2, c3} {c1, c3} {c1, c2, c3} {c2} {c2, c3} {c1, c2, c3} {c1, c2} {c1, c2, c3} {c1} {c1, c3} {c1, c2, c3} {c1, c2} {c1, c2, c3} {} {c3} {c2, c3} {c1, c2, c3} {c1, c3} {c1, c2, c3} {c2} {c2, c3} {c1, c2, c3} {c1, c2} {c1, c2, c3} {c1} {c1, c3} {c1, c2, c3} {c1, c2} {c1, c2, c3} (a) Optimization 1 c1c2c3c4ei • • . . • •.•.• • • • • . c1c2c3ei • • .• •.• • ••• . (b) Optimization 2 c1c2c3ei • • .• •.• • . . . • ••• . (c) Optimization 3 Figure 2.1: Optimizations’ visual intuition The third optimization (lines 1,2, and Figure 2.1c) prevents the examination of branches such that ∃s∈S:s∩U=∅,i.e., there is at least one set that cannot be hit by any element in U. The existence of such a set in Sguarantees, by definition, that no HS will be found (see Corollary 1.2.2, page 12). 29
2MHS2– Optimizations 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 100 105 1010 |U| Upper-bound size (log) Without optimization 1 — a(U) With optimization 1 — c(U) Figure 2.2: Search space size comparison 2.2 Algorithm Analysis In this section we discuss the algorithm from a more formal point-of-view. First, we prove the algorithm’s soundness and completeness.1Second, we provide some intuition on the complexity of the different operations performed by the MHS2algorithm. 2.2.1 Completeness/Soundness analysis Lemma 2.2.1. All sets computed by MHS2are HSs. Proof. Suppose MHS2is set to compute a single HS. At each step, an element j∈U is selected and MHS2is recursively called for S\S0with set d∪ {j}. This procedure is repeated until S=∅, at which point ∅is a HS for S(see Corollary 1.2.3, page 12). Let S0 nand jnbe the S0set and jelement at the nth recursive level. Since ∀s∈S0 n:jn∈s (i.e.,{jn}is a hitting set for S0 n), it follows that: n ^ 1 HS(Un, S0 n, dn)(2.4) From Corollary 1.2.4 (page 12), as S=Sn 1S0 nand d=Sn 1dn, it follows that: n ^ 1 HS(Un, S0 n, dn) =⇒HS(U, S, d)(2.5) Lemma 2.2.2 (Completeness).Staccato computes all MHSs for a problem (U, S). 1In this context, and assuming no cutoffs are enforced, the algorithm is sound if all computed sets are MHSs. A complete algorithm should compute all MHSs. It is worth noting that a sound algorithm may miss some MHSsand a complete algorithm may compute some sets that are not MHSs(i.e., soundness <completeness). 30
2.2 Algorithm Analysis Proof. Suppose Staccato does not stop the branch exploration after a HS is found. Under this constraint, it follows that the algorithm comprehensively explores every element in P(U), which contains all HSsfor (U, S)and, consequently, all MHSsfor (U, S). By stopping the branch exploration after an HS dis found, the HSscontained in {d∪d0| d0⊆(U\d)∧d06=∅} are ignored. Since, by definition HS(U, S, d)∧(d06=∅) =⇒ ¬MHS(U, S, d ∪d0), we can conclude that even though some HSsare ignored, all MHSs are nonetheless computed. Theorem 2.2.1. Optimization 1preserves completeness. Proof. Let Ω = P(U\(d∪ {j})). After every recursive call to Staccato, it is guaranteed that all MHSscontained in K={d∪ {j} ∪ e|e∈Ω}are evaluated (Lemma 2.2.2). By removing jfrom Ufor subsequent calls of Staccato under the same search tree branch, the algorithm prevents subsequent evaluations of the sets contained in K, only calculating the MHSscontained in L={d∪e|e∈Ω}. Since K∪L={d∪e|e∈P(U\d)}, the optimization preserves completeness. Theorem 2.2.2. Optimization 2preserves completeness. Proof. Let K={j|j∈U∧(@s∈S:j∈s)}. By definition, it follows that: HS(U, S, d)∧d∩K6=∅=⇒ ¬MHS(U, S, d)(2.6) Since removing elements in Kfrom Uonly prevents the calculation of sets that are guaranteed not to be MHSs, we can conclude that the optimization preserves completeness. Theorem 2.2.3. Optimization 3preserves completeness. Proof. From Corollary 1.2.2 (page 12), it follows that: ∃s∈S:s∩U=∅=⇒@d:HS(U, S, d)(2.7) Since halting the exploration of a branch whenever the aforementioned condition holds only prevents the examination of sets that are guaranteed not to be HSs, we can conclude that the optimization preserves completeness. Corollary 2.2.1. MHS2is complete. Theorem 2.2.4 (Soundness).If all MHSs are evaluated, all sets computed by MHS2are MHSs. Proof. Given the fact that a set dis only added to Dif and only if @d0∈D:d0⊆dand, prior to its addition, all sets in {d0|d0∈D∧d⊆d0}are removed from D, it follows that, at any given point, the sets in Dare relatively minimal (i.e.,@d,d0∈D:d0⊂d). Since, by hypothesis, all existent MHSsfor the problem are evaluated (and therefore added to D) and all sets contained in Dare always relatively minimal, no absolutely non-minimal HS is contained in D. 31
2MHS2– Optimizations 2.2.2 Complexity Analysis As shown in [Garey and Johnson,1990], the MHS problem is NP-Hard. In this section we provide upper-bound values for the complexity of the operations performed in each call of MHS2. Each time MHS2is called it: 1. Checks whether the current sub-problem has any solutions: OM×N, where M=|U|and N=|S|(line 1, optimization 3). 2. Checks whether the current sub-problem is trivially solvable: O1(line 3). If the problem is not trivially solvable, the algorithm: 1. Removes elements from Uthat are guaranteed not to form MHSs:OM×N(line 4, optimization 2). 2. Generates heuristic values for each element in U: at least OM, usually OM× N(line 5). 3. Ranks elements of Uaccording to their heuristic values: OM×log(M)(line 5). 4. Prepares, for each element of the ranking, a sub-problem to be solved: OM2×N (lines 6–7). a) Simplifies the problem: OM×N(line 6). b) Removes the current element from U:O1(line 7, optimization 1). If the problem is trivially solvable, the algorithm: 1. Checks if the current set dis minimal with respect to D:OI×K×L, where I=|d|, K =|D|,and L=Pd0∈D |d0| K(line 10). 2. Removes non-minimal HSsfrom D:OI×K×L(line 11). 3. Adds dto D:OI(line 12). 2.3 Data structures To have an efficient implementation of MHS2the following operations must be performed efficiently: 1. Remove elements from S(line 6); 32
2.3 Data structures 2. Check set for relative minimality (line 10); 3. Purge proper super sets of a set from collection D(line 11); In the remainder of this section, we analyze the data structures used in our reference implementation. The implementation is available at https://github.com/ npcardoso/MHS2. 2.3.1 Encoding (U, S) To efficiently encode and manipulate (U, S), we make use of a N×Mbinary matrix (referred to as A) where each of the matrix’s rows encodes the membership of each element j∈Uin a particular set Si(i.e.,Aij = [j∈Si], where [.]denotes Iverson’s operator: [True] = 1,[False] = 0). To avoid making multiple copies of the matrix when a modification to (U, S)is required, we make use of a data structure we refer to as a filter. In practice, a filter is a vector storing which columns/rows should be ignored at each stage of the algorithm’s execution. Consequently, the resultant data structure is a 3-tuple (A, fc, fr)representing the original (U, S)matrix, and the filtered columns/rows respectively. To illustrate how this works in practice, consider the example in Figure 2.3 showing the matrix representation of (U, S). Similarly to Figure 1.13 (page 16), each node in the search tree represents a call to the function (all the parameters as well as the return value are encoded as a table). Colored matrix cells represent the filtered elements of the original matrix. Each circle marks the element that triggered the filtering of corresponding row. A naïve implementation of such filters could be done with Boolean vectors where each cell encodes the state of each column/row. Even though this approach is more efficient than copying the matrix multiple times, it is possible to improve this structure to be more efficient when iterating over a filtered matrix. To that end, we use an integer vector where each cell contains the index of the next unfiltered element. Such filter vectors have n+ 1 elements, where nis the maximum number of elements to be filtered. The filter vector indexes are zero-based so it is possible to filter the first row/column of the matrix, which are one-based. The initial state for n element filter is formally defined as fi= (i+ 1) mod (n+ 1). To iterate using one of such filters, a counter starting at 0must be kept and, after each iteration, it is updated as i=fi. The loop ends when the counter returns its value to 0. To filter an element i, one must iterate back from j=i−1until fj6=i, setting each fjto be equal to fi. In contrast to the naïve approach, when all elements are filtered, the loop is never executed, improving the efficiency. Figure 2.4 depicts the states of a filter for a maximum of four elements after filtering elements 3,1,2, and, finally, 4. 33
2MHS2– Optimizations are interchangeable, the remaining 3MHSscan be generated by applying all possible substitutions. 2.4.3 Problem Minimization A non-minimal (U, S)problem occurs when: ∃s,s0∈S:s⊂s0(2.12) Whenever such condition holds, solving (U, S)is equivalent to solving (U, S0), where S0= S\ {s0}. This is due to the fact that, on the one hand, by hitting sit is guaranteed by definition that all sets s0are also necessarily hit. On the other hand, by hitting a set s0 with an element x(i.e.,x∈s0), it does not guarantee that sis also hit. In the case of x not hitting s,2possible outcomes can take place: 1. There is a set ∈S0such that x∈(s0∩). In this scenario, if d∪ {x}is a MHS for (U, S), it also is a MHS for (U, S0). 2. There is not a set ∈S0such that x∈(s0∩). In this case, if d∪ {x}is a HS for (U, S),dalso is a HS for (U, S)and, therefore, d∪ {x}is not a MHS for (U, S). Given this, the removal of all sets s0from Sdoes not alter its result. Consequently, solving the problem (U, S)or its minimal version is equivalent. However, since the size of the data-structures is reduced, the algorithm performs faster. To implement this functionality, one may use the trie data structure described in Section 2.3.2 to filter the non-minimal sets. As an example consider the following problem: U={1,2,3,4} S={{1,2},{1,3},{1,2,4},{1,2,3,4}} D={{1},{2,3}} (2.13) For this problem we can see that sets {1,2,4}and {1,2,3,4}are not minimal as both are supersets of {1,2}. In fact, only sets {1,2}and {1,3}are minimal, which produce the following minimal problem: U0={1,2,3} S0={{1,2},{1,3}} D0={{1},{2,3}} (2.14) As expected, the solution to both problems is equal. 40
2.5 Benchmark 2.5 Benchmark To assess the performance of our algorithm we conducted a set of benchmarks aimed at evaluating the impact of each of the proposed optimizations(all the benchmarks were conducted in a single computer with 2×Intel Xeon Central Processing Unit (CPU) X5570 @2.93GHz, 4cores each). For our benchmarks, we generated several MHS problems by means of a Bernoulli process, with parameters M=|U|,N=|S|, and R=Pr(j∈s). The presented results represent the average over 100 problems for each combination (M, N, R). Furthermore, when applicable, the Ochiai heuristic was used, and no pre-processing was performed on (U, S). ● ● ●●●●●●●● 1e0 1e2 1e4 1e6 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R |D| (log) M = N = ● 10 20 30 40 ● ● ●●●●●●●● 0 5 10 15 20 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R MHS Cardinality M = N = ● 10 20 30 40 Figure 2.7: (M, N, R)parameters’ impact To better understand how the parameters affect the problem’s solution, consider the following observations (Figure 2.7): 1. For the same (M, N)parameter values: a) The average MHS cardinality for problems generated with smaller Rvalues is larger than the average MHS cardinality for problems generated with larger R 41
2MHS2– Optimizations values (i.e., the MHS cardinality is negatively correlated with the Rvalue). b) The average solution size (i.e.,|D|) was minimal for problems generated with R= 0.05. c) |D|was not maximal for problems generated with R= 0.95. 2. Problems generated with larger (M, N)values have the maximal |D|value for smaller Rvalues than problems generated with smaller (M, N)values (i.e., the value of Rfor maximal |D|is negatively correlated with (M, N)). 2.5.1 Small problems The first benchmark in this section is aimed at evaluating the impact of each optimization for small problems, for which all MHSscan be calculated (M=N∈ {10,20,30,40}, and R∈ {0.05,0.15, ..., 0.95}). In Figure 2.8, we observe the throughputs3for 5different implementations of the algorithm with an increasing number of features. At one end of the scale, Baseline represents an implementation with no optimizations as well as no heuristic (i.e., random ranking). At the other end, Opts 1–3represents an implementation with both the Ochiai heuristic and all the proposed optimizations (the ids are presented in Algorithm 2.1). Heuristic represents the performance of Staccato. For readability, data points for which the throughput was less than 0.1MHS/sec were omitted from the plots. The analysis of the results shows that the heuristic by itself introduces a significant performance improvement over Baseline for M=N= 10 (5×faster on average, note the log scale). Such result presents a strong evidence that using a heuristic to drive the search can not only improve the quality of the computed MHSs(as shown in [Abreu and Van Gemund,2009]) but also improve the computational efficiency of the algorithm. Additionally, and in comparison to the Heuristic (i.e.,Staccato) performance, all the optimizations showed an improved performance of at least 1.5×(Opt 1for R= 0.95), at most 170000×(Opts 1–3for R= 0.05), and on average 34000×,8000×, and 1700× for Opts 1–3,Opts 1–2, and Opt 1respectively. Analyzing the remaining tests cases (M=N∈ {20,30,40}), we can see that, with the increase of the problem size and for small Rvalues, the relative contribution of each optimization becomes more significant (for M=N∈ {10,20,30}, R = 0.05,Opts 1–3 performs 30×,7000×, and 1000000×faster than Opt 1, respectively). We also observe that, on average and for all combinations of (M, N, R),Opts 1–3was the algorithm with the best performance, implying that the computational savings introduced by optimization 3should, on average, outweigh its overhead. It also worth understanding how each optimized implementation improves over Heuristic. A closer inspection of the results reveals the following patterns: 3The throughput metric is calculated as the number of generated MHSsdivided by the total run-time and is measured in MHSs/sec. When calculating this metric, we took care to discard all non-minimal HSs. 42
2.5 Benchmark ●●●●●●● ●●● 1e−2 1e0 1e2 1e4 1e61e−2 1e0 1e2 1e4 1e61e−2 1e0 1e2 1e4 1e61e−2 1e0 1e2 1e4 1e6 M = N = 10 M = N = 20 M = N = 30 M = N = 40 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R Throughput (log) ● Baseline Heuristic (Staccato) Opt 1 Opts 1−2 Opts 1−3 (MHS2) Figure 2.8: Small problems’ results 1. All algorithms have similar performances for large Rvalues. 2. All optimizations are more effective for smaller Rvalues. 3. Optimizations 1and 2have a considerable effect for all Rvalues whereas optimization 3is only effective for small Rvalues. Pattern 1can be explained by noting that the average MHS cardinality is negatively correlated with the Rvalue. It follows then that, problems with large Rvalues have shallow search trees and, consequently, the optimizations, which focus on improving the search tree exploration, have a lesser performance impact. Conversely, pattern 2can be explained using the complimentary argument. For small Rvalues, as the search trees become deeper, the non-optimized algorithms perform a 43
2MHS2– Optimizations large amount of unnecessary divide tasks, thus leaving (exponentially) more room for improvements. To explain pattern 3, we shall look at the optimizations individually: •Optimization 1prevents the exploration of paths composed of the same elements although in different orders. Such inefficiencies occur whenever the MHSsare composed of more than 1element. •Optimization 2reduces the overhead associated with the heuristic calculation. The overhead reduction also occurs whenever the MHSsare composed of more than 1 element. •Optimization 3performs a look-ahead verification to assess whether the current sub-tree is a dead-end (i.e., no MHSswill be generated in such sub-tree) and terminate the exploration if a dead end is reached. The impact of this optimization is contingent on how far ahead it detects the dead-end which, in turn, is dependent on the deepness of the search tree. As the deepness of the search tree is negatively correlated with R, this optimization is more effective for small Rvalues. 2.5.2 Large problems The second benchmark is aimed at evaluating the impact of each optimization for large problems where it is impractical to calculate all MHSs(M=N= 103, and R∈ {0.05,· · · ,0.95}). In all the following test cases a time based cutoff of 30 seconds was enforced. The first two plots in Figure 2.9 present both the percentage of HSsthat were minimal (MHS%) and the average HS cardinality for each of the 5implementations. For large problems, we observe that the heuristic plays an important role in assuring that the computed HSsare in fact minimal (98% vs. 0% minimality for Heuristic and Baseline, on average). Even though the MHS% of Opts 1–2and Opts 1–3is lower when compared to Opt 1, we can see that the average HS cardinality of the former implementations is comparable to cardinality of the later, implying that the number of extraneous elements in the non-minimal HSsis small (specially when compared to Baseline). The remainder of Figure 2.9 presents the number of HSsas well as the throughput for all implementations. While Baseline,Heuristic, and Opt 1compute 500 HSson average, the remaining implementations compute 93000 HSson average (186×better). Taking into account the number of computed HSs, despite the lower MHS%, the absolute number of MHSsfor optimizations 2and 3is effectively larger than the number of MHSscalculated by the remainder algorithms. Finally, it is interesting to note that even though we increased the problem size by 25× factor, the throughput of MHS2is comparable to the throughput observed in Figure 2.8. We can conclude that the fully optimized MHS2scales to large problems more efficiently than Staccato. 44
2.6 Summary ●●●●●● ● ●●● 0% 25% 50% 75% 100% 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R Minimal ● Baseline Heuristic (Staccato) Opt 1 Opts 1−2 Opts 1−3 (MHS2) ● ●●●●●●●●● 1e0 1e1 1e2 1e3 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R Avg. Card. (log) ● Baseline Heuristic (Staccato) Opt 1 Opts 1−2 Opts 1−3 (MHS2) ●●●●●●●●●● 1e1 1e3 1e5 1e7 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R # HSs (log) ● Baseline Heuristic (Staccato) Opt 1 Opts 1−2 Opts 1−3 (MHS2) ●●●●●●●●●● 1e−2 1e1 1e4 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 R Throughput (log) ● Baseline Heuristic (Staccato) Opt 1 Opts 1−2 Opts 1−3 (MHS2) Figure 2.9: Large problems’ results 2.6 Summary In this chapter we successfully addressed the limitations presented in Section 1.3.1.1 (page 20) thereby positively answering Research Question 1(page 20). Concretely, in this chapter: •We proposed 3optimizations to Staccato (Section 2.1, page 27): –The first optimization prevents multiple examinations of the same set. 45
2MHS2– Optimizations –The second optimization preemptively filters elements of Unot contained in any set in S. –The third optimization prevents the examination of branches such that there is at least one set that cannot be hit by any element in U. •We provided a formal analysis of the proposed algorithm: –We formally proved that the optimized algorithm is both sound and complete (Section 2.2.1, page 30). –We gave some intuition about the complexity of the algorithm’s different operations (Section 2.2.2, page 32). •We analyzed the implementation details of our reference implementation, which is available at https://github.com/npcardoso/MHS2 (Section 2.3, page 32). •We discussed some practical aspects of our MHS generation algorithm: –We discussed how the heuristic influences the algorithm’s performance (Section 2.4.1, page 37). –We discussed how to improve the algorithm’s performance in the presence of ambiguity groups (Section 2.4.2, page 38). –We discussed how to improve the algorithm’s performance when solving non-minimal problems (Section 2.4.3, page 40). •We presented the conducted benchmarks showing that our algorithm: 1. Performs 34000×faster than Staccato for small problems (Section 2.5.1, page 42). 2. Performs 186×faster than Staccato for large problems (Section 2.5.2, page 44). 3. Exhibits a similar throughput in both small and large problems. The faster algorithm enables the exploration of a larger number of HS, increasing the likelihood of actually finding the “best” MHS for a particular instance of the problem. In the particular case of SFL, this improvement translates into: •Better diagnostic accuracy when setting a time-based cutoff, due to the fact that calculating more candidates increases the likelihood of finding the correct diagnostic candidate. •Smaller diagnostic latency when setting a solution size cutoff, due to the fact that calculating a fixed number of diagnostic candidates takes less time with MHS2than with Staccato. 46
3MHS2– Parallelization ++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]>>>>---.- ----.+++++++++++.<<++.<.>-----.<.>>>---.>+.+++++++++++++++++.<++++++++ +++++++++.>------..<++++.>.---.+++++++++++++++++.<----.>------.<++++++ ++.>-----.-.[>]<[[-]<]+->->->-<>-->>>+>>-+<>->+++->>-+->>><><<<>+<<<>< In this section we present the parallelized version of MHS2. As explained in Section 1.3.1.2 (page 20), our goal in this chapter is to enable the computation of MHSs in parallel or even distributed environments. This chapter is divided as follows. First, we introduce our MHS generation algorithm. Second, we evaluate the performance of our algorithm. 3.1 Approach The parallel algorithm can be seen as a Map-Reduce algorithm [Dean and Ghemawat, 2004] (Figure 3.1). The map task (Algorithm 3.1) is a modified version of Algorithm 2.1 (page 28). MHS2 · · · Map Reduce (U, S)D Thread 2 Thread 1 Thread np −1 Thread np (U, S) (U, S) (U, S) (U, S) D0 1 D0 2 D0 np−1 D0 np Figure 3.1: MHS2Map-Reduce workflow 47
3MHS2– Parallelization Algorithm 3.1 MHS2– Map task Inputs: (U, S, d =∅, D =∅) Parameters: (L, Skip, k, np) Output: Minimal hitting set collection D0 k 1if ∃s∈S:s∩U=∅then 2return D 3if S6=∅then 4U←U\ {j|j∈U∧(@s∈S:j∈s)} 5for j∈Rank(U, S)do 6if |d|+ 1 = L∧Skip(k, np)then 7U←U\ {j}#Opt 1 8continue 9S0← {s|s∈S∧j∈s} 10 U←U\ {j} 11 D←MHS2(U\ {j}, S \S0, d ∪ {j}, D) 12 else 13 if @d0∈D:d0⊆dthen 14 D←D\ {d0|d0∈D∧d⊆d0} 15 D←D∪ {d} 16 return D In contrast to the sequential algorithm, we added a parameter Lthat sets the fork-level, i.e., the number of calls in the stack (or equivalently, |d|+ 1), at which the computation is divided among the processes/threads. When a process of the distributed algorithm reaches the target level L, it uses a load division function (Skip) to decide which elements of the ranking to skip or to analyze. The value of Limplicitly controls the granularity of decision of the load division function at the cost of performing more redundant calculations (Figure 3.2). Implicitly, by setting a value L > 1, all processes redundantly compute all HS such that |d|< L. In parallel processing environments, it is desirable to minimize the amount of time processes are idle. Idleness periods may arise when a process completes its work before other threads on which subsequent processing stages depend on. Concretely, for Map-Reduce algorithms, it is desirable that all map complete their jobs simultaneously, thus minimizing idle periods and improving resources usage. Taking this fact into account, a correct selection of the load distribution function (i.e.,Skip) is critical for obtaining good performance. With regard to the load division, we propose two different approaches. The first, referred to as Stride, consists in assigning elements of the ranking to processes cyclically (Figure 3.3a). Formally, a process pk∈{1..np}is assigned to a branch blof the search tree 48
3.1 Approach L= 1 L= 2 {} {1} {1,2} ... {1,3} ... {1,4} {2} {2,3} ... {2,4} {3} {3,4} {4} Evaluations Decisions Redundant Non-redundant 1 1 15 4 2 5 11 6 . . . . . . . . . . . . LPL−1 i=0 |U| i2|U|−PL−1 i=0 |U| i |U| L Figure 3.2: Lparameter intuition if: lmod np =k−1(3.1) The second approach, referred to as Random, uses a pseudo-random generator to divide the computation (Figure 3.3b). This random generator is fed into a uniform distribution generator that assures that, over time, all pkget assigned a similar number of elements although in random order. This method is aimed at obtaining a more even distribution of the problem across processes than Stride (Figure 3.4). Formally, a process pk∈{1..np}is assigned to an element of the ranking if: rand() mod np =k−1(3.2) A particularity of this approach is that the seed of the pseudo random generator must be shared across every process to assure that no further communication is needed. p1 p2 b0b1b2b3b4b5b6b7b8b9 (a) Stride function p1 p2 b0b1b2b3b4b5b6b7b8b9 (b) Random function Figure 3.3: Skip functions intuition 49
3MHS2– Parallelization 56
4Fuzzinel -[------->+<]>---.[++>-------<]>.+++++..--[->+++<]>+.+++++.---------.+ ++++++.-><--<><><---+++>--<+>><+>><-<>+><-+-++>-+---><<++-+<><<+<>+-+> In this chapter we focus on addressing the SFL limitations explained in Section 1.3.2.1 (page 21). Concretely, we propose a generalization to the SFL diagnostic framework, dubbed Fuzzinel1, capable of diagnosing fuzzy errors with better accuracy. This chapter is divided as follows. First, we introduce our enhanced SFL approach. Second, we evaluate the performance of our approach. 4.1 Approach The problem of handling fuzzy errors can be divided in two sub-problems: detection and diagnostic problems. In this section we discuss how to solve both problems in the context of SFL. 4.1.1 Fuzzy Error Detection Existent approaches to error detection (e.g., [Casanova et al.,2013]) make use of first-order logic descriptions of the correct behavior of the system (weak-fault models) to assign transactions to one of two possible sets: the pass set and the fail set (P and Frespectively, where F=P). A consequence of such fault models is the crisp distinction between correct and incorrect system states. While this classical logic description enables an accurate representation of functional errors, it is unable to accurately represent a large variety of non-functional errors. 1Fuzzinel is a combination of 50% “Fuzzy” and 50% “Barinel”, which is the name of the original SFL algorithm. 57
4Fuzzinel As an example, consider a type of non-functional error that, informally, is described by the statement “The system is slow”. Even though we can easily relate the slowness of the system to an appropriate metric (e.g., response time), it is not easy to define a crisp boundary in this same metric to distinguish acceptable and slow transactions. By setting a crisp boundary at, for instance, 1second, a response time of 0.9999 seconds would be considered to be correct whereas a marginally superior response time would be considered incorrect. Also, a response time of 0.9999 seconds would result in the same type of error information (pass) as a smaller response time even though the larger response time may represent an error symptom. To overcome the expressiveness limitation of the classical logic error detection mechanisms, we propose their generalization using fuzzy logic [Zadeh,1965]. Fuzzy logic extends the notion of binary set membership by introducing the concept of membership functions, denoted µA(membership function for set A), mapping a set of problem-specific variables onto the continuous interval [0,1], where the endpoints of 0 and 1conform to no membership and full membership, respectively. In the context of error detection, the concept of fuzzy membership enables the representation of 3types of system states: correct (µe F(x)=0), incorrect (µe F(x)=1) and degraded (0<µe F(x)<1). Intuitively, since F=P, in the new fuzzy error model a degraded transaction exhibits both correct and incorrect behaviors simultaneously, however with different degrees. 0rt10.5rt21rt3 0 0.5 1 0.8 rt µFµe F Figure 4.1: Crisp vs. fuzzy sets As an example, consider the crisp fail set containing all response times (rt) above 1 second. This same set could be represented in terms of a membership function as (Figure 4.1): µF(rt) = (0, rt ≤1 1, rt > 1(4.1) To achieve the goal of representing the degraded state, consider that all response times below 0.5seconds are considered correct and all times above 1second incorrect. Furthermore, consider that the amount of degradation follows a linear pattern between those two thresholds. The fuzzy fail set membership function representing this particular 58
4.1 Approach type of error could be defined as: µe F(rt) = 0, rt < 0.5 2·rt −1,0.5≤rt ≤1 1, rt > 1 (4.2) 0 0.511.5 0 0.5 1 rt Figure 4.2: Arbitrary membership functions It is important to note that the assumption of linear degradation introduced in Equation (4.2) was only made for simplicity. In real-world scenarios, the membership functions are application dependent and can exhibit arbitrary patterns. From our approach’s point-of-view, the membership functions are treated as black-boxes. Figure 4.2 shows a set of alternative membership functions for the error previously described. Despite their odd shapes they are acceptable membership functions, provided that they correctly describe the error state of the transaction. 0 0.511.5 0 0.5 1 rt µe F µe F 2µe F 8µe F 32 µe F 1/2µe F 1/8µe F 1/32 Figure 4.3: Error detection sensitivity intuition Furthermore, it is possible to change the error detection sensitivity by raising µe Fto an exponent, as depicted in Figure 4.3. We can see that by raising µe Fto an exponent in the interval ]1,+∞[, the error detection becomes less sensitive to errors in the fuzzy zone (i.e., the error value in the fuzzy zone becomes smaller than the original). In contrast, by 59
4Fuzzinel raising µe Fto an exponent in the interval ]0,1[, the error detection becomes more sensitive to errors in the fuzzy zone. In fact, when the exponent tends to either +∞or 0, the fuzzy membership becomes a binary membership and errors in the fuzzy zone become passes and fails, respectively. i rt A e c1c2µF(rti)µe F(rti) 1 0.3.•0 0 2 0.9•.0 0.8 3 1.5• • 1 1 Figure 4.4: Fuzzy error hit spectrum example To conclude the illustration of the fuzzy error detection process, consider the spectrum presented in Figure 4.4, which also contains the run-times for each transaction (marked in Figure 4.1). From this spectrum we can see that, in particular for t2, the crisp error vector neglected an error symptom whereas the fuzzy error vector categorized that same transaction as being 80% degraded. Finally, it is worth mentioning that, even though our simplistic example only used one variable to determine the error value of the transactions, the error value can be a function of an arbitrary number of variables. Furthermore, a system may have several membership function for different types of transactions. 4.1.2 Fuzzy Error Diagnosis Using fuzzy logic to detect errors, it is possible to assert that a particular transaction is 80% degraded (i.e.,µe F= 0.8and consequently µe P= 0.2). The remaining challenge consists in integrating this additional knowledge in the diagnostic process. As an example consider again the spectrum depicted in Figure 4.4. Using the approach explained in Section 1.2.2 (i.e., using e=µF), it follows that the candidates2d1={c1} and d2={c2}are ranked equally. However, intuitively, we would expect d1to be ranked ahead of d2since transaction t2, in which component c1was involved, shows error symptoms whereas t1does not. To solve this limitation we make use of the concept of probability of a fuzzy event [Zadeh, 1968]. The probability of a fuzzy event is defined as: Pr(α) = X x∈Ω µx(α)·Pr(x)(4.3) where αis an arbitrary event, and Ωis a set representing all the possible outcomes of α. 2The candidates for the fuzzy approach are calculated by setting a threshold for µe Fto discretize transactions in terms of pass/fail. In this example we use the threshold µe F= 1. 60
4.1 Approach Mapping this definition to the problem at hand, we generalize Equation (1.14) as: Pr(Ai, ei|d) = ei·1−G(d, Ai) | {z } x=F + (1 −ei)·G(d, Ai) | {z } x=P (4.4) where the first part of the equation (x=F) accounts for the incorrect behavior whereas the second part (x=P) accounts for the correct behavior. In contrast to Equation (1.14), this generalization is valid for fuzzy error values (i.e.,e∈]0,1[). Figure 4.5 shows the plot of the Equation (4.4) with respect to eiand G(d, Ai). For comparison, we also plot Equation (1.14) with thick black lines. 0 0.25 0.5 0.75 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 G(d, Ai) ei (a) 2D view 00.51 0 0.5 1 0 0.5 1 G(d, Ai) ei Pr(Ai, ei|d) (b) 3D view Figure 4.5: Likelihood function plot Using the above generalization, the probabilities of the two candidates are calculated as follows: Pr(A, e |d1) = (0.8·(1 −g1) + (1 −0.8) ·g1) | {z } t2 ×(1 ·(1 −g1) + (1 −1) ·g1) | {z } t3 = (0.8·(1 −g1)+0.2·g1) | {z } t2 ×(1 −g1) | {z } t3 (4.5) 61
4Fuzzinel Pr(A, e |d2) = (0 ·(1 −g2) + (1 −0) ·g2) | {z } t1 ×(1 ·(1 −g2) + (1 −1) ·g2) | {z } t3 =g2 |{z} t1 ×(1 −g2) | {z } t3 (4.6) 0 0.25 0.5 0.75 1 0 0.2 0.4 0.6 0.8 g1 (a) Pr(A, e |d1) 0 0.25 0.5 0.75 1 0 0.1 0.2 0.25 g2 (b) Pr(A, e |d2) Figure 4.6: Likelihood plots By performing an MLE for both functions (Figure 4.6) it follows that Pr(A, e |d1)is maximized for g1= 0 and Pr(A, e |d2)for g2= 0.5. Applying the maximizing values to both expressions, it follows that Pr(d1|A, e)≈8×10−4and Pr(d2|A, e)≈2.5×10−4. Such probabilities entail the ranking hd1, d2i, which breaks the ambiguity between d1and d2, thus improving the diagnostic accuracy. 4.2 Benchmark In this section we describe our benchmark approach and discuss results. 4.2.1 Setup To evaluate our approach we make use of a simulator as proposed in [Chen et al., 2013]3. The simulator provides functions to describe and execute a probabilistic model of an arbitrary system, thereby gathering the required spectra. The authors showed that, in the scope of SFL, the benchmark results for both real and synthetic data are comparable. This is mainly due to the fact that, since system is highly abstracted, the spectra generated by real and simulated systems is similar. 3https://github.com/SERG-Delft/sfl-simulator 62
4.2 Benchmark c0 c1: 0.2, c2: 0.8 c3: 0.5,∅: 0.5 c2 c1: 0.1, c3: 0.9 c1 h0.5,0.2,0.3,0.4i c3 c4: 1 c4 h0,0.1,0.9,1i Start 80% 20% 10% 90% 100% 50% Figure 4.7: Probabilistic topology model Our simulator consists of a stack automaton which takes as input a probabilistic model of the system (such as, for instance, the one depicted in Figure 4.7) and, through a Monte Carlo process, generates spectra. The probabilistic model describes the system’s topology, the interaction between components, and the system’s faults. To build the topology portion of the model, two primitives exist: components and links (depicted in blue and orange colors, respectively). Concretely, a component (identified by its numeric ID) contains a list of links. A link consists of a list of component IDs with associated transition probabilities (∅corresponds to no transition). Whenever a component is activated, its links are sequentially evaluated. The evaluation of a link consists of pushing the component’s next link onto the stack (if it exists) and randomly selecting a component (based on the transition probabilities defined in the activated link) to continue the execution. When all the links belonging to a component have been evaluated, a link is popped from the call stack, returning the control to the caller component. As soon as all the links belonging to a component have been evaluated and the stack is empty, the execution halts. Considering the description of the simulator, a transaction can be generated by pushing the first link of a component marked as an entry point onto the stack (c0in Figure 4.7) and running the simulator from that state until its execution comes to a stop. The spectrum is generated by repeating this process an arbitrary number of times while recording which components have been activated in each transaction. To emulate the error behavior, components may be injected with faults (depicted in red), which are parameterized over 4variables (pc,pd,pi, and pf). pc,pd, and picorrespond to the probabilities of correct, degraded, and incorrect behavior. During the simulation, whenever a faulty component is activated, the outcome of such activation (in terms of correct, degraded, or incorrect) is randomly determined using such probabilities. In the event of a component performing erroneously, it has an associated probability pfof failure which, whenever it occurs, it results in an premature end of the transaction (in Figure 4.7, an error in component c4always results in a failure whereas an error in component c1 only has a 40% chance of resulting in a failure). To determine the transaction’s fuzzy 63
4Fuzzinel error value, we apply the following rules: e= 1,if at least one component performed erroneously 0,if all components performed correctly rand(0,1),otherwise4 (4.7) To generate the spectra required for our benchmark we undergo a two-step process. In the first stage we randomly generate a set of system models, while in the second, we use such models to generate the required spectra. ... Faults T∈[3,10] Ci∈[3,10] Figure 4.8: N-tier service architecture We generated system models that comply with a N-tier service architecture (Figure 4.8). Systems were created by randomly selecting the number of tiers (T∈[3,10]) as well as the number of components in each tier (Ci∈[3,10],1≤i≤T). Every component is connected to all the components of the next tier with random transition probabilities. To exhibit erroneous behavior, a number of faults (F) was randomly injected (in terms of position) in the systems. In our setup, we generated 100 systems for each value F∈[2,4], totaling 300 systems. The injected faults had 90% and 10% probabilities of degraded, and erroneous behavior, respectively. 64
4.2 Benchmark The spectra generation is parameterized over a single variable E, representing the number of errors at the end of which the simulation stops. For each generated system, we ran 10 simulations for each value E∈[1,9], totaling 90 spectra per system. Overall, our benchmark is composed of 300 ×90 = 27000 test cases. 4.2.2 Evaluation Metric The wasted effort metric evaluates, for a particular diagnostic report, how many healthy components need to be inspected before all faulty components are found [Steimann et al., 2013]. To calculate this metric one must undergo an iterative process. Starting with the first candidate, all the candidate’s components are inspected to determine whether that particular component was responsible for the erroneous behavior. Depending on the result of such inspection two outcomes may occur. On the one hand, if the component is found to be faulty, that particular component is removed from all other candidates in the ranking. On the other hand, if the component is found to be healthy, all candidates in the ranking containing that particular component are removed. This process is repeated until all faulty components are found. In the case of the last inspected candidate being tied with other candidates, it is assumed that, on average, half of the healthy components are examined. During this iterative process, we keep track of two counters: inspected components (I) and faulty components (C). Using these two counters, the wasted effort metric is calculated as W=I−C(4.8) dRank I C 1{c1, c4}1 2 1 2{c2, c3, c4}2 3{c3, c4, c5}3 4{c1, c2}44 2 5{c3, c5}4 Figure 4.9: Example diagnostic report As an example consider the diagnostic report presented in Figure 4.9 for which the correct diagnostic candidate is d={c1, c2}. In order to calculate the wasted effort, we start by examining c1and c4finding that c1is faulty while c4is healthy. Due to c4being healthy, candidates d2and d3are discarded. Examining d4we observe that the only unexplored component (c2) is faulty. Additionally, we see that both system’s faults were discovered. However, as d5is tied with d4, we must inspect half of the healthy components. The wasted effort of this diagnosis is therefore W= 4 −2 = 2, meaning that 2healthy components (c4and c3/c5) were examined in the process of finding the root cause of the system’s errors. A normalized version of the wasted effort is called diagnostic quality and is defined as: Q= 1 −W M−C(4.9) 65
5NFGE Our approach to model ˘gj(st)consists of a probabilistic model that is derived from the feedback spectrum. Concretely, we estimate the pass and fail probability density functions1, from which we trivially calculate ˘gj(st). The estimation of the pass/fail probability densities consist of a Kernel Density Estimate (KDE),ˆ fej (st), defined as: ˆ fej (st) = 1 bw X st0∈Fbej Kst −st0 bw (5.2) where bw >0is the bandwidth, a smoothing parameter, and K(·)is a kernel function2 [Rosenblatt,1956,Parzen,1962]. A key aspect of KDE is the selection of the bandwidth parameter bw. In our approach, we estimate bw by using the Silverman’s “rule of thumb” [Silverman,1986], defined as: bw = 0.9×minσ, R 1.34× |Fbej|(−0.2) (5.3) where Ris the inter-quartile range of Fbej. Regarding K(·), even though several options exist, in our approach, we use the Gaussian kernel. Additionally, and without loss of generality, we assume the KDEsare a function of a single variable. As an example, consider the modeling process of ˘gj(st)for a component cjgiven 5 pass and 3failed feedback observations with values Fb0j={5,7,15,20,40}and Fb1j= {40,44,60}, respectively. 0 5 10 15 20 25 30 35 40 45 50 55 60 0 0.05 0.1 0.15 0.2 7 st Density ˆ f0j (st) Kernels Figure 5.1: Density estimation and underlying kernels 1The variables are arbitrary and must be selected on component-to-component basis. Currently, the set of variables must be manually selected. 2A kernel is a symmetric but not necessarily positive function that integrates to one. 72
5.1 Approach The first step in modeling ˘gj(st)is the estimation of the probability density function (Equation (5.2)) for the nominal executions with parameters Fb0j={5,7,15,20,40} and bw = 6.328 (Figure 5.1). Note that for each value in the horizontal axis, the KDE value corresponds to the summation of all underlying kernels at the same point. From Equation (5.2) we can see that st0∈Fbej determines each kernel’s offset and bw the dispersion of the density. In particular, when using the Gaussian kernel, st0corresponds to its mean and bw to its standard deviation. 0 5 10 15 20 25 30 35 40 45 50 55 60 0 0.05 0.1 0.15 0.2 0.25 st Density bw = 6.328 bw = 3.164 bw = 12.656 Figure 5.2: Impact of bw value Figure 5.2 provides a visual intuition on the effect of the parameter bw in the estimate. A sensible selection of bw is crucial in order to yield good results as using a small bw value will reflect sampling artifacts whereas a large bw value will smooth some behavioral trends. 0 5 10 15 20 25 30 35 40 45 50 55 60 0 0.05 0.1 0.15 st Density 0 0.2 0.4 0.6 0.8 1 Probability ˆ f0j (st) ˆ f1j (st) ˘gj(st) Figure 5.3: Goodness vs. pass/fail KDEs The second and final step is the derivation of ˘gj(st)from the pass/fail KDEs. We will assume that the previous step was repeated for the fail executions yielding the densities 73
5NFGE depicted in Figure 5.3.˘gj(st), is defined as: ˘gj(st) = ˆ f0j (st) ˆ f0j (st) + ˆ f1j (st)(5.4) 5.1.2 Ranking using ˘gj(st) To use the ˘gj(st)models in the SFL framework we make use of a data-structure which we shall refer to as state spectrum. Definition 11 (State spectrum).State spectrum is a generalization of the hit spectrum data structure (see Definition 7, page 10) that is able to encode the state of a set of variables for each execution of cj∈COMPS. Formally, we redefine Aas: Aij = ♣,if cjdoes not have a ˘gj(st)model and was involved in transaction i hst1,· · · , stki,if cjhas a ˘gj(st)model and was involved in transaction i ∅,otherwise (5.5) Each element stk, encodes the state of the observed variables for the kth activation of component jin transaction i. From the definition, it follows that if no component has a ˘gj(st)model, only ♣and ∅will appear in the activity matrix. In this scenario, ♣corresponds to a 1and ∅to a 0in the terms of Definition 7. Furthermore, since the state spectrum may encode an arbitrary set of state variables, it generalizes over a range of alternative types of spectra described in the literature (e.g., count spectrum, time spectrum, path spectrum, etc.). To apply ˘gj(st)to the SFL framework we generalize G(d, Ai)as: G(d, Ai) = Y j∈(d∩Ai)(gj,ifAij =♣ ˘ G(j, Aij),otherwise (5.6) ˘ G(j, S) = Y st∈S ˘gj(st)(5.7) In contrast to the former version of G(d, Ai), our generalization does take into account all the states in which cjwas active. In the case of existing components with no ˘gj(st)models, the MLE procedure still needs to be executed. To perform the MLE, all ˘gj(st)must be evaluated such that G(d, Ai)is reduced to the form: G(d, Ai) = P×Y j∈A0 i gj(5.8) 74
5.1 Approach A0 i={j|j∈d∧Aij =♣} (5.9) where Pis the result of the product of all ˘gj(st)for transaction i. The MLE as the effect of maximizing the Pr(d|A, e)function by fitting a set of parameters (in this case gj). In other words, by using the MLE, the constant gjmodels are fitted to the input data (i.e.,(A, e)) and thus the diagnostic is more resilient to novel errors than when using ˘gj(st)models. To address this issue, we further improve G(d, Ai)as: G(d, Ai) = Y j∈(d∩Ai)(gj,ifAij =♣ (1 −αj)·gj+αj·˘ G(j, Aij),otherwise (5.10) where αj∈[0,1] is the estimator confidence factor for component j. In scenarios in which the ˘ G(j, S)is fully trusted, αjshould be set to 1. Alternatively, it is possible to fall back to the original SFL algorithm by setting every αjto 0. As an example, consider that a ˘gj(st)model is known to become gradually obsolete over time. In this scenario, it should be possible to fit, for instance, a sigmoid function to the obsolescence pattern, as shown in Figure 5.4. We can see that, as time passes, the impact of ˘ G(j, S)in the diagnosis gradually decreases while the impact of gjincreases. 012345678910 0.5 1 Time ˘ G(j, S)gjαj Figure 5.4: Estimation model confidence vs. time To compare NFGE with the approach presented in Section 1.2.2 (page 17), consider the state spectrum presented in Figure 5.5a, for which the only minimal candidates are d1={1}and d2={2}. Furthermore, consider that the ˘gj(st)model for both c1and c2 was defined as shown in Figure 5.5b. By applying NFGE with α1=α2= 0 (i.e., the ˘gj(st)models are not used in the diagnostic process), it follows that: Pr(A, e |d1) = (1 −g1) | {z } t1 ×g1 |{z} t2 (5.11) Pr(A, e |d2) = (1 −g2) | {z } t1 ×g2 |{z} t3 (5.12) 75
5NFGE iAe c1c2 1h2i h0.5i1 2h0.2i ∅ 0 3∅ h1i0 (a) State spectrum 0 0.5 1 1.5 2 2.5 0 0.5 1 0.2 ˘gj(0.2) = 1 ˘gj(0.5) = 0.98 ˘gj(1) = 0.88 ˘gj(2) = 0.1 st ˘gj(st ) (b) Goodness Function Figure 5.5: NFGE example We can see that, after applying the MLE procedure, d1and d2are ranked equally. In contrast by applying NFGE with α1=α2= 1 (i.e., the MLE procedure is not used in the diagnostic process), it follows that: Pr(A, e |d1) = 1−˘g1(2) | {z } t1 עg1(0.2) | {z } t2 = (1 −0.1) | {z } t1 ×1 |{z} t2 = 0.9 |{z} t1 ×1 |{z} t2 = 0.9 (5.13) Pr(A, e |d2) = 1−˘g2(0.5) | {z } t1 עg2(1) |{z} t3 = (1 −0.98) | {z } t1 ×0.88 |{z} t3 = 0.02 |{z} t1 ×0.88 |{z} t3 = 0.0176 (5.14) We can see that, for this particular example, NFGE succeeds at differentiating d1from d2. 5.2 Benchmark To assess the performance of NFGE we conducted two studies. The first study is aimed at evaluating the prediction error of the modeling approach. At this stage, we use synthetic goodness models in order to be able to test a wider set of goodness patterns. After establishing the prediction error of NFGE, the second study aims at exploring, in a real application, the cases where the classical approach tends to fail. 76
5.2 Benchmark 5.2.1 Prediction Error Study To assess the prediction error of our approach we generated a set of 20000 random synthetic goodness models (M). With the purpose of having different learning and observation generation processes, we modified Equation (5.2) such that each underlying kernel has an individual bwi. Formally, the synthetic goodness models have the underlying pass and fail distributions defined as: ˆ fej (st) = |Fbej | X i=1 K(st−Fbeji bwi) bwi (5.15) Additionally, in our synthetic data setup, two types of models can be distinguished. The first set of models use the Gaussian kernel as their building block. These models are intended to mimic the behavior of components that exhibit smooth transitions between any two points in the feature space (i.e., the domain of the observable variables). This can be the case of component aging in which the goodness normally decreases gradually over time (e.g., Figure 5.5b). The second type of model uses the Box kernel, i.e., a rectangular-shaped kernel centered at Fbeji with bwiwidth and 1 bwiheight. This set of models is intended to emulate components that exhibit abrupt transitions in their goodness functions. Also, as the original kernel differs from the learning kernel, the process of generation and learning becomes substantially different, allowing us to get to more significant conclusions. Finally, the generated models range from simple patterns, such as for instance the one depicted in Figure 5.5b, to more complex patterns with up to 20 supporting kernels for both the pass and fail densities (i.e.,|Fbej| ≤ 20). To generate the feedback spectra, for each model we randomly selected a set of 200 values, F, in its feature space. For each of them we determine whether the component performed nominally in a Bernoulli trial process parameterized parametrized with Ml(Fk). For each Ml∈M, we trained several estimators with different training data sizes. For each trained model, the prediction error is obtained by comparing the predicted goodness and the original goodness at 1000 evenly distributed samples of the feature space and averaging the differences. Figure 5.6 summarizes the results our benchmarks. The first two setups represent the average prediction error for NFGE in both the Gaussian and Box cases, respectively. The last setup represents the average prediction error for a constant estimator defined as: ˘gj(st) = |Fb0j| |Fb0j|+|Fb1j|(5.16) As discussed, the approach presented in Section 1.2.2 (page 17) is not able to incorporate feedback information, rendering a direct comparison with NFGE impossible. Despite, we provide the results for the constant estimator with the goal of establishing a ground of comparison with the hypothetical performance of the traditional SFL approach if it was able to incorporate such information. 77
5NFGE ● ● ●●●●●●●● 0.1 0.2 0.3 0.4 0.5 0.6 4 1118 29 42 60 83 113 152 200 Training size Average Error Setup ● NFGE (gaussian) NFGE (box) Constant Figure 5.6: Prediction errors From the analysis of Figure 5.6, we can see a clear improvement introduced by NFGE over the baseline. As expected, the constant estimation presents a large average error of 44%. Moreover, the constant estimator does not scale with the amount of available feedback data (i.e., the average error does not significantly improve with the increase of the available data). In contrast, NFGE, in its best case scenario, was able to perform at 10% of average error. Globally, NFGE presented an average of 21% and 26% of prediction error for the smooth and non-smooth cases, respectively. The reason for the 5% difference relates to the fact that the Gaussian-based KDE is not able, with a limited set of observations, to tightly fit the original box-based model. Additionally, fairly quick convergence is observed: with 42 observations 90% of the maximum performance is obtained for both the Gaussian model/Gaussian estimator case and the Box model/Gaussian estimator case. Finally, the results showed that when the amount of available data is small (< 11 observations), the constant estimate, on average, outperforms NFGE. 5.2.2 Diagnostic Study In this section we evaluate the diagnostic performance of our approach in scenarios where the classical SFL approach tends to fail. The selected application for this study 78
5.2 Benchmark was a simple HTTP server, webfs3, which was instrumented to generate state spectra. Additionally, we injected code to emulate the behavior of aging faults (e.g., memory leaks, hard drive wear, etc.). The injected faults are parameterized over 3variables: min,max, and total. For each execution of each injected fault a counter is incremented with a random value in the interval [min,max]. Whenever a counter reaches the value of its associated total variable, the fault is triggered and the transaction fails. The counters may either be shared among a set of faults or, unless stated otherwise, independent. To collect the feedback spectra required for generating the goodness models, we did a prior test run where the faults were targeted individually. For each injected fault execution, we recorded the number of previous invocations and process age, i.e., the time since the HTTP server start. For each fault we created two univariate ˘gj(st)models using 20 feedback observations: one as a function of the number of invocations and the other as a function of the process age. Since we only created NFGE models for the components with injected faults, no state was recorded for the remaining components. In a first scenario we only activated one fault. At this stage we tried to isolate the faulty component from a 5element diagnostic report. The results showed that the MLE approach was only able to exonerate 1out of 5candidates. This was due to the fact that all transactions shared the same “bootstrap” sequence and the fault was injected in there. Since the components involved in that sequence exhibited the same activity pattern, i.e., equal columns in the hit spectrum, it remained impossible to distinguish them. In contrast, NFGE was able to clearly isolate the real faulty component. When comparing the candidates’ probabilities for both approaches, NFGE calculated a probability of 99.9999% for the actual diagnostic candidate whereas MLE calculated a probability ≈25% for both the correct and the 3remaining diagnostic candidates. This great difference in the probabilities’ magnitudes is in accordance with the results obtained in the synthetic experiments. In a second scenario, we enabled two faulty components for which we had created NFGE models. In this setup we generated a set of transactions that would eventually trigger one fault but not the other. Additionally, the two components were always activated in succession, generating low entropy hit spectrum (i.e., several components share the same activation pattern). The goal of this test was to confirm that NFGE is both able to both indict and exonerate components depending on the execution context. In this scenario, the MLE ranked equally the real error source and the component that should be exonerated. In contrast, NFGE was again able to both indict and exonerate components correctly. Even though the previous setups produced positive results, it is important to note that the correct selection of the modeling variables is critical to obtain a good diagnostic accuracy. As previously stated we observed two distinct variables: the number of component executions and the process age. Even though both variables are able to model the goodness pattern of the injected faults, the degree to which each variable is able to cope with new scenarios may vary. 3http://linux.bytesex.org/misc/webfs.html 79
5NFGE From this test setup it is easy to understand that even though correlated, the process age is not the cause of the fault activation: if a component is “old” but was never activated, the corresponding counter was never incremented. The process age variable indirectly encodes some aspects of the application workload. If an age-based model was constructed for a specific activation rate, i.e., activations/time unit, its ability to produce accurate estimates under a different workload may be limited. On the other hand it is clear that the component activation count is more independent from the application’s workload. In the previous setups we used independent counters. If on the other hand we had a global counter and still used independent activation counters, the same variable would also implicitly encode workload patterns. Furthermore, if the modeling workload is substantially different from the diagnostic workload (and ∀αj:αj= 1) it could happen that the components that caused the errors would be exonerated. 5.3 Summary In this chapter we successfully addressed the limitations presented in Section 1.3.2.2 (page 23) thereby answering Research Questions 5and 6(page 23). Concretely, in this chapter: •We addressed Research Question 5by proposing a KDE-based approach that uses feedback observations to model the components’ goodnesses as a non-linear function of the system’s state (Section 5.1.1, page 71). •We addressed Research Question 6by generalizing both the hit spectrum abstraction and the state-of-the-art SFL approach to use information about the system’s state in the diagnostic process (Section 5.1.2, page 74). •We presented the conducted benchmarks showing that: –The NFGE modeling approach, in its best case scenario, was able to perform at 10% of average error (Section 5.2.1, page 77). –With 42 data points, the NFGE approach achieved 90% of its maximum observed performance (Section 5.2.1, page 77). –The system’s state was successfully used to improve the diagnostic accuracy (Section 5.2.2, page 78). 80
6 Related Work -[--->+<]>---.+[----->+++<]>.+++++++.-----------.--[--->+<]>-.+++[->++ +<]>.-.-[--->+<]>-.---[->+++<]>.-[--->+<]>---.+++.-------.-+>+<+><+-+- 6.1 Traditional Debugging Data Dumping A common low-tech diagnostic approach is the use of commands that dump user defined variables to output devices, colloquially referred to as printf commands. On the one hand, such commands are a very powerful tool to both detect and locate errors. First, the usage of such commands is normally pretty straightforward implying a small learning overhead. Also, as the semantics are equal to the ones of the target source code, its usage is intuitive. Second, as such commands are embedded in the source code, there is no need for additional tools. Third, as no assumptions are made, it is usable in almost all imaginable scenarios, being the de facto diagnosis fallback tool. On the other hand, mostly due to the fact that the usage of dumping commands is very ad hoc, this technique can become ineffective. First, all dumping commands must be explicitly stated, cluttering the source code. Second, as all commands must be prepared prior to the application’s execution, a missing print command implies a possible recompilation and re-execution of the application. Third, with the increase of debugging print commands the amount of debugging output can become quickly overwhelming. Forth, in order to efficiently use print commands it is required to have some intuition about the location of the fault. Debuggers In contrast to print commands, debuggers enabled developers to inspect the internal state of an application without any source code modifications. 81
6 Related Work 6.4 Automated Diagnosis Delta Debugging Delta Debugging is a technique that tries to systematically simplify the input that leads a certain system to a failure [Zeller and Hildebrandt,2002]. This is accomplished by iteratively reducing the size of the input until the smallest input that causes the execution to fail is reached [Zeller,2002,Cleve and Zeller,2005]. This is done under the assumption that that simpler inputs activates less components than more complex inputs and, therefore, renders the system easier to debug. Input 12345678Error 1•••••••• 1 2••••. . . . ? 3. . . . •••• 1 4. . . . • • . . 0 5......• • 1 6......•.1 7.......•0 Figure 6.2: Delta debugging example (adapted from [Zeller and Hildebrandt,2002] and [Perez et al.,2014]) Consider the example in Figure 6.2, in which a system takes as input a set of integers in the interval [1,8]. Initially, the system is executed with an input consisting of all possible elements in the input space (input 1in the figure). As this input makes the system fail, the next step is to split the input, as is the case in inputs 2and 3. It is important to note that, when manipulating the system’s input, one can reach one of three possible outcomes: passed (0), failed (1), and unresolved (?). The latter occurs when the system receives an invalid input. The next steps of the delta debugging algorithm are to keep attempting to reduce the size of the failure inducing inputs. In this example, input 3is divided into inputs 4and 5, and, in turn, input 5is divided into inputs 6and 7. As can be seen in the figure, input 6is a minimal failure inducing input. Since a vast amount of combinations may result in passed/unresolved outcomes, in [Misherghi and Su,2006], the authors propose an improved algorithm, called Hierarchical Delta Debugging. This technique takes into account the input structure to reduce the number of inputs to examine. By initially using a coarser level of detail, the algorithm is able to prune large irrelevant portions of the input early in the minimization process. Besides speeding up the delta debugging process, the hierarchical technique also has the advantage of producing better (and more easily understandable) diagnostic reports, as the output is a structured tree [Perez et al.,2014]. 88
6.4 Automated Diagnosis Static/Dynamic Slicing Static Slicing [Weiser,1982,1984] is a debugging approach that starts from the failure and uses the control and data flow of the system as a backwards reasoning method to narrow down the set of potential faulty components. This is accomplished by ignoring all components that have no data or control dependencies to the variables used in the error detection process. In this context, a slice is a subset of the system’s components that directly or indirectly influences the values of a given set of state variables. A problem of static slicing is that the slices computed by means of static analysis tend to be large. In [Lyle and Weiser,1987], the authors were able to reduce the slices’ size by constructing dices. A dice is the set difference between two static slices of a system. To further decrease the slices’ size, in [Kolettis and Fulton,1995], the authors propose an approach, called Dynamic Slicing, that relies on execution information to determine which components belong to the slice (or dice). Dynamic slices occasionally omit components responsible for the system’s failures. To mitigate this problem, in [Zhang and Gupta,2004,Zhang et al.,2005,2007], the authors introduced the concepts of dynamic dependence graph, implicit dependencies and relevant slicing, in [Agrawal et al.,1995], the authors propose the usage of execution slices and, in [Wong and Qi,2006], the usage of inter-block data dependencies. In [Wotawa,2010], the authors improve dynamic slicing by combining it with MBD techniques. In [Hofer and Wotawa,2012], the authors show that the aforementioned can be further improved by combining it with SFL. In [Xie et al.,2010,2013], the authors introduce the concept of metamorphic slice with the goal of enabling the usage of SFL without the need for test oracles. Similarity-based SFL An alternative approach to SFL is to use similarity coefficients as a way of determining which columns of matrix Aresemble the most with the error vector ethe most or, in other words, which components have the activity pattern most similar to the error pattern. The underlying assumption of this approach is that a component with an activation pattern resembling the error pattern is likely to be at fault. Similarity coefficient-based approaches are known for being extremely lightweight at the cost of only being capable of proposing single component candidates. Given that the candidate generation problem is implicitly solved by making such assumption, all M components (i.e., all the single fault candidates) are ranked according to their similarity scores. Several similarity coefficients do exist [Abreu et al.,2009a]. Well known examples include the Jaccard coefficient sJused in the Pinpoint tool [Chen et al.,2002], the sAcoefficient used by the AMPLE tool [Dallmeier et al.,2005] and the sTcoefficient used in the Tarantula tool [Jones and Harrold,2005]: 89
6 Related Work sJ(j) = n11(j) n11(j) + n01(j) + n10(j)(6.1) sA(j) = n11(j) n01(j) + n11(j)−n10(j) n00(j) + n10(j)(6.2) sT(j) = n11(j) n11(j)+n01(j) n11(j) n11(j)+n01(j)+n10(j) n10(j)+n00(j) (6.3) where: •n11(j)is the number of failed runs in which component jis involved. •n10(j)is the number of passed runs in which component jis involved. •n01(j)is the number of failed runs in which component jis not involved. •n00(j)is the number of passed runs in which component jis not involved. Formally, npq is defined as: npq(j) = |{i|Aij =p∧ei=q}| (6.4) One of the best performing similarity coefficients for fault localization is the Ochiai coefficient [Abreu et al.,2007]. The Zoltar [Janssen et al.,2009] and GZoltar [Campos et al.,2012] fault localization tools use the Ochiai coefficient to quantify the resemblance between components’ activity and the error vector. This coefficient was initially used in the molecular biology domain [e Silva MeyerDada al.,2004], and is defined as follows: sO(j) = n11(j) qn11(j) + n01(j)·n11(j) + n10(j)(6.5) It is important to note, however, that, even though similarity scores range between 0 and 1, they are not considered to be probabilities [Li and Vitányi,2013]. In fact, the Ochiai coefficient corresponds to the the cosine of the angle between 2vectors in a n-dimensional space. Due to its good performance at an extremely low cost, similarity-based SFL has already been applied in a variety of domains: •In [Hofer et al.,2013], the authors compare the techniques presented in [Wotawa, 2010] (Spectrum-enhanced Dynamic Slicing), [Abreu et al.,2009b] (SFL), and [Abreu et al.,2012] (Constraint-based Debugging) when applied in spreadsheet debugging. Promising results were observed for both spectrum-based approaches. •In [Abreu et al.,2014], the authors use SFL together with spreadsheets smells [Cunha et al.,2012a,b,Hermans et al.,2012a,b] to detect and diagnose problems in spreadsheets. 90
6.4 Automated Diagnosis •In [Machado et al.,2013], the authors use SFL for debugging mobile applications. •In [Passos et al.,2014,2015], the authors apply SFL in the scope of multi-agent systems. •In [Zoeteweij et al.,2007], the authors apply SFL in the scope of embedded systems. •In [Perez and Abreu,2014], the authors use SFL for software comprehension. Candidate Generation In [Reiter,1987], the authors propose a breadth-first search algorithm to solve the MHS problem. Later, in [Wotawa,2001,Greiner et al.,1989], some improvements over the base algorithm have been suggested. In [Zhao and Ouyang,2007] a method using set-enumeration trees to derive all MHSs in the context of model-based diagnosis is presented. While sound and complete, such algorithms do not scale to large problems. To overcome this problem, in [Feldman et al., 2008], the authors propose a stochastic search algorithm, that starts with a HS dfor (U, S) and iteratively removes elements from dwhile guaranteeing that the resulting set still is a HS. By using a stochastic search, the algorithm trades-off soundness/completeness for computational efficiency. In contrast to our approach, all of the above algorithms make use of a constraint solver to check whether or not a set dis a HS. On the one hand, such approaches do not require an explicit availability of set S, making them useful for scenarios where the problem is not explicitly stated but rather indirectly observed. On the other hand, as a great part of the “heavy-lifting” is performed by third-party libraries, their performance is largely limited by the performance of the underlying constraint solver. Furthermore, and contrary to our work, the mentioned algorithms do not use any other information aside from the problem statement (U, S)(recall that our heuristic is arbitrary and can use information outside of the problem statement). In [Fijany and Vatan,2004,2005], the MHS problem is mapped onto an 1/0-integer programming problem. Contrary to our work, this approach does not use any other information aside from the problem statement (U, S). In [Vinterbo and Øhrn,2000,Li and Yunfei,2002,Aickelin and Dowsland,2004,Huang et al.,1994], several genetic algorithms to compute MHSsare proposed. While scalable to large problems, these algorithms do not guarantee soundness nor completeness. Visualizations Several authors acknowledged the fact that humans have difficulties in interpreting a diagnostic report as presented in Definition 6(page 9) [Jones,2004]. To improve the user-friendliness and thereby the utility of automated diagnostic tools, several visual approaches were proposed: 91
6 Related Work •In [Jones et al.,2002,Jones and Harrold,2005], the authors present a technique that uses color to visually map the participation of each component in the outcome of the execution of the program with a test suite. •In [Orso et al.,2004], the authors propose a generalization of approach presented in [Jones et al.,2002] that enables a color-based representation of bi-dimensional component data by both using the hue and the brightness values. •In [Bouillon et al.,2007], the authors present a color coded call-graph in which the same color code is used. •In [Janssen et al.,2009], the authors present a tool that colors each line in the application’s source code according to its SFL score. •In [Campos et al.,2012], the authors improve the tool by adding two visualizations: Treemap and Sunburst [Riboira et al.,2011]. •In [Gouveia et al.,2013], the authors re-implement the same visualizations using HTML5 to improve the tool’s portability. 92
7 Conclusions ++++[++++>---<]>.+[--->+<]>+++.-.-----------.+++++++++.+++++++++.--.-- --------.++++++.-.+++++.>><>+<-<<---><<-><>>>>-<<>+-<+><-><>-<+-<<>+-+ In this section we draw conclusions about the work developed in the scope of this thesis. This chapter is divided as follows. First, we answer the research questions introduced in Section 1.3. Second, we list the contributions that resulted from the developed work. Finally, we discuss possible paths of future research. 7.1 Research Questions Research Question 1—Is it possible to optimize Staccato to minimize redundant/superfluous computations? We found that the Staccato algorithm could be improved to achieve a higher computational efficiency. To this end we proposed 3optimizations. The first optimization prevents multiple examinations of the same set. The second optimization preemptively filters elements guaranteed not to form MHSs. The third optimization prevents the examination of search tree branches guaranteed not to yield any MHSs. The conducted benchmarks showed that the proposed optimizations resulted, on average, in a 34000×performance improvement for small problems and in a 186× improvement for large problems. Research Question 2—Is it possible to parallelize Staccato as way of reducing the diagnostic latency? The Staccato algorithm can be successfully parallelized. To achieve this goal, we proposed a Map-Reduce parallelization of Staccato. The parallel algorithm makes use of a pseudo-random generator to evenly distribute the computations among threads without needing any communication apart from the initial seed sharing. 93
7 Conclusions The conducted benchmarks showed that the proposed parallelization approach scales with minimal overheads: the algorithm exhibits a similar throughput per thread in both small/large problems and sequential/parallel setups. Research Question 3—How to encode fuzzy error symptoms? We proposed a fuzzy logic generalization over the classical binary error representation. Instead of classifying transactions in terms of pass/fail, we suggest the usage of set membership functions (µe x). Such functions map an arbitrary input onto the interval [0,1], enabling the representation of 3types of transaction outcomes: correct (µe F= 0), incorrect (µe F= 1) and degraded (0<µe F<1). A consequence of the new error model is that a degraded transaction exhibits both correct and incorrect behaviors simultaneously, however with different degrees. This is due to the fact that the pass and fail sets are complimentary and, therefore, the sum of both set membership functions must be equal to 1(i.e.,µe P(x)=1−µe F(x)). Research Question 4—How to improve SFL to make use of the fuzzy error information? To use the fuzzy error information we improve the SFL framework by making use of the concept of probability of a fuzzy event, which is defined as: Pr(α) = X x∈Ω µe x(α)·Pr(x)(7.1) where Ωis the set of possible outcomes which, in the case of error diagnosis, is equal to {P, F}. Applying the above formula to the SFL framework results in the following generalization: Pr(d|A, e) = Pr(d)×Y i∈1..N µe F(α) z}|{ ei· Pr(x=F|A,d) z }| { 1−G(d, Ai)+ µe P(α) z }| { (1 −ei)· Pr(x=P|A,d) z }| { G(d, Ai) Pr(A, e)(7.2) The classical SFL approach (see Equation (1.14), page 18) is a special case of the proposed generalization when ∀ei:ei∈ {0,1}. The conducted benchmarks showed that, for our setup, the fuzzy approach improved the diagnostic quality in 65% of the test cases and performed at least as good as the classical approach in 94% of the test cases. Furthermore, the fuzzy diagnostic was, on average, 20% more accurate than classical approach. Research Question 5—How to enable SFL to adapt to different systems based on previous diagnostic experience? 94
7.1 Research Questions To enable SFL to make use of previous diagnostic experience, we proposed an improved goodness modeling approach. To this end, we introduced the concept of a feedback loop in SFL, consisting of a pass (Fb0j) and a fail (Fb1j) observation lists for each component j. Each list is defined as: Fbej =hst1, ..., stk, ..., stKi(7.3) where st represents a set of system variables’ values in which component jwas observed to perform either nominally or erroneously. Each list is then used to create a KDE as follows: ˆ fej (st) = 1 bw X st0∈Fbej Kst −st0 bw (7.4) Intuitively, the KDE works like a continuous histogram, estimating how the pass/fail states are spread across the entire state space. The final modeling step consist of using both the pass and fail KDEsto estimate the component’s goodness. Formally, the improved goodness model is defined as: ˘gj(st) = ˆ f0j (st) ˆ f0j (st) + ˆ f1j (st)(7.5) Research Question 6—How to incorporate information about the system’s state in SFL? To make use of the system state in the diagnostic process, we generalized the spectrum’s activity matrix as: Aij = ♣,if cjdoes not have a ˘gj(st)model and was involved in transaction i hst1,· · · , stki,if cjhas a ˘gj(st)model and was involved in transaction i ∅,otherwise (7.6) The improved spectrum enables the capture of the system’s state which, in turn, is plugged onto the improved goodness models. To incorporate the improved spectrum and goodness models onto the SFL framework, we define the generalize the transaction goodness function as: G(d, Ai) = Y j∈(d∩Ai)(gj,ifAij =♣ (1 −αj)·gj+αj·˘ G(j, Aij),otherwise (7.7) ˘ G(j, S) = Y st∈S ˘gj(st)(7.8) where αj∈[0,1] is a model confidence parameter. This parameter enables the SFL framework to fallback to the MLE goodness model as the state-aware goodness model gradually becomes obsolete. In fact, the classical SFL approach (see Equation (1.15), page 18) is a special case of the proposed generalization when ∀αj:αj= 0. 95
7 Conclusions 7.2 Contributions Overall, the work developed for this thesis resulted in 3main contributions: 1. We developed a SFL candidate generation algorithm that is both more efficient than the state-of-the-art algorithm (Section 2.1, page 27) and can make use of multiple CPUsto compute diagnostic candidates (Section 3.1, page 47). Furthermore, we released a reference implementation under the GNU Lesser General Public License1, available at https://github.com/npcardoso/MHS2. 2. We proposed a fuzzy logic-based approach to error detection enabling a more accurate representation of performance degradation errors (Section 4.1.1, page 57). Furthermore, we improved the spectrum-based reasoning framework for fault localization to incorporate the improved error representation (Section 4.1.2, page 60). 3. We proposed a KDE-based approach to model the components’ goodnesses as a function of the system state (Section 5.1.1, page 71). Furthermore, we improved the spectrum-based reasoning framework for fault localization to incorporate the improved goodness estimation (Section 5.1.2, page 74). In addition to the main contributions, in the scope of this thesis: •We introduced the state spectrum data structure, which generalizes over a set of existent types of spectra (e.g., hit spectrum, count spectrum, etc.) and enables a more precise abstraction of the system’s executions. •We introduced the concept of a feedback loop in the scope of SFL. 7.3 Future Work In this section we discuss future research topics related to the material presented in this thesis. 7.3.1 Goodness Modeling Feedback Generation Given a set of state spectra and their respective correct diagnostic candidates, it should be possible to automatically extract information to generate the feedback spectra. To illustrate how this could be accomplished in practice, consider the state spectrum in Figure 7.1 for which the correct diagnostic candidate was determined to be d={1,2}. 1https://www.gnu.org/licenses/lgpl.html 96
7.3 Future Work iAe c1c2· · · 1h0.42i ∅ · · · 0 2h0.86,1.86i ∅ · · · 0 3h0.14i h· · ·i · · · 0 4h0.58,1.46i h· · ·i · · · 0 5h1.05i ∅ · · · 1 6h1.35i ∅ · · · 1 7h1.79i ∅ · · · 1 8h0.49,1.34i ∅ · · · 1 9h1.67i h· · ·i · · · 1 10 h0.49,0.81i h· · ·i · · · 1 Figure 7.1: State spectrum Analyzing the spectrum, we can see that the states of the transactions in which c1 was activated can be divided into 3categories: nominal, error, and undetermined. The categorization is a function of 3factors: the number of activations of the target component, the number of activated faulty components, and the outcome of the transaction (Figure 7.2). Component States Faulty Components Transaction Outcome One One Pass Nominal More than one One Pass Nominal One More than one Pass Nominal More than one More than one Pass Nominal One One Fail Error More than one One Fail Undetermined One More than one Fail Undetermined More than one More than one Fail Undetermined Figure 7.2: State categorization The nominal and error states can be directly added to the feedback spectrum whereas, the undetermined states cannot. The simplest approach for handling undetermined states is to simply ignore them. The major drawback of this approach is that the available information is not used to its full extent. A more convoluted approach is to make use of a clustering algorithm such as K-Nearest Neighbors (KNN)[Altman,1992]. In short, KNN classifies a point based on the most frequent class among its Knearest (classified) neighbors. Figure 7.3 illustrates how the undetermined states in Figure 7.1 would be classified by KNN with K= 3. It is worth to note that all undetermined states should be reclassified every time new diagnosed state spectra is available for feedback extraction. Another possible approach is to still use the KNN algorithm but, instead of all states having equal weight in the goodness calculation, they may have different weights. To this 97
7 Conclusions Pr(A, e, c | {1}) = (1 −c1) + c1·Pr(A1, e1| {1}) | {z } t1 ×(1 −c2) + c2·Pr(A2, e2| {1}) | {z } t2 =(1 −1) + 1 ·(1 −g1) | {z } t1 ×(1 −0.5) + 0.5·g1 | {z } t2 = (1 −g1)×(0.5+0.5·g2) (7.19) Pr(A, e, c | {2}) = (1 −c1) + c1·Pr(A1, e1| {2}) | {z } t1 ×(1 −c3) + c3·Pr(A3, e3| {2}) | {z } t3 =(1 −1) + 1 ·(1 −g2) | {z } t1 ×(1 −1) + 1 ·g2 | {z } t3 = (1 −g2)×g2 (7.20) By performing a MLE for both functions it follows that Pr(A, e, c | {1})is maximized for g1= 0 and Pr(A, e | {2})for g2= 0.5(Figure 7.9). Applying the maximizing values to both expressions, it follows that Pr({1} | A, e, c) = 5 ×10−4and Pr({2} | A, e, c)=2.5×10−4, entailing the ranking h{1},{2}i. 0 0.25 0.5 0.75 1 0 0.2 0.4 0.5 g1 (a) Pr(A, e, c | {1}) 0 0.2 0.4 0.6 0.8 1 0 0.1 0.2 0.25 g2 (b) Pr(A, e, c | {2}) Figure 7.9: Likelihood plots 104
7.3 Future Work Since this generalization is conjectural, future work in this scope would include evaluating the improvements (if any) introduced by this generalization. Furthermore, and assuming that this approach yields positive results, research should done towards automating the process of estimating the oracles’ confidence. 105
7 Conclusions 106
References References ++++++++[>++++>++++++>++++++++>++++++++++>++++++++++++<<<<<-]>>>>++.>+ ++++.+.-.+++++++++++++.-------------.+++++++++.-----------.++.++++++++ ++++++.[>]<[[-]<]<>.<.-+<+----<>>>-<<-+<>>>++>>+<>-+++<->+<-<-->->+<<- [Abreu et al., 2014] Abreu, R., Cunha, J., Fernandes, J. P., Martins, P., Perez, A., and Saraiva, J. (2014). Smelling faults in spreadsheets. In Proceedings of the 2014 International Conference on Software Maintenance and Evolution, ICSM’14, pages 111–120. (Cited on page 90) [Abreu and Van Gemund, 2009] Abreu, R. and Van Gemund, A. J. C. (2009). A low-cost approximate minimal hitting set algorithm and its application to model-based diagnosis. In Proceedings of the 8th Symposium on Abstraction, Reformulation, and Approximation, SARA’09. (Cited on pages 13,20,27,38 and 42) [Abreu et al., 2008] Abreu, R., González-Sanchez, A., Zoeteweij, P., and Van Gemund, A. J. C. (2008). On the performance of fault screeners in software development and deployment. In Gonzalez-Perez, C. and Jablonski, S., editors, Proceedings of the 3rd International Conference on Evaluation of Novel Approaches to Software Engineering, ENASE’08, pages 123–130. (Cited on page 83) [Abreu et al., 2012] Abreu, R., Riboira, A., and Wotawa, F. (2012). Constraint-based debugging of spreadsheets. In Proceedings of the 15th Ibero-American Conference on Software Engineering, CIbSE’12, pages 9–16. (Cited on page 90) [Abreu et al., 2007] Abreu, R., Zoeteweij, P., and Van Gemund, A. J. C. (2007). On the accuracy of spectrum-based fault localization. In Proceedings of the 2nd International Academic And Industrial Conference on Testing – Practice And Research Techniques, TAICPART’07, pages 89–98. (Cited on pages 38 and 90) [Abreu et al., 2009a] Abreu, R., Zoeteweij, P., and Van Gemund, A. J. C. (2009a). A new bayesian approach to multiple intermittent fault diagnosis. In Proceedings of the 21st International Joint Conference on Artificial Intelligence, IJCAI’09, pages 653–658. (Cited on pages 9,17,18,21 and 89) [Abreu et al., 2009b] Abreu, R., Zoeteweij, P., Golsteijn, R., and Van Gemund, A. J. C. (2009b). A practical evaluation of spectrum-based fault localization. Journal of 107
References Systems and Software, 82(11):1780–1792. (Cited on pages 4and 90) [Agrawal et al., 1995] Agrawal, H., Horgan, J. R., London, S., and Wong, W. E. (1995). Fault localization using execution slices and dataflow tests. In Proceedings of the 1995 International Symposium on Software Reliability Engineering, ISSRE’95, pages 143–151. (Cited on page 89) [Aickelin and Dowsland, 2004] Aickelin, U. and Dowsland, K. A. (2004). An indirect genetic algorithm for a nurse-scheduling problem. Computers & Operations Research. (Cited on page 91) [Allan, 2001] Allan, R. (2001). A History of the Personal Computer: the People and the Technology. Allan Pub, London, Ont. (Cited on page 1) [Altman, 1992] Altman, N. S. (1992). An introduction to kernel and nearest-neighbor nonparametric regression. The American Statistician, 46(3):175–185. (Cited on page 97) [Arito et al., 2012] Arito, F., Chicano, F., and Alba, E. (2012). On the application of sat solvers to the test suite minimization problem. In Proceedings of the 4th International Conference on Search Based Software Engineering, SSBSE’12, pages 45–59, Berlin, Heidelberg. (Cited on page 84) [Arnold and Ryder, 2001] Arnold, M. and Ryder, B. G. (2001). A framework for reducing the cost of instrumented code. ACM SIGPLAN Notices, 36(5):168–179. (Cited on pages 84 and 85) [Avizienis et al., 2004] Avizienis, A., Laprie, J.-C., Randell, B., and Landwehr, C. E. (2004). Basic concepts and taxonomy of dependable and secure computing. Transactions on Dependable Secure Computing, 1(1):11–33. (Cited on pages 2 and 4) [Bala et al., 2000] Bala, V., Duesterwald, E., and Banerjia, S. (2000). Dynamo: a transparent dynamic optimization system. ACM SIGPLAN Notices, 35:1–12. (Cited on page 84) [Bigus et al., 2002] Bigus, J. P., Schlosnagle, D. A., Pilgrim, J. R., Mills, W. N., and Diao, Y. (2002). Able: a toolkit for building multiagent autonomic systems. IBM Systems Journal, 41(3):350–371. (Cited on page 3) [Bouillon et al., 2007] Bouillon, P., Krinke, J., Meyer, N., and Steimann, F. (2007). EzUnit: A Framework for Associating Failed Unit Tests With Potential Programming Errors. Proceedings of the 8th International Conference on Agile Processes in Software Engineering and eXtreme Programming (XP 2007), Como, Italy 2007. (Cited on page 92) [Bryce and Memon, 2007] Bryce, R. C. and Memon, A. M. (2007). Test suite prioritization by interaction coverage. In Proceedings of the 2007 Workshop on Domain Specific Approaches to Software Test Automation, DOSTA ’07, pages 1–7. (Cited on 108
References page 84) [Bus et al., 2004] Bus, B. D., Chanet, D., Sutter, B. D., Put, L. V., and Bosschere, K. D. (2004). The design and implementation of fit: a flexible instrumentation toolkit. In Proceedings of the 5thWorkshop on Program Analysis for Software Tools and Engineering, PASTE’04, pages 29–34. (Cited on page 85) [Campos and Abreu, 2013] Campos, J. and Abreu, R. (2013). Encoding Test Requirements as Constraints for Test Suite Minimization. In Proceedings of the 10th International Conference on Information Technology: New Generation, ITNG’13, pages 317–322. (Cited on page 84) [Campos et al., 2013] Campos, J., Abreu, R., Fraser, G., and d’Amorim, M. (2013). Entropy-based test generation for improved fault localization. In International Conference on Automated Software Engineering, ASE’13. (Cited on page 84) [Campos et al., 2012] Campos, J., Riboira, A., Perez, A., and Abreu, R. (2012). GZoltar: An Eclipse Plug-in for Testing and Debugging. In Proceedings of the 2012 International Conference on Automated Software Engineering, ASE’12, pages 378–381. (Cited on pages 90 and 92) [Cardoso and Abreu, 2013a] Cardoso, N. and Abreu, R. (2013a). MHS2: A map-reduce heuristic-driven minimal hitting set search algorithm. In Proceedings of the 2013 International Conference on Multicore Software Engineering, Performance, and Tools, MUSEPAT’13, pages 25–36. (Cited on page 24) [Cardoso and Abreu, 2013b] Cardoso, N. and Abreu, R. (2013b). A distributed approach to diagnosis candidate generation. In Proceedings of the 16th Portuguese Conference on Artificial Intelligence, EPIA’13, pages 175–186. (Cited on page 23) [Cardoso and Abreu, 2013c] Cardoso, N. and Abreu, R. (2013c). A kernel density estimate-based approach to component goodness modeling. In Proceedings of the 27th AAAI Conference on Artificial Intelligence, AAAI’13. (Cited on page 24) [Cardoso and Abreu, 2014a] Cardoso, N. and Abreu, R. (2014a). An efficient distributed algorithm for computing minimal hitting sets. In Proceedings of the 25th International Workshop on Principles of Diagnosis, DX’14. (Cited on page 23) [Cardoso and Abreu, 2014b] Cardoso, N. and Abreu, R. (2014b). Enhancing reasoning approaches to diagnose functional and non-functional errors. In Proceedings of the 25th International Workshop on Principles of Diagnosis, DX’14. (Cited on page 24) [Carey et al., 1999] Carey, J., Gross, N., Stepanek, M., and Port, O. (1999). Software hell. In Business Week, pages 391–411. (Cited on page 17) [Casanova et al., 2013] Casanova, P., Garlan, D., Schmerl, B., and Abreu, R. (2013). Diagnosing architectural run-time failures. In Proceedings of the 8th International Symposium on Software Engineering for Adaptive and Self-Managing Systems, 109
References SEAMS’13, pages 103–112. (Cited on pages 9,21,57 and 87) [Casanova et al., 2011] Casanova, P., Schmerl, B. R., Garlan, D., and Abreu, R. (2011). Architecture-based run-time fault diagnosis. In Proceedings of the 5th European Conference Software Architecture, ECSA’11, pages 261–277. (Cited on page 87) [Chao et al., 2004] Chao, K., Shah, N., Godwin, N., Younas, M., and Laing, C. (2004). Exception diagnosis in agent-based grid computing. In Proceedings of the 2004 International Conference on Systems, Man & Cybernetics, SMC’04, pages 3213–3219. (Cited on page 3) [Chen et al., 2013] Chen, C., Gross, H.-G., and Zaidman, A. (2013). Improving service diagnosis through increased monitoring granularity. In Proceedings of the 7th International Conference on Software Security and Reliability, SERE’13, pages 129–138. (Cited on pages 21 and 62) [Chen et al., 2002] Chen, M. Y., Kiciman, E., Fratkin, E., Fox, A., Fox, O., and Brewer, E. (2002). Pinpoint: Problem determination in large, dynamic internet services. In Proceedings of the 2002 International Conference on Dependable Systems and Networks, DSN’2002, pages 595–604. (Cited on page 89) [Cleve and Zeller, 2005] Cleve, H. and Zeller, A. (2005). Locating causes of program failures. In Proceedings of the 2005 International Conference on Software Engineering, ICSE’05, pages 342–351. (Cited on page 88) [Cmelik and Keppel, 1995] Cmelik, B. and Keppel, D. (1995). Shade: a Fast Instruction-Set Simulator for Execution Profiling. Springer. (Cited on page 84) [Cunha et al., 2012a] Cunha, J., Fernandes, J. P., Martins, P., Mendes, J., and Saraiva, J. (2012a). Smellsheet detective: a tool for detecting bad smells in spreadsheets. In Proceedings of the 2012 Symposium on Visual Languages and Human-Centric Computing, VL/HCC’12, pages 243–244. (Cited on page 90) [Cunha et al., 2012b] Cunha, J., Fernandes, J. P., Ribeiro, H., and Saraiva, J. (2012b). Towards a catalog of spreadsheet smells. In Computational Science and Its Applications, pages 202–216. Springer. (Cited on page 90) [Dallmeier et al., 2005] Dallmeier, V., Lindig, C., and Zeller, A. (2005). Lightweight defect localization for java. In Proceedings of the 2005 European Conference on Object-Oriented Programming, ECOOP’05, pages 528–550. (Cited on page 89) [Dean and Ghemawat, 2004] Dean, J. and Ghemawat, S. (2004). Mapreduce: Simplified data processing on large clusters. In Proceedings of the 2004 Symposium on Opearting Systems Design & Implementation, OSDI’04, pages 137–150. (Cited on pages 20 and 47) [Dijkstra, 1982] Dijkstra, E. W. (1982). Self-stabilization in spite of distributed control. In Selected writings on computing: a personal perspective, pages 41–46. Springer. (Cited on page 2) 110
References [Elbaum et al., 2002] Elbaum, S., Malishevsky, A. G., and Rothermel, G. (2002). Test case prioritization: a family of empirical studies. Transactions on Software Engineering, 28(2):159–182. (Cited on page 84) [Ernst et al., 2001] Ernst, M. D., Cockrell, J., Griswold, W. G., and Notkin, D. (2001). Dynamically discovering likely program invariants to support program evolution. Transactions on Software Engineering, 27(2):99–123. (Cited on page 83) [Ernst et al., 2000] Ernst, M. D., Czeisler, A., Griswold, W. G., and Notkin, D. (2000). Quickly detecting relevant program invariants. In Proceedings of the 22nd International Conference on Software Engineering, ICSE’00, pages 449–458, New York, NY, USA. (Cited on page 83) [Ernst et al., 2007] Ernst, M. D., Perkins, J. H., Guo, P. J., McCamant, S., Pacheco, C., Tschantz, M. S., and Xiao, C. (2007). The daikon system for dynamic detection of likely invariants. Science of Computer Programming, 69:35–45. (Cited on page 83) [Feldman et al., 2008] Feldman, A., Provan, G., and Van Gemund, A. J. C. (2008). Computing minimal diagnoses by greedy stochastic search. In Proceedings of the 23rd AAAI Conference on Artificial Intelligence, AAAI’08, pages 911–918. (Cited on pages 13 and 91) [Fijany and Vatan, 2004] Fijany, A. and Vatan, F. (2004). New approaches for efficient solution of hitting set problem. In Proceedings of the 2004 Winter International Synposium on Information and communication technologies, WISICT’04. (Cited on page 91) [Fijany and Vatan, 2005] Fijany, A. and Vatan, F. (2005). New high performance algorithmic solution for diagnosis problem. In Proceedings of the 2005 Aerospace Conference, IEEEAC’05. (Cited on page 91) [Fraser and Arcuri, 2011] Fraser, G. and Arcuri, A. (2011). Evosuite: Automatic test suite generation for object-oriented software. In Proceedings of the 19th Symposium and the 13th European Conference on Foundations of Software Engineering, ESEC’11/FSE’11, pages 416–419. (Cited on page 84) [Fraser and Arcuri, 2013] Fraser, G. and Arcuri, A. (2013). Whole test suite generation. Transactions on Software Engineering, 39(2):276–291. (Cited on page 84) [Fraser and Zeller, 2012] Fraser, G. and Zeller, A. (2012). Mutation-driven generation of unit tests and oracles. Transactions on Software Engineering, 38(2):278–292. (Cited on page 84) [Garey and Johnson, 1990] Garey, M. R. and Johnson, D. S. (1990). Computers and Intractability; A Guide to the Theory of NP-Completeness. W. H. Freeman & Co. (Cited on pages 12 and 32) 111
References [Garlan et al., 2004] Garlan, D., Cheng, S.-W., Huang, A.-C., Schmerl, B. R., and Steenkiste, P. (2004). Rainbow: Architecture-based self-adaptation with reusable infrastructure. Computer, 37(10):46–54. (Cited on page 3) [Garlan et al., 2000] Garlan, D., Monroe, R. T., and Wile, D. (2000). Acme: Architectural description of component-based systems. In Leavens, G. T. and Sitaraman, M., editors, Foundations of Component-Based Systems, pages 47–68. Cambridge University Press. (Cited on page 87) [Garlan and Perry, 1995] Garlan, D. and Perry, D. E. (1995). Introduction to the special issue on software architecture. Transactions in Software Engineering, 21(4):269–274. (Cited on page 84) [Garlan et al., 2001] Garlan, D., Schmerl, B., and Chang, J. (2001). Using gauges for architecture-based monitoring and adaptation. In Proceedings of the 2001 Working Conference on Complex and Dynamic Systems Architecture. (Cited on page 3) [Ghosh et al., 2007] Ghosh, D., Sharman, R., Rao, H. R., and Upadhyaya, S. (2007). Self-healing systems - survey and synthesis. Decision Support Systems in Emerging Economies, 42(4):2164–2185. (Cited on pages 2and 21) [González-Sanchez et al., 2011a] González-Sanchez, A., Abreu, R., Gross, H., and Van Gemund, A. J. C. (2011a). Prioritizing tests for fault localization through ambiguity group reduction. In Proceedings of the 26th International Conference on Automated Software Engineering, ASE’11, pages 83–92. (Cited on page 38) [González-Sanchez et al., 2011b] González-Sanchez, A., Piel, E., Abreu, R., Gross, H.-G., and Van Gemund, A. J. C. (2011b). Prioritizing tests for software fault localization. Software: Practice and Experience, 41(10):1105–1129. (Cited on page 84) [Gouveia et al., 2013] Gouveia, C., Campos, J., and Abreu, R. (2013). Using HTML5 visualizations in software fault localization. In 1st Working Conference on Software Visualization, VISSOFT, pages 1–10. (Cited on page 92) [Graham et al., 2006] Graham, D., van Veenendaal, E., Evans, I., and Black, R. (2006). Foundations of Software Testing: ISTQB Certification. Cengage Learning Business Press. (Cited on page 85) [Graham et al., 1982] Graham, S. L., Kessler, P. B., and Mckusick, M. K. (1982). Gprof: a call graph execution profiler. ACM SIGPLAN Notices, 17:120–126. (Cited on page 86) [Greiner et al., 1989] Greiner, R., Smith, B. A., and Wilkerson, R. W. (1989). A correction to the algorithm in Reiter’s theory of diagnosis. Artificial Intelligence, 41(1):79–88. (Cited on page 91) 112
References [Hailpern and Santhanam, 2002] Hailpern, B. and Santhanam, P. (2002). Software debugging, testing, and verification. IBM Systems Journal, 41(1):4–12. (Cited on pages 1and 2) [Hangal and Lam, 2002] Hangal, S. and Lam, M. S. (2002). Tracking down software bugs using automatic anomaly detection. In Proceedings of the 24th international conference on Software engineering, pages 291–301. (Cited on page 83) [Harrold et al., 1998] Harrold, M. J., Rothermel, G., Wu, R., and Yi, L. (1998). An empirical investigation of program spectra. In Proceedings of the 1998 Workshop on Program Analysis for Software Tools and Engineering, PASTE’98, pages 83–90. (Cited on pages 9and 10) [Hermans et al., 2012a] Hermans, F., Pinzger, M., and van Deursen, A. (2012a). Detecting and visualizing inter-worksheet smells in spreadsheets. In Proceedings of the 34th International Conference on Software Engineering, ICSE’12, pages 441–451. (Cited on page 90) [Hermans et al., 2012b] Hermans, F., Pinzger, M., and van Deursen, A. (2012b). Detecting code smells in spreadsheet formulas. In Proceedings of the 28th International Conference on Software Maintenance, ICSM’12, pages 409–418. (Cited on page 90) [Hofer et al., 2013] Hofer, B., Riboira, A., Wotawa, F., Abreu, R., and Getzner, E. (2013). On the empirical evaluation of fault localization techniques for spreadsheets. In Fundamental Approaches to Software Engineering, volume 7793 of Lecture Notes in Computer Science, pages 68–82. Springer-Verlag. (Cited on page 90) [Hofer and Wotawa, 2012] Hofer, B. and Wotawa, F. (2012). Spectrum enhanced dynamic slicing for better fault localization. In Proceedings of the 20th European Conference on Artificial Intelligence, ECAI’12, pages 420–425. (Cited on page 89) [Hollingsworth et al., 1997] Hollingsworth, J. K., Niam, O., Miller, B. P., Xu, Z., Gonçalves, M. J., and Zheng, L. (1997). Mdl: a language and compiler for dynamic program instrumentation. In Proceedings of the 1997 International Conference on Parallel Architectures and Compilation Techniques, PACT’97, pages 201–212. (Cited on page 85) [Hong et al., 2015] Hong, D.-Y., Hsu, C.-C., Chou, C.-Y., Hsu, W.-C., Liu, P., and Wu, J.-J. (2015). Optimizing control transfer and memory virtualization in full system emulators. Transactions on Architecture and Code Optimization, 12(4):47. (Cited on page 84) [Horn, 2001] Horn, P. (2001). Autonomic computing: IBM’s perspective on the state of information technology. (Cited on pages 1and 9) [Huang et al., 2010] Huang, C.-Y., Chang, J.-R., and Chang, Y.-H. (2010). Design and analysis of gui test-case prioritization using weight-based methods. Journal of Systems and Software, 83:646–659. (Cited on page 84) 113
References [Stallman et al., 2002] Stallman, R., Pesch, R., and Shebs, S. (2002). Debugging with GDB: the GNU Source-Level Debugger. A GNU Manual. GNU Press. (Cited on page 82) [Steimann et al., 2013] Steimann, F., Frenkel, M., and Abreu, R. (2013). Threats to the validity and value of empirical assessments of the accuracy of coverage-based fault locators. In Proceedings of the 2013 International Symposium on Software Testing and Analysis, ISSTA’2013, pages 314–324. (Cited on page 65) [Sun et al., 2013] Sun, W., Gao, Z., Yang, W., Fang, C., and Chen, Z. (2013). Multi-objective test case prioritization for gui applications. In Proceedings of the 28th Symposium on Applied Computing, SAC ’13, pages 1074–1079. (Cited on page 84) [Tan et al., 2010] Tan, J., Pan, X., Marinelli, E., Kavulya, S., Gandhi, R., and Narasimhan, P. (2010). Kahuna: Problem diagnosis for mapreduce-based cloud computing environments. In Proceedings of the 12th Network Operations and Management Symposium, NOMS, pages 112–119. (Cited on pages 3and 6) [Tikir and Hollingsworth, 2002] Tikir, M. M. and Hollingsworth, J. K. (2002). Efficient instrumentation for code coverage testing. In Proceedings of the 2002 International Symposium on Software Testing and Analysis, ISSTA’02, pages 86–96. (Cited on pages iv and 85) [e Silva MeyerDada al., 2004] , Silva MeyerDada., Garcia, A. A. F., de Souza, A. P., and De Souza, C. L. (2004). Comparison of similarity coefficients used for cluster analysis with dominant markers in maize. Genetics and Molecular Biology, 27:83–91. (Cited on pages 38 and 90) [Vinterbo and Øhrn, 2000] Vinterbo, S. A. and Øhrn, A. (2000). Minimal approximate hitting sets and rule templates. International Journal of Approximate Reasoning, 25(2):123–143. (Cited on page 91) [Vokolos and Frankl, 1998] Vokolos, F. I. and Frankl, P. G. (1998). Empirical evaluation of the textual differencing regression testing technique. In Proceedings of the 1998 International Conference on Software Maintenance, ICSM’98, pages 44–53, Washington, DC, USA. (Cited on page 83) [Weiser, 1982] Weiser, M. (1982). Programmers use slices when debugging. Communications ACM, 25(7):446–452. (Cited on page 89) [Weiser, 1984] Weiser, M. (1984). Program slicing. Transactions on Software Engineering, SE-10(4):352–357. (Cited on page 89) [Witchel and Rosenblum, 1996] Witchel, E. and Rosenblum, M. (1996). Embra: Fast and flexible machine simulation. In ACM SIGMETRICS Performance Evaluation Review, volume 24, pages 68–79. (Cited on page 84) 120
References [Wong and Qi, 2006] Wong, W. E. and Qi, Y. (2006). Effective program debugging based on execution slices and inter-block data dependency. Journal of Systems and Software, 79(7):891–903. (Cited on page 89) [Wotawa, 2001] Wotawa, F. (2001). A variant of reiter’s hitting-set algorithm. Information Processing Letters, 79(1):45–51. (Cited on pages 13 and 91) [Wotawa, 2010] Wotawa, F. (2010). Fault localization based on dynamic slicing and hitting-set computation. In Proceedings of the 10th International Conference on Quality Software, QSIC’10, pages 161–170. (Cited on pages 89 and 90) [Wotawa et al., 2002] Wotawa, F., Stumptner, M., and Mayer, W. (2002). Model-based debugging or how to diagnose programs automatically. In Proceedings of the 2002 International Conference on Industrial and Engineering Applications of Artificial Intelligence and Expert Systems, IAE/AIE’02, pages 746–757. (Cited on pages 3 and 4) [Xie et al., 2013] Xie, X., Wong, W. E., Chen, T. Y., and Xu, B. (2013). Metamorphic slice: An application in spectrum-based fault localization. Information and Software Technology, 55(5):866–879. (Cited on page 89) [Xie et al., 2010] Xie, X., Wong, W. E., Chen, T. Y., Xu, B., et al. (2010). Spectrum-based fault localization without test oracles. In Proceedings of the 11th International Conference on Quality Software, QSIC,11, pages 1–10. (Cited on page 89) [Yang et al., 2006] Yang, Q., Li, J. J., and Weiss, D. (2006). A survey of coverage based testing tools. In Proceedings of the 2006 International Workshop on Automation of Software Test, AST ’06, pages 99–103. (Cited on page 85) [Yilmaz et al., 2008] Yilmaz, C., Paradkar, A., and Williams, C. (2008). Time will tell: Fault localization using time spectra. In Proceedings of the 30th international conference on Software engineering, pages 81–90. (Cited on page 10) [Zadeh, 1965] Zadeh, L. A. (1965). Fuzzy sets. Information and Control, 8(3):338–353. (Cited on page 58) [Zadeh, 1968] Zadeh, L. A. (1968). Probability measures of fuzzy events. Journal of Mathematical Analysis and Applications, 23(2):421–427. (Cited on page 60) [Zeller, 2002] Zeller, A. (2002). Isolating cause-effect chains from computer programs. In Proceedings of the 2010 Symposium on Foundations of Software Engineering, ESEC’10/FSE’10, pages 1–10. (Cited on page 88) [Zeller and Hildebrandt, 2002] Zeller, A. and Hildebrandt, R. (2002). Simplifying and isolating failure-inducing input. Transactions on Software Engineering, 28(2):183–200. (Cited on pages iv and 88) [Zhang and Gupta, 2004] Zhang, X. and Gupta, R. (2004). Cost effective dynamic program slicing. ACM SIGPLAN Notices, 39(6):94–106. (Cited on page 89) 121
References [Zhang et al., 2005] Zhang, X., He, H., Gupta, N., and Gupta, R. (2005). Experimental evaluation of using dynamic slices for fault location. In Proceedings of the 2005 International Workshop on Automated and Analysis-Driven Debugging, AADEBUG’05, pages 33–42. (Cited on page 89) [Zhang et al., 2007] Zhang, X., Tallam, S., Gupta, N., and Gupta, R. (2007). Towards locating execution omission errors. In Proceedings of the 2007 Conference on Programming Language Design and Implementation, PLDI’07, pages 415–424. (Cited on page 89) [Zhao and Ouyang, 2007] Zhao, X. and Ouyang, D. (2007). Improved algorithms for deriving all minimal conflict sets in model-based diagnosis. In International Conference on Intelligent Computing, ICIC’07, pages 157–166. (Cited on page 91) [Zoeteweij et al., 2007] Zoeteweij, P., Abreu, R., Golsteijn, R., and Gemund, A. J. V. (2007). Diagnosis of embedded software using program spectra. In Proceedings of the 14th International Conference and Workshops on the Engineering of Computer-Based Systems, ECBS’07, pages 213–220. (Cited on page 91) 122
References Agradecimentos ----[---->+<]>++.[--->+<]>----.+++++++++++.+++[->+++<]>++.+++.+.--.+++ +++.++++.--------.+++++++++.++++++.-----.++++.[--->+<]----+++++++++>>> E cá está... o resultado de quase 5 anos da minha vida. Embora possa parecer tudo muito mecânico e trivial, a realidade é que a formalidade da escrita oculta toda a complexidade da experiência vivida. Houve momentos de imensa felicidade e momentos de enorme desespero. Gosto de fazer a comparação do processo com o Paradoxo de Zeno: “Suppose Homer wishes to walk to the end of a path. Before he can get there, he must get halfway there. Before he can get halfway there, he must get a quarter of the way there. Before traveling a quarter, he must travel one-eighth; before an eighth, one-sixteenth; and so on. (...) This description requires one to complete an infinite number of tasks, which Zeno maintains as an impossibility.” – Wikipedia1 Estabelecendo o paralelismo, inicialmente (i.e., imediatamente após a depressão de se perceber que não se capta nada do assunto), com o entusiasmo e energia de quem começa, a tarefa era agradável e grandes progressos foram feitos. No entanto, à medida que o tempo foi passando e a energia se foi esgotando, a tarefa tornou-se cada vez mais penosa e, apesar de, na prática, o objetivo final estar cada vez mais próximo, a minha perceção era de que eu não iria conseguir. O fim de cada tarefa dava origem ao início de outra, a qual era desempenhada com menor eficiência que a tarefa antecedente. Apesar de estar extremamente grato pela experiência, reconheço que foi bastante mais difícil do que eu esperava. Tenho a certeza de que a concretização desta tarefa só foi possível por ter tido ao meu lado as pessoas a quem passo a agradecer. Gostaria de começar por agradecer à minha melhor amiga e amor da minha vida, Lígia “Maria” Massena, por ter estado ao meu lado e me ter apoiado em todos os momentos deste desafio. 1À qual gostaria também de expressar o meu sincero agradecimento. 123
References Ao meu amigo e orientador, Rui “Grande Líder Kim Jong-Rui” Abreu, por acompanhar de perto todo este percurso e ter a paciência necessária para lidar comigo. Fico extremamente grato por ter tido um “chefe” que me tenha dado não só a liberdade mas também o incentivo para explorar todos os meus hobbies. Aos meus ídolos, o meu Avô Licínio, o meu amigo de longa data Nuno Cunha, e o meu grande amigo Vítor Almeida. As suas experiências de vida foram e continuam a ser uma fonte de inspiração para mim. Em particular, o meu Avô inspira-me pela sua determinação e tenacidade, o Nuno pelo seu sentido de justiça, integridade e conhecimento enciclopédico, e o Vítor pela sua generosidade e incrível engenho. À minha sogra, Iolanda “Sogra” Macena, que é mais do que uma mãe para mim e com quem partilho uma profunda amizade, pelo seu apoio incondicional. Ao meu sogro, Horácio “Macho” Massena, que apesar do início de relação “tenso”, é uma pessoa que atualmente me trata como filho e tem um orgulho genuíno dos meus feitos. À minha mãe e à minha Avó Olivinha, pelo apoio dado durante estes anos. À minha “avógra”, Olga “Companheira” Chicket, pelo seu papel instrumental numa fase de grande adversidade. Aos padrinhos, Mário “Padrinho” Tavares e Conceição “Madrinha” Tavares, pelo carinho e por marcarem presença em momentos significativos, ainda que pudessem ser de pouco interesse para eles (e.g., a defesa da minha tese). Ao meu “bro”, André “Beat” Silva, que esteve presente na grande maioria dos momentos determinantes do meu doutoramento. Foi um elemento estruturante neste processo e a quem devo uma grande parte dos meus sucessos. Partilhámos uma enorme diversidade de vivências, desde momentos de alegria extrema (e.g., “quod erat demonstrandum”, “colar o pistão”, etc.), a momentos de puro pânico (e.g., o episódio do gringo possuído, o evento pós-telepizza, etc.). Num aspeto mais mundano, e entre muitas outras coisas, o Beat inspirou-me a construir uma bateria e a aprender a tocá-la, coisa que atualmente contribui bastante para a minha felicidade. Ao meu companheiro de final de corrida, Lúcio “Primaço” Passos, pelo seu apoio, motivação e inesgotável boa disposição. Foi bom ter alguém igualmente miserável para poder perceber o meu ponto de vista. Ao meu amigo de sempre, João Pedro “Musty” Dias, por todo o apoio dado e por me tentar ensinar, ainda que com sucesso limitado, a importância de relaxar: “O Musty de amanhã pensa no assunto...”. Ao José Luís “Oh, Cala-te!” Pereira e à Neuza “Oh, Cala-te!” Florim, um casal com quem, de forma rápida e inesperada, criei uma forte amizade. Apesar da distância, estão lá no fundo do meu coração robótico. 124
References As minhas discussões com o Musty e com o Zé e a Neuza, por estarem sempre assentes em formas muito diferentes de ver o mundo2obrigaram-me a reconsiderar muitas “verdades absolutas”. Em retrospetiva, sinto que o facto de atualmente considerar a existência de um 0.5se deve em grande parte a eles. Ao Márcio “Márcinho” Sá, companheiro de bricolage, por estar sempre disponível para me ajudar, ao ponto de se matar (quase literalmente) a trabalhar. Ao Elói “Braahh” Barros e Nuno “Té Looogooo...” Gaspar pelo apoio, boa disposição e prontidão para o que desse e viesse. Té looogooooo!!! À Raquel Almeida, com quem vivi uma experiência que me ficará marcada para o resto da vida, e no processo me ensinou a reconhecer o valor dos amigos. À Idalina “Lina” Silva, pelos seus valiosos conselhos e por me ter facilitado imensamente a vida ao resolver-me prontamente problemas que estavam para alem das suas obrigações (e.g., reservar/fazer check-in em voos para conferências, enviar-me documentos para a FCT, etc.). To Luuk Eliens, a guy with whom I immediately felt connected to and had the pleasure to work with. I truly admire his determination when pursuing a goal. I hope one day we can work together again. Ao Vítor e Marly Pinto, pelo seu carinho e amizade e por me brindarem consistentemente com alegria e boa disposição. Ao Mauari Quintero, à Katherine Velosa e à “Sammy”, uns amigos improváveis, que me deram todo o seu carinho e apoio. Ao Vasco Mota e à Isabel Pinto, pelo companheirismo e experiências vividas em conjunto. Ao Carlos “Carlinhos” Gouveia, que foi um gajo para quem eu trabalhei uma tarde e, em troca, recebi uma enorme consideração e reconhecimento que prevaleceram ao teste do tempo. Às meninas do Subway, Maria Mendes, Sara Moreira, Marisa Soares, Ana Albergaria, e ao Rúben Quintal, pela boa disposição, simpatia e, sobretudo, pelas enumeras vezes que me alimentaram (com “extra-pimentos”) durante estes anos. 2A minha visão: 0110011010010011100. A deles: arcos-íris e unicórnios (caricaturado). 125