Top Banner
1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio Montesi and Gianluigi Zavattaro
34

1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Mar 31, 2015

Download

Documents

Shelby Randal
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

1

Ivan LaneseComputer Science Department

University of BolognaItaly

Managing faults and compensations in SOCK

Joint work with Claudio Guidi, Fabrizio Montesi and Gianluigi Zavattaro

Page 2: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Roadmap

SOCK

Extension for faults and

compensations

The automotive case study

Conclusive remarks

Page 3: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Roadmap

SOCK

Extension for faults and

compensations

The automotive case study

Conclusive remarks

Page 4: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

SOCK (Service Oriented Computing Kernel)

One of the core calculi in Sensoria The one that more closely follows current technologies Explores service interactions

– based on one-way and request-response primitives – coordinated using the correlation sets mechanism

Has a 3 layers structure– Service behaviour layer: defines the basic behaviours of

service instances– Service engine layer: deals with state, correlation sets and

instantiation of sessions– Service system layer: composes located engines into a

network

Page 5: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Service behaviour syntax

² : :=s j o(~x) j or (~x;~y;P )

² ::=s j o@z(~y) j or@z(~y;~x)

P ::= 0 Empty process² Output² Inputx := e AssignmentÂ?P : Q If-then-elseP ;Q Sequential compositionP

i2W ²i ;Pi Non-deterministic choice ­ P IterationP jQ Parallel composition

Page 6: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Higher layers

A service engine is:

where c is a correlation set, Pi are processes and Si states

A service system is:

where li are locations

We will concentrate on the service behaviour layer, where error handling is managed

Y ::=c. Pd[(P1;S1)j : : : j(Pn ;Sn)]

E ::=Y1@l1jj : : : jjYn@ln

Page 7: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Roadmap

SOCK

Extension for faults and

compensations

The automotive case study

Conclusive remarks

Page 8: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Error handling

Safe composition of services requires to deal with faults– No guarentee on components’ behaviour because of loose coupling– Disconnections, message losses, …

A fault is an abnormal situation that forbids the continuation of the activity– An activity that generates a fault is terminated

Faults should be managed so that the whole system reaches a consistent state

Different mechanisms are commonly used– Fault handlers: specify how to recover from a fault– Termination handlers: specify how to terminate an ongoing activity when

reached by a fault from a parallel activity– Compensation handlers: specify how to compensate a successfully

terminated activity if requested for fault recovery

Page 9: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Linguistic extensions

We add some constructs to SOCK to manage faults

At runtime the scope will also contain the active handlers: {P;H}q

P ::= :: : Standard operatorsfP gq Scopeinst(u;P ) Install handlerthrow(f ) Throw a faultcomp(q) Compensatea scope

Page 10: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

The scope hierarchy

P H

q

P H

q

P H

q

P H

q

P H

q

Page 11: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Throwing a fault

q1

q2

(f,Q)

Throw

­­­(f)

(q2,T2)

(q1,T1)

Page 12: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Throwing a fault

q1

q2

(f,Q)

(q2,T2)

(q1,T1)

f

Page 13: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Throwing a fault

T1

q1

T2

q2

(f,Q)

f

Page 14: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Throwing a fault

T1

q1

T2

q2

Q

f

Page 15: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Killing activities

When a fault propagates activities are killed but For parallel activities the termination handler (if

present) is executed For ongoing solicit-responses the fault is sent to the

partner– The same fault is raised at the partner side

– A solicit-response always receives a response, either normal or faulty

Activities related to error recovery cannot be killed– Handlers, …

Page 16: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Installing an handler

Inst

(f,Q)

Handlers can be

installed dynamically

Page 17: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Installing an handler

(f,Q)Handlers can be

installed dynamically

Page 18: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Dynamic installation of handlers

Allowed for fault and termination handlers New handlers replace the older ones Dynamic installation of termination handlers allows to

update the handler as far as the activity progresses– No need to add auxiliary scopes

The last defined termination handler becomes the compensation handler when the activity terminates

Available handlers are installed before any fault is managed– Always the most updated handler is used

Page 19: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Installing compensation handlers

q

q’

Inst

(q,Q)

Page 20: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Installing compensation handlers

q

(q,Q)

Q­terminates

q’

Page 21: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Installing compensation handlers

(q,Q)

Handlers­in­q’

can­compensate

q­using­comp(q)

q’

Page 22: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Compensation handlers

Are the last available termination handlers Allow to undo the effect of a successfully terminated

activity Should be activated explicitly by comp(q) Only other handlers can do it

Page 23: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Roadmap

SOCK

Extension for faults and

compensations

The automotive case study

Conclusive remarks

Page 24: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Automotive case study

A car failure forces the car to stop The car service system looks for

– A garage to repair the car

– A tow truck to take the car to the garage

– A car rental to take the driver home

The suitability of the services is checked The services are booked and paid via a bank

Page 25: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Modeling the automotive case study in SOCK

CARP ::= RP j (GP ;TP )

RP ::= book@R(Gcoords;hRacc;R idi );pay@B(hRpr ices;R id;Racci ;Rpayid)

GP ::= book@G(f ailure;hGacc;Gidi );pay@B(hGpr ice;Gid;Gacci ;Gpayid)

TP ::= book@T(hCARcoords;Gi ;hTacc;Tidi );pay@B(hTpr ice;Tid;Tacci ;Tpayid)

Page 26: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Adding tow truck faults

CARP ::= finst(f T;comp(g) j comp(r));( RP j (GP ;TP ) )

gmainRP ::= f : : :grGP ::= f : : :ggTP ::= f

inst(f B ;comp(tb);throw(f T)); fbook@T(hCARcoords;Gi ;hTacc;Tidi );inst(tb;revbook@T(Tid))

gtb;pay@B(hTpr ice;Tid;Tacci ;Tpayid)gt

Page 27: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Screenshots from JOLIE

Page 28: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Screenshots from JOLIE

Page 29: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Roadmap

SOCK

Extension for faults and

compensations

The automotive case study

Conclusive remarks

Page 30: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Conclusions

Formal framework for error handling in SOC– Near to current technologies (BPEL)…

– … which have no formal semantics

Dynamic installation of handlers as main improvement– Allows to merge termination and compensation handlers

– Allows to update the termination handler as the activity progresses

Error situations do not spoil the solicit-response protocol– Either the fault or the normal answer is sent back

Page 31: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

A further idea

In WSDL faults can be sent only as answers to solicit-responses– SOCK follows the same approach

Callbacks (mutual invocation) can be used to model solicit-responses – The fault part cannot be mimicked faithfully

– Two different faults instead of the communication of the same one

This can be solved by allowing to send faults in notifications

Page 32: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Possible next steps

Check whether the approach can be applied to the other Sensoria core languages– COWS, SCC…

– They already have error-handling, but more “low-level”

Analyze the effect of faults on the relationship between choreography and orchestration

Page 33: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

End of talk

Page 34: 1 Ivan Lanese Computer Science Department University of Bologna Italy Managing faults and compensations in SOCK Joint work with Claudio Guidi, Fabrizio.

Adding car rental faults

RP ::= f( inst(f R;Rpayid 6= ? ?RrevpayP : 0) jinst(f B ;revbook@R(R id)) jinst(r;(R id = ? ?RbookHandlerP : RredirectP );RpayP ) );RbookP ; inst(r;RredirectP ;Rpayid = ? ?RpayP : 0);RpayP ; inst(r; f inst(f R;RrevpayP );RredirectP gr c)

gr