SlideShare une entreprise Scribd logo
1  sur  56
Runtime Monitoring of Functional
   Component Changes with
       Behavior Models
             Carlo Ghezzi
             Andrea Mocci
            Mario Sangiorgio
OPEN ENVIRONMENT




Application   Service




                        2
ISSUES



Lack of formal       Services may change
specifications              behavior




                                           3
GOALS



 Recover specifications
                         Detect changes
and keep them updated




                                          4
GOALS



 Recover specifications
                         Detect changes
and keep them updated


                 AT RUNTIME

                                          4
APPROACH
DESIGN TIME           RUN TIME
                             Specification
                               Update
 Specification   Monitoring
                               Change
                              Detection
  Inference



                                            5
pop()




                                                   pu
                                pop()




                                                      sh




                                                                            )
                                                        (2




                                                                          p(
                   Stack




                                                          )




                                                                        po
                size() = 0
Stack()            top()                                                 push(2) push(1)




                                                                        po
                =Exception




                                                        )




                                                                          p(
                                                      (1




                                                                            )
                                                    sh
                      push(2)




                               SPECIFICATIONS

                                                  pu
                                pop()
                                                              pop()
                                        Stack                                 Stack
                                     size() = 1                            size() ≥ 2
                                     top() = 2                             top() = 2
                                                          push(2)
                                                                         pop(), push(2)


          Figure 2: Outline of the Synthesis Algorithm




                     pop()                                    push(2)
      Stack                              Stack                                 Stack                                          pop          push
   size() = 2                         size() = 1                            size() = 2
   top() = 1                          top() = 1                             top() = 2                                               push
                    push(1)                                    pop()
                                    pop()                                                                                     S0            S1
                                                                                                                   Stack
                          push(1)
                                                                                                                                     pop
                   Stack
                size() = 0                                                                                                                  pop
Stack()            top()              pop()
                =Exception                                                                 State   push      pop                      size         top
                                                                                                                           Observer Abstraction
                          push(2)
                                                                                           S0      —            EmptyStackException   —               EmptyStackException
                                    pop()
                     pop()                                     pop()                       S1      —         —                        —            —
      Stack                              Stack                                 Stack                                    Modifier Behavior Abstraction
   size() = 2                         size() = 1                            size() = 2     S0      Variant   Invariant                Invariant    Invariant
   top() = 1                          top() = 2                             top() = 2
                                                                                           S1      Variant   Variant                  Invariant    Invariant
                    push(1)                                   push(2)


          Figure 3: Outline of the Synthesis Algorithm

       Behavioral                                                                                         Protocol Behavior
   Equivalence Models                                                                                          Models


                                                                                                                                                                            6
BEHAVIORAL EQUIVALENCE MODELS
          Based on behavioral equivalence
Two objects x and y are behaviorally equivalent if and
   only if for every possible sequence s made of
 modifiers and ending with an observer s(x) = s(y)

      Built exploring exhaustively a small scope
Hypothesis: A small but Precise Finite-State Model
captures “by example” all the relevant behavior of a
                  component
                                                         7
BEHAVIORAL EQUIVALENCE MODELS
                     pop()                      push(2)
       Stack                          Stack                  Stack
    size() = 2                     size() = 1             size() = 2
    top() = 1                      top() = 1              top() = 2
                    push(1)                      pop()
                                 pop()
                       push(1)

                    Stack
                 size() = 0
 Stack()            top()          pop()
                 =Exception

                       push(2)
                                 pop()
                     pop()                       pop()
       Stack                          Stack                  Stack
    size() = 2                     size() = 1             size() = 2
    top() = 1                      top() = 2              top() = 2
                    push(1)                     push(2)

                                                                       8
BEHAVIORAL EQUIVALENCE MODELS
                     pop()                      push(2)
       Stack                          Stack                  Stack
    size() = 2                     size() = 1             size() = 2
    top() = 1                      top() = 1              top() = 2
                    push(1)                      pop()
                                 pop()
                       push(1)

                    Stack
                 size() = 0
 Stack()            top()          pop()
                 =Exception

                       push(2)
                                 pop()
                     pop()                       pop()
       Stack                          Stack                  Stack
    size() = 2                     size() = 1             size() = 2
    top() = 1                      top() = 2              top() = 2
                    push(1)                     push(2)

                                 Small scope                           8
BEHAVIORAL EQUIVALENCE MODELS
                     pop()                       push(2)
       Stack                          Stack                   Stack
    size() = 2                     size() = 1              size() = 2
    top() = 1                      top() = 1               top() = 2
                    push(1)                       pop()
                                 pop()
                       push(1)

                    Stack
                 size() = 0                 Exhaustive
 Stack()                           pop()
                    top()                     search
                 =Exception

                       push(2)
                                 pop()
                     pop()                        pop()
       Stack                          Stack                   Stack
    size() = 2                     size() = 1              size() = 2
    top() = 1                      top() = 2               top() = 2
                    push(1)                      push(2)

                                 Small scope                            8
BEHAVIORAL EQUIVALENCE MODELS
                     pop()                       push(2)
       Stack                          Stack                   Stack
    size() = 2                     size() = 1              size() = 2
    top() = 1                      top() = 1               top() = 2
                    push(1)                       pop()
                                 pop()
                       push(1)
                                                           Up to a bound
                    Stack
                 size() = 0                 Exhaustive
 Stack()                           pop()
                    top()                     search
                 =Exception

                       push(2)
                                 pop()
                     pop()                        pop()
       Stack                          Stack                   Stack
    size() = 2                     size() = 1              size() = 2
    top() = 1                      top() = 2               top() = 2
                    push(1)                      push(2)

                                 Small scope                               8
BEHAVIORAL EQUIVALENCE MODELS

           PROs                       CONs

 Precise description of the   Limited to the observed
   component behavior               (small) scope




                                                        9
BEHAVIORAL EQUIVALENCE MODELS

           PROs                       CONs

 Precise description of the   Limited to the observed
   component behavior               (small) scope



                   NEED FOR MORE
                  GENERAL MODELS!
                                                        9
PROTOCOL BEHAVIOR MODELS

  Abstraction of the information in the
     Behavioral Equivalence Models



      Normal or exceptional result




      Effects on component’s state
                                          10
PROTOCOL BEHAVIOR MODELS
                                   pop          push

                                         push

                        Stack      S0            S1
                                          pop

                                                 pop
State   push      pop                      size         top
                                Observer Abstraction
S0      —            EmptyStackException   —               EmptyStackException
S1      —         —                        —            —
                             Modifier Behavior Abstraction
S0      Variant   Invariant                Invariant    Invariant
S1      Variant   Variant                  Invariant    Invariant




                                                                                 11
PROTOCOL BEHAVIOR MODELS
                  No parameters
                                    pop          push

                                          push

                         Stack      S0            S1
                                           pop

                                                  pop
State   push       pop                      size         top
                                 Observer Abstraction
S0      —             EmptyStackException   —               EmptyStackException
S1      —          —                        —            —
                              Modifier Behavior Abstraction
S0      Variant    Invariant                Invariant    Invariant
S1      Variant    Variant                  Invariant    Invariant




                                                                                  11
PROTOCOL BEHAVIOR MODELS
                  No parameters
                                       pop          push

                                             push

                           Stack       S0           S1
                                             pop
                         Result type                pop
State   push       pop                      size         top
                                 Observer Abstraction
S0      —             EmptyStackException   —               EmptyStackException
S1      —          —                        —            —
                              Modifier Behavior Abstraction
S0      Variant    Invariant                Invariant    Invariant
S1      Variant    Variant                  Invariant    Invariant




                                                                                  11
PROTOCOL BEHAVIOR MODELS
                  No parameters
                                       pop          push

                                             push

                           Stack       S0           S1
                                             pop
                         Result type                pop
State   push       pop                      size         top
                                 Observer Abstraction
S0      —             EmptyStackException   —               EmptyStackException
S1      —          —                        —            —
                              Modifier Behavior Abstraction
S0      Variant    Invariant                Invariant    Invariant
S1      Variant    Variant                  Invariant    Invariant


Effects on state

                                                                                  11
A MORE COMPLEX EXAMPLE


                 void putNextEntry(Entry entry);
                 void write(String data);
                 void close();
StorageService

  Exception thrown on not allowed operations

Set-like behavior and complex interaction protocol
                                                     12
INITIAL MODEL*
      c, w              w, pE         S2
                                                          c       c, w, pE
                             pE                 c
                   pE                                         c
S         S0               S1         pE            S4              S5
                                   pE pE
                                                         w, pE
                           w                          c
                           w          S3

Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
State          close               putN extEntry            write
                                   Observer Abstraction
S0                ZipException     —                           ZipException
S1             —                   [−,   ZipException]      —
S2             —                   [−,   ZipException]         ZipException
S3             —                      ZipException          —
S4             —                      ZipException             ZipException
S5             —                      IOException              IOException    *derived from
                              Modifier Behavior Abstraction                      test cases
S0             Invariant           Variant                  Invariant           containing
S1             Variant             Variant                  Invariant
S2             Variant             Invariant                Invariant
                                                                               entries e, f
S3             Variant             Variant                  Invariant          and writing
S4             Variant             Invariant                Invariant              “0” 13
S5             Invariant           Invariant                Invariant
INITIAL MODEL*
           c, w              w, pE         S2
                                                               c       c, w, pE
                                  pE                 c
                        pE                                         c
    S          S0               S1         pE            S4              S5
                                        pE pE
                                                              w, pE
                                w                          c
                                w          S3
First entry inserted
     Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
     State          close               putN extEntry            write
                                        Observer Abstraction
     S0                ZipException     —                           ZipException
     S1             —                   [−,   ZipException]      —
     S2             —                   [−,   ZipException]         ZipException
     S3             —                      ZipException          —
     S4             —                      ZipException             ZipException
     S5             —                      IOException              IOException    *derived from
                                   Modifier Behavior Abstraction                      test cases
     S0             Invariant           Variant                  Invariant           containing
     S1             Variant             Variant                  Invariant
     S2             Variant             Invariant                Invariant
                                                                                    entries e, f
     S3             Variant             Variant                  Invariant          and writing
     S4             Variant             Invariant                Invariant              “0” 13
     S5             Invariant           Invariant                Invariant
INITIAL MODEL* blocks write
                     Duplicate entry
           c, w              w, pE         S2
                                                               c       c, w, pE
                                  pE                 c
                        pE                                         c
    S          S0               S1         pE            S4              S5
                                        pE pE
                                                              w, pE
                                w                          c
                                w          S3
First entry inserted
     Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
     State          close               putN extEntry            write
                                        Observer Abstraction
     S0                ZipException     —                           ZipException
     S1             —                   [−,   ZipException]      —
     S2             —                   [−,   ZipException]         ZipException
     S3             —                      ZipException          —
     S4             —                      ZipException             ZipException
     S5             —                      IOException              IOException    *derived from
                                   Modifier Behavior Abstraction                      test cases
     S0             Invariant           Variant                  Invariant           containing
     S1             Variant             Variant                  Invariant
     S2             Variant             Invariant                Invariant
                                                                                    entries e, f
     S3             Variant             Variant                  Invariant          and writing
     S4             Variant             Invariant                Invariant              “0” 13
     S5             Invariant           Invariant                Invariant
INITIAL MODEL* blocks write
                     Duplicate entry
           c, w              w, pE         S2
                                                               c       c, w, pE
                                  pE                 c
                        pE                                         c
    S          S0               S1         pE            S4              S5
                                        pE pE
                                                              w, pE
                                w                          c
                                w          S3
First entry inserted                                     Two valid entries inserted
     Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
     State          close               putN extEntry            write
                                        Observer Abstraction
     S0                ZipException     —                           ZipException
     S1             —                   [−,   ZipException]      —
     S2             —                   [−,   ZipException]         ZipException
     S3             —                      ZipException          —
     S4             —                      ZipException             ZipException
     S5             —                      IOException              IOException    *derived from
                                   Modifier Behavior Abstraction                      test cases
     S0             Invariant           Variant                  Invariant           containing
     S1             Variant             Variant                  Invariant
     S2             Variant             Invariant                Invariant
                                                                                    entries e, f
     S3             Variant             Variant                  Invariant          and writing
     S4             Variant             Invariant                Invariant              “0” 13
     S5             Invariant           Invariant                Invariant
INITIAL MODEL* blocks write
                     Duplicate entry
           c, w              w, pE         S2
                                                               c       c, w, pE
                                  pE                 c
                        pE                                         c
                                                                                  No more valid
    S          S0               S1         pE            S4              S5
                                                                                     entries
                                        pE pE
                                                              w, pE                available?
                                w                          c
                                w          S3
First entry inserted                                     Two valid entries inserted
     Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
     State          close               putN extEntry            write
                                        Observer Abstraction
     S0                ZipException     —                           ZipException
     S1             —                   [−,   ZipException]      —
     S2             —                   [−,   ZipException]         ZipException
     S3             —                      ZipException          —
     S4             —                      ZipException             ZipException
     S5             —                      IOException              IOException     *derived from
                                   Modifier Behavior Abstraction                       test cases
     S0             Invariant           Variant                  Invariant            containing
     S1             Variant             Variant                  Invariant
     S2             Variant             Invariant                Invariant
                                                                                     entries e, f
     S3             Variant             Variant                  Invariant           and writing
     S4             Variant             Invariant                Invariant               “0” 13
     S5             Invariant           Invariant                Invariant
EXAMPLE


Let’s use the model and update it at runtime!




                                                14
MONITORING

                   Behavior
                    Models



Execution traces are checked against the models




                                                  15
MONITORING ISSUES


          Observed traces may
            not be enough

         Observations may affect
           component’s state



                                   16
ASSUMPTIONS


           Behavior
            Models


Clones available to the monitor



                                  17
VIOLATION DETECTION



Execution      Protocol
  Trace     Behavior Model




                             18
CHECKING THE PROTOCOL
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
 s.putNextEntry(a)         -     S1                                                     c
                                                           pE                                         c
 s.putNextEntry(a)         -      ?     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
                                                                   w                          c
                                                                   w          S3

                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      19
CHECKING THE PROTOCOL
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
 s.putNextEntry(a)         -     S1                                                     c
                                                           pE                                         c
 s.putNextEntry(a)         -      ?     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
                                                                   w                          c
                                                                   w          S3

                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      19
CHECKING THE PROTOCOL
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
 s.putNextEntry(a)         -     S1                                                     c
                                                           pE                                         c
 s.putNextEntry(a)         -      ?     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
                                                                   w                          c
                                                                   w          S3

                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      19
CHECKING THE PROTOCOL
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
 s.putNextEntry(a)         -     S1                                                     c
                                                           pE                                         c
 s.putNextEntry(a)         -      ?     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
     It depends on the                                             w
                                                                   w          S3              c

      outcome of next                   Legend:
                                        State          close
                                                            S:StorageService, w:write, c:close, pE:putNextEntry
                                                                           putN extEntry            write

         operations                     S0                ZipException
                                                                           Observer Abstraction
                                                                           —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —

   Check on the clone                   S4
                                        S5
                                                       —
                                                       —
                                                                              ZipException
                                                                              IOException
                                                                      Modifier Behavior Abstraction
                                                                                                       ZipException
                                                                                                       IOException


       results of a                     S0
                                        S1
                                                       Invariant
                                                       Variant
                                                                           Variant
                                                                           Variant
                                                                                                    Invariant
                                                                                                    Invariant

discriminating operation
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant

 with known instances                   S5             Invariant           Invariant                Invariant
                                                                                                                      19
PROTOCOL VIOLATION (1)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                 S1                                  pE
 s.putNextEntry(a)         -                                                            c
                                                           pE                                         c
 s.putNextEntry(a)         -     S2     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
 s.putNextEntry(b)         -     S2
                                                                   w                          c
                                                                   w          S3
    s.write(data)          -      ?
                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      20
PROTOCOL VIOLATION (1)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                 S1                                  pE
 s.putNextEntry(a)         -                                                            c
                                                           pE                                         c
 s.putNextEntry(a)         -     S2     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
 s.putNextEntry(b)         -     S2
                                                                   w                          c
                                                                   w          S3
    s.write(data)          -      ?
                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      20
PROTOCOL VIOLATION (1)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                 S1                                  pE
 s.putNextEntry(a)         -                                                            c
                                                           pE                                         c
 s.putNextEntry(a)         -     S2     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
 s.putNextEntry(b)         -     S2
                                                                   w                          c
                                                                   w          S3
    s.write(data)          -      ?
                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      20
PROTOCOL VIOLATION (1)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                 S1                                  pE
 s.putNextEntry(a)         -                                                            c
                                                           pE                                         c
 s.putNextEntry(a)         -     S2     S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
 s.putNextEntry(b)         -     S2
                                                                   w                          c
                                                                   w          S3
    s.write(data)          -      ?
                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —

 As seen before the test                S2
                                        S3
                                        S4
                                                       —
                                                       —
                                                       —
                                                                           [−,   ZipException]
                                                                              ZipException
                                                                              ZipException
                                                                                                    —
                                                                                                       ZipException

                                                                                                       ZipException

scope was too small, but                S5             —                      IOException
                                                                      Modifier Behavior Abstraction
                                                                                                       IOException



  we can fix the model!
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      20
PROTOCOL VIOLATION (2)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
     s.write(“”)           -      ?                                                     c
                                                           pE                                         c
                                        S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
                                                                   w                          c
                                                                   w          S3

                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      21
PROTOCOL VIOLATION (2)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
     s.write(“”)           -      ?                                                     c
                                                           pE                                         c
                                        S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
                                                                   w                          c
                                                                   w          S3

                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry
                                        State          close               putN extEntry            write
                                                                           Observer Abstraction
                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException
                                        S3             —                      ZipException          —
                                        S4             —                      ZipException             ZipException
                                        S5             —                      IOException              IOException
                                                                      Modifier Behavior Abstraction
                                        S0             Invariant           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      21
PROTOCOL VIOLATION (2)
    OPERATION           OUTCOME STATE
s = StorageService();      -     S0
                                              c, w              w, pE         S2
                                                                                                  c       c, w, pE
                                                                     pE
     s.write(“”)           -      ?                                                     c
                                                           pE                                         c
                                        S         S0               S1         pE            S4              S5
                                                                           pE pE
                                                                                                 w, pE
                                                                   w                          c
                                                                   w          S3

                                        Legend:             S:StorageService, w:write, c:close, pE:putNextEntry

ZipException expected!                  State          close               putN extEntry
                                                                           Observer Abstraction
                                                                                                    write

                                        S0                ZipException     —                           ZipException
                                        S1             —                   [−,   ZipException]      —
                                        S2             —                   [−,   ZipException]         ZipException

   Special values are                   S3
                                        S4
                                        S5
                                                       —
                                                       —
                                                       —
                                                                              ZipException
                                                                              ZipException
                                                                              IOException
                                                                                                    —
                                                                                                       ZipException
                                                                                                       IOException

  unknown in advance                    S0             Invariant
                                                                      Modifier Behavior Abstraction
                                                                           Variant                  Invariant
                                        S1             Variant             Variant                  Invariant
                                        S2             Variant             Invariant                Invariant
                                        S3             Variant             Variant                  Invariant
                                        S4             Variant             Invariant                Invariant
                                        S5             Invariant           Invariant                Invariant
                                                                                                                      21
VIOLATION INTERPRETATION

    Protocol
 Behavior Model
                   Behavioral
                  Equivalence
                    Model




                                22
IS THE VIOLATION A CHANGE?
              We can tell it replaying the
                traces contained in the
             Behavioral Equivalence Model




    Everything still works:      Different results:
previously unobserved behavior   change detected
                                                      23
MODEL UPDATES

  Old Behavior
Equivalence Model




                            24
MODEL UPDATES

  Old Behavior
Equivalence Model




 Trace exposing
  new behavior




                            24
MODEL UPDATES

  Old Behavior
Equivalence Model


 Extended scopes
for existing models


 Trace exposing
  new behavior




                              24
MODEL UPDATES

  Old Behavior
Equivalence Model


                      Set of Behavior
 Extended scopes
                       Equivalence
for existing models
                          Models

 Trace exposing
  new behavior




                                        24
MODEL UPDATES

  Old Behavior
Equivalence Model


                             Set of Behavior
 Extended scopes
                              Equivalence
for existing models
                                 Models

 Trace exposing
  new behavior



                            Incremental
                      Add only new information
                                                 24
MODEL UPDATES

  Old Behavior
Equivalence Model


                             Set of Behavior
 Extended scopes                                 Updated Protocol
                              Equivalence
for existing models                               Behavior Model
                                 Models

 Trace exposing
  new behavior



                            Incremental
                      Add only new information
                                                                    24
UPDATED MODEL
          c, w         pE, w                        c

                                   pE             w, pE
                 pE                                          c
 S        S0             S1        pE        S2

                                              c                        S5
                              pE    pE                           c
                                        pE                           c, w, pE
                         S3                             S4



                          w                         w, pE
Legend:         S:StorageService, w:write, c:close, pE:putNextEntry
State      close               putN extEntry            write
                               Observer Abstraction
S0            ZipException     —                           ZipException
S1         —                   [−,   ZipException]      —
S2         —                   [−,   ZipException]         ZipException
S3         —                      ZipException          —
S4         —                      ZipException             ZipException
S5         —                      IOException              IOException
                          Modifier Behavior Abstraction
S0         Invariant           Variant                  Invariant
S1         Variant             Variant                  Invariant
S2         Variant             Invariant                Invariant
S3         Variant             Variant                  Invariant
S4         Variant             Invariant                Invariant
S5         Invariant           Invariant                Invariant               25
UPDATED MODEL
                 c, w         pE, w                        c

                                          pE             w, pE
                        pE                                          c
        S        S0             S1        pE        S2

                                                     c                        S5
                                     pE    pE                           c
First entry inserted                           pE                           c, w, pE
                                S3                             S4



                                 w                         w, pE
       Legend:         S:StorageService, w:write, c:close, pE:putNextEntry
       State      close               putN extEntry            write
                                      Observer Abstraction
       S0            ZipException     —                           ZipException
       S1         —                   [−,   ZipException]      —
       S2         —                   [−,   ZipException]         ZipException
       S3         —                      ZipException          —
       S4         —                      ZipException             ZipException
       S5         —                      IOException              IOException
                                 Modifier Behavior Abstraction
       S0         Invariant           Variant                  Invariant
       S1         Variant             Variant                  Invariant
       S2         Variant             Invariant                Invariant
       S3         Variant             Variant                  Invariant
       S4         Variant             Invariant                Invariant
       S5         Invariant           Invariant                Invariant               25
UPDATED MODEL                                        c
                 c, w         pE, w                                         Duplicate entry
                                          pE             w, pE
                        pE                                          c
        S        S0             S1        pE        S2

                                                     c                        S5
                                     pE    pE                           c
First entry inserted                           pE                           c, w, pE
                                S3                             S4



                                 w                         w, pE
       Legend:         S:StorageService, w:write, c:close, pE:putNextEntry
       State      close               putN extEntry            write
                                      Observer Abstraction
       S0            ZipException     —                           ZipException
       S1         —                   [−,   ZipException]      —
       S2         —                   [−,   ZipException]         ZipException
       S3         —                      ZipException          —
       S4         —                      ZipException             ZipException
       S5         —                      IOException              IOException
                                 Modifier Behavior Abstraction
       S0         Invariant           Variant                  Invariant
       S1         Variant             Variant                  Invariant
       S2         Variant             Invariant                Invariant
       S3         Variant             Variant                  Invariant
       S4         Variant             Invariant                Invariant
       S5         Invariant           Invariant                Invariant                      25
UPDATED MODEL                                        c
                 c, w         pE, w                                         Duplicate entry
                                          pE             w, pE
                        pE                                          c
        S        S0             S1        pE        S2

                                                     c                        S5
                                     pE    pE                           c
First entry inserted                           pE                           c, w, pE
                                S3                             S4



                                 w                         w, pE            Scope effects
       Legend:         S:StorageService, w:write, c:close, pE:putNextEntry
       State      close               putN extEntry            write
                                      Observer Abstraction
       S0            ZipException     —                           ZipException
       S1         —                   [−,   ZipException]      —
       S2         —                   [−,   ZipException]         ZipException
       S3         —                      ZipException          —
       S4         —                      ZipException             ZipException
       S5         —                      IOException              IOException
                                 Modifier Behavior Abstraction
       S0         Invariant           Variant                  Invariant
       S1         Variant             Variant                  Invariant
       S2         Variant             Invariant                Invariant
       S3         Variant             Variant                  Invariant
       S4         Variant             Invariant                Invariant
       S5         Invariant           Invariant                Invariant                      25
CHANGE DETECTION

  Effectiveness of change
detection proved injecting
 faults in the component




    Always working and always exceptional
       implementation for each method
                                            26
CONCLUSIONS

✓Behavioral Models at run time
✓Specification of a software component
✓Functional change detection




                                        27
FUTURE WORK

•Relax assumptions
•Tackle scope effects
•Minimization of the scope size
•Model interacting objects




                                  28

Contenu connexe

En vedette

Coding standards for java
Coding standards for javaCoding standards for java
Coding standards for javamaheshm1206
 
Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practicesmh_azad
 
Coding standards
Coding standardsCoding standards
Coding standardsMimoh Ojha
 
Clean code and Code Smells
Clean code and Code SmellsClean code and Code Smells
Clean code and Code SmellsMario Sangiorgio
 
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
Clean Code - Design Patterns and Best Practices at Silicon Valley Code CampClean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
Clean Code - Design Patterns and Best Practices at Silicon Valley Code CampTheo Jungeblut
 
Coding standards and guidelines
Coding standards and guidelinesCoding standards and guidelines
Coding standards and guidelinesbrijraj_singh
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringEyob Lube
 
Clean Code I - Best Practices
Clean Code I - Best PracticesClean Code I - Best Practices
Clean Code I - Best PracticesTheo Jungeblut
 
Programming languages
Programming languagesProgramming languages
Programming languagesAkash Varaiya
 
How to Teach Yourself to Code
How to Teach Yourself to CodeHow to Teach Yourself to Code
How to Teach Yourself to CodeMattan Griffel
 

En vedette (12)

Coding standards for java
Coding standards for javaCoding standards for java
Coding standards for java
 
Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practices
 
Coding standards
Coding standardsCoding standards
Coding standards
 
Clean code and Code Smells
Clean code and Code SmellsClean code and Code Smells
Clean code and Code Smells
 
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
Clean Code - Design Patterns and Best Practices at Silicon Valley Code CampClean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
 
Coding standards and guidelines
Coding standards and guidelinesCoding standards and guidelines
Coding standards and guidelines
 
C# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoringC# coding standards, good programming principles & refactoring
C# coding standards, good programming principles & refactoring
 
Clean Code I - Best Practices
Clean Code I - Best PracticesClean Code I - Best Practices
Clean Code I - Best Practices
 
Clean code
Clean codeClean code
Clean code
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Computer Languages.
Computer Languages.Computer Languages.
Computer Languages.
 
How to Teach Yourself to Code
How to Teach Yourself to CodeHow to Teach Yourself to Code
How to Teach Yourself to Code
 

Dernier

H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Dernier (20)

H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Runtime Monitoring of Functional Component Changes with Behavior Models

  • 1. Runtime Monitoring of Functional Component Changes with Behavior Models Carlo Ghezzi Andrea Mocci Mario Sangiorgio
  • 3. ISSUES Lack of formal Services may change specifications behavior 3
  • 4. GOALS Recover specifications Detect changes and keep them updated 4
  • 5. GOALS Recover specifications Detect changes and keep them updated AT RUNTIME 4
  • 6. APPROACH DESIGN TIME RUN TIME Specification Update Specification Monitoring Change Detection Inference 5
  • 7. pop() pu pop() sh ) (2 p( Stack ) po size() = 0 Stack() top() push(2) push(1) po =Exception ) p( (1 ) sh push(2) SPECIFICATIONS pu pop() pop() Stack Stack size() = 1 size() ≥ 2 top() = 2 top() = 2 push(2) pop(), push(2) Figure 2: Outline of the Synthesis Algorithm pop() push(2) Stack Stack Stack pop push size() = 2 size() = 1 size() = 2 top() = 1 top() = 1 top() = 2 push push(1) pop() pop() S0 S1 Stack push(1) pop Stack size() = 0 pop Stack() top() pop() =Exception State push pop size top Observer Abstraction push(2) S0 — EmptyStackException — EmptyStackException pop() pop() pop() S1 — — — — Stack Stack Stack Modifier Behavior Abstraction size() = 2 size() = 1 size() = 2 S0 Variant Invariant Invariant Invariant top() = 1 top() = 2 top() = 2 S1 Variant Variant Invariant Invariant push(1) push(2) Figure 3: Outline of the Synthesis Algorithm Behavioral Protocol Behavior Equivalence Models Models 6
  • 8. BEHAVIORAL EQUIVALENCE MODELS Based on behavioral equivalence Two objects x and y are behaviorally equivalent if and only if for every possible sequence s made of modifiers and ending with an observer s(x) = s(y) Built exploring exhaustively a small scope Hypothesis: A small but Precise Finite-State Model captures “by example” all the relevant behavior of a component 7
  • 9. BEHAVIORAL EQUIVALENCE MODELS pop() push(2) Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 1 top() = 2 push(1) pop() pop() push(1) Stack size() = 0 Stack() top() pop() =Exception push(2) pop() pop() pop() Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 2 top() = 2 push(1) push(2) 8
  • 10. BEHAVIORAL EQUIVALENCE MODELS pop() push(2) Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 1 top() = 2 push(1) pop() pop() push(1) Stack size() = 0 Stack() top() pop() =Exception push(2) pop() pop() pop() Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 2 top() = 2 push(1) push(2) Small scope 8
  • 11. BEHAVIORAL EQUIVALENCE MODELS pop() push(2) Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 1 top() = 2 push(1) pop() pop() push(1) Stack size() = 0 Exhaustive Stack() pop() top() search =Exception push(2) pop() pop() pop() Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 2 top() = 2 push(1) push(2) Small scope 8
  • 12. BEHAVIORAL EQUIVALENCE MODELS pop() push(2) Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 1 top() = 2 push(1) pop() pop() push(1) Up to a bound Stack size() = 0 Exhaustive Stack() pop() top() search =Exception push(2) pop() pop() pop() Stack Stack Stack size() = 2 size() = 1 size() = 2 top() = 1 top() = 2 top() = 2 push(1) push(2) Small scope 8
  • 13. BEHAVIORAL EQUIVALENCE MODELS PROs CONs Precise description of the Limited to the observed component behavior (small) scope 9
  • 14. BEHAVIORAL EQUIVALENCE MODELS PROs CONs Precise description of the Limited to the observed component behavior (small) scope NEED FOR MORE GENERAL MODELS! 9
  • 15. PROTOCOL BEHAVIOR MODELS Abstraction of the information in the Behavioral Equivalence Models Normal or exceptional result Effects on component’s state 10
  • 16. PROTOCOL BEHAVIOR MODELS pop push push Stack S0 S1 pop pop State push pop size top Observer Abstraction S0 — EmptyStackException — EmptyStackException S1 — — — — Modifier Behavior Abstraction S0 Variant Invariant Invariant Invariant S1 Variant Variant Invariant Invariant 11
  • 17. PROTOCOL BEHAVIOR MODELS No parameters pop push push Stack S0 S1 pop pop State push pop size top Observer Abstraction S0 — EmptyStackException — EmptyStackException S1 — — — — Modifier Behavior Abstraction S0 Variant Invariant Invariant Invariant S1 Variant Variant Invariant Invariant 11
  • 18. PROTOCOL BEHAVIOR MODELS No parameters pop push push Stack S0 S1 pop Result type pop State push pop size top Observer Abstraction S0 — EmptyStackException — EmptyStackException S1 — — — — Modifier Behavior Abstraction S0 Variant Invariant Invariant Invariant S1 Variant Variant Invariant Invariant 11
  • 19. PROTOCOL BEHAVIOR MODELS No parameters pop push push Stack S0 S1 pop Result type pop State push pop size top Observer Abstraction S0 — EmptyStackException — EmptyStackException S1 — — — — Modifier Behavior Abstraction S0 Variant Invariant Invariant Invariant S1 Variant Variant Invariant Invariant Effects on state 11
  • 20. A MORE COMPLEX EXAMPLE void putNextEntry(Entry entry); void write(String data); void close(); StorageService Exception thrown on not allowed operations Set-like behavior and complex interaction protocol 12
  • 21. INITIAL MODEL* c, w w, pE S2 c c, w, pE pE c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException *derived from Modifier Behavior Abstraction test cases S0 Invariant Variant Invariant containing S1 Variant Variant Invariant S2 Variant Invariant Invariant entries e, f S3 Variant Variant Invariant and writing S4 Variant Invariant Invariant “0” 13 S5 Invariant Invariant Invariant
  • 22. INITIAL MODEL* c, w w, pE S2 c c, w, pE pE c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 First entry inserted Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException *derived from Modifier Behavior Abstraction test cases S0 Invariant Variant Invariant containing S1 Variant Variant Invariant S2 Variant Invariant Invariant entries e, f S3 Variant Variant Invariant and writing S4 Variant Invariant Invariant “0” 13 S5 Invariant Invariant Invariant
  • 23. INITIAL MODEL* blocks write Duplicate entry c, w w, pE S2 c c, w, pE pE c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 First entry inserted Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException *derived from Modifier Behavior Abstraction test cases S0 Invariant Variant Invariant containing S1 Variant Variant Invariant S2 Variant Invariant Invariant entries e, f S3 Variant Variant Invariant and writing S4 Variant Invariant Invariant “0” 13 S5 Invariant Invariant Invariant
  • 24. INITIAL MODEL* blocks write Duplicate entry c, w w, pE S2 c c, w, pE pE c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 First entry inserted Two valid entries inserted Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException *derived from Modifier Behavior Abstraction test cases S0 Invariant Variant Invariant containing S1 Variant Variant Invariant S2 Variant Invariant Invariant entries e, f S3 Variant Variant Invariant and writing S4 Variant Invariant Invariant “0” 13 S5 Invariant Invariant Invariant
  • 25. INITIAL MODEL* blocks write Duplicate entry c, w w, pE S2 c c, w, pE pE c pE c No more valid S S0 S1 pE S4 S5 entries pE pE w, pE available? w c w S3 First entry inserted Two valid entries inserted Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException *derived from Modifier Behavior Abstraction test cases S0 Invariant Variant Invariant containing S1 Variant Variant Invariant S2 Variant Invariant Invariant entries e, f S3 Variant Variant Invariant and writing S4 Variant Invariant Invariant “0” 13 S5 Invariant Invariant Invariant
  • 26. EXAMPLE Let’s use the model and update it at runtime! 14
  • 27. MONITORING Behavior Models Execution traces are checked against the models 15
  • 28. MONITORING ISSUES Observed traces may not be enough Observations may affect component’s state 16
  • 29. ASSUMPTIONS Behavior Models Clones available to the monitor 17
  • 30. VIOLATION DETECTION Execution Protocol Trace Behavior Model 18
  • 31. CHECKING THE PROTOCOL OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.putNextEntry(a) - S1 c pE c s.putNextEntry(a) - ? S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 19
  • 32. CHECKING THE PROTOCOL OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.putNextEntry(a) - S1 c pE c s.putNextEntry(a) - ? S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 19
  • 33. CHECKING THE PROTOCOL OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.putNextEntry(a) - S1 c pE c s.putNextEntry(a) - ? S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 19
  • 34. CHECKING THE PROTOCOL OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.putNextEntry(a) - S1 c pE c s.putNextEntry(a) - ? S S0 S1 pE S4 S5 pE pE w, pE It depends on the w w S3 c outcome of next Legend: State close S:StorageService, w:write, c:close, pE:putNextEntry putN extEntry write operations S0 ZipException Observer Abstraction — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — Check on the clone S4 S5 — — ZipException IOException Modifier Behavior Abstraction ZipException IOException results of a S0 S1 Invariant Variant Variant Variant Invariant Invariant discriminating operation S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant with known instances S5 Invariant Invariant Invariant 19
  • 35. PROTOCOL VIOLATION (1) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE S1 pE s.putNextEntry(a) - c pE c s.putNextEntry(a) - S2 S S0 S1 pE S4 S5 pE pE w, pE s.putNextEntry(b) - S2 w c w S3 s.write(data) - ? Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 20
  • 36. PROTOCOL VIOLATION (1) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE S1 pE s.putNextEntry(a) - c pE c s.putNextEntry(a) - S2 S S0 S1 pE S4 S5 pE pE w, pE s.putNextEntry(b) - S2 w c w S3 s.write(data) - ? Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 20
  • 37. PROTOCOL VIOLATION (1) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE S1 pE s.putNextEntry(a) - c pE c s.putNextEntry(a) - S2 S S0 S1 pE S4 S5 pE pE w, pE s.putNextEntry(b) - S2 w c w S3 s.write(data) - ? Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 20
  • 38. PROTOCOL VIOLATION (1) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE S1 pE s.putNextEntry(a) - c pE c s.putNextEntry(a) - S2 S S0 S1 pE S4 S5 pE pE w, pE s.putNextEntry(b) - S2 w c w S3 s.write(data) - ? Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — As seen before the test S2 S3 S4 — — — [−, ZipException] ZipException ZipException — ZipException ZipException scope was too small, but S5 — IOException Modifier Behavior Abstraction IOException we can fix the model! S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 20
  • 39. PROTOCOL VIOLATION (2) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.write(“”) - ? c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 21
  • 40. PROTOCOL VIOLATION (2) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.write(“”) - ? c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 21
  • 41. PROTOCOL VIOLATION (2) OPERATION OUTCOME STATE s = StorageService(); - S0 c, w w, pE S2 c c, w, pE pE s.write(“”) - ? c pE c S S0 S1 pE S4 S5 pE pE w, pE w c w S3 Legend: S:StorageService, w:write, c:close, pE:putNextEntry ZipException expected! State close putN extEntry Observer Abstraction write S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException Special values are S3 S4 S5 — — — ZipException ZipException IOException — ZipException IOException unknown in advance S0 Invariant Modifier Behavior Abstraction Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 21
  • 42. VIOLATION INTERPRETATION Protocol Behavior Model Behavioral Equivalence Model 22
  • 43. IS THE VIOLATION A CHANGE? We can tell it replaying the traces contained in the Behavioral Equivalence Model Everything still works: Different results: previously unobserved behavior change detected 23
  • 44. MODEL UPDATES Old Behavior Equivalence Model 24
  • 45. MODEL UPDATES Old Behavior Equivalence Model Trace exposing new behavior 24
  • 46. MODEL UPDATES Old Behavior Equivalence Model Extended scopes for existing models Trace exposing new behavior 24
  • 47. MODEL UPDATES Old Behavior Equivalence Model Set of Behavior Extended scopes Equivalence for existing models Models Trace exposing new behavior 24
  • 48. MODEL UPDATES Old Behavior Equivalence Model Set of Behavior Extended scopes Equivalence for existing models Models Trace exposing new behavior Incremental Add only new information 24
  • 49. MODEL UPDATES Old Behavior Equivalence Model Set of Behavior Extended scopes Updated Protocol Equivalence for existing models Behavior Model Models Trace exposing new behavior Incremental Add only new information 24
  • 50. UPDATED MODEL c, w pE, w c pE w, pE pE c S S0 S1 pE S2 c S5 pE pE c pE c, w, pE S3 S4 w w, pE Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 25
  • 51. UPDATED MODEL c, w pE, w c pE w, pE pE c S S0 S1 pE S2 c S5 pE pE c First entry inserted pE c, w, pE S3 S4 w w, pE Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 25
  • 52. UPDATED MODEL c c, w pE, w Duplicate entry pE w, pE pE c S S0 S1 pE S2 c S5 pE pE c First entry inserted pE c, w, pE S3 S4 w w, pE Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 25
  • 53. UPDATED MODEL c c, w pE, w Duplicate entry pE w, pE pE c S S0 S1 pE S2 c S5 pE pE c First entry inserted pE c, w, pE S3 S4 w w, pE Scope effects Legend: S:StorageService, w:write, c:close, pE:putNextEntry State close putN extEntry write Observer Abstraction S0 ZipException — ZipException S1 — [−, ZipException] — S2 — [−, ZipException] ZipException S3 — ZipException — S4 — ZipException ZipException S5 — IOException IOException Modifier Behavior Abstraction S0 Invariant Variant Invariant S1 Variant Variant Invariant S2 Variant Invariant Invariant S3 Variant Variant Invariant S4 Variant Invariant Invariant S5 Invariant Invariant Invariant 25
  • 54. CHANGE DETECTION Effectiveness of change detection proved injecting faults in the component Always working and always exceptional implementation for each method 26
  • 55. CONCLUSIONS ✓Behavioral Models at run time ✓Specification of a software component ✓Functional change detection 27
  • 56. FUTURE WORK •Relax assumptions •Tackle scope effects •Minimization of the scope size •Model interacting objects 28

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n