Skip to main content
Log in

Practical interruptible conversations: distributed dynamic verification with multiparty session types and Python

  • Published:
Formal Methods in System Design Aims and scope Submit manuscript

Abstract

The rigorous and comprehensive verification of communication-based software is an important engineering challenge in distributed systems. Drawn from our industrial collaborations (Ocean Observatories Initative, http://www.oceanobservatories.org/, JBoss Savara Project, http://www.jboss.org/savara) on Scribble, a choreography description language based on multiparty session types, and its theoretical foundations (Honda et al., in POPL, pp 273–284, 2008), this article proposes a dynamic verification framework for structured interruptible conversation programming. We first present our extension of Scribble to support the specification of asynchronously interruptible conversations. We then implement a concise API for conversation programming with interrupts in Python that enables session types properties to be dynamically verified for distributed processes. Finally, we expose the underlying theory of our interrupt mechanism, studying its syntax and semantics, its integration in MPST theory and proving the correctness of our design. Our framework ensures the global safety of a system in the presence of asynchronous interrupts through independent runtime monitoring of each endpoint, checking the conformance of the local execution trace to the specified protocol. The usability of our framework for describing and verifying choreographic communications has been tested by integration into the large scientific cyberinfrastructure developed by the Ocean Observatories Initiative. Asynchronous interrupts have proven expressive enough to represent and verify their main classes of communication patterns, including asynchronous streaming and various timeout-based protocols, without introducing any implicit synchronisations. Benchmarks show conversation programming and monitoring can be realised with little overhead.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15

Similar content being viewed by others

References

  1. Allan C, Avgustinov P, Christensen AS, Hendren L, Kuzins S, Lhoták O, de Moor O, Sereni D, Sittampalam G, Tibble J (2005) Adding trace matching with free variables to aspectj. SIGPLAN Not 40(10):345–364

    Article  Google Scholar 

  2. Advanced Message Queuing protocols (AMQP) homepage. http://jira.amqp.org/confluence/display/AMQP/Advanced+Message+Queuing+Protocol

  3. Ancona D, Drossopoulou S, Mascardi V (2012) Automatic generation of self-monitoring mass from multiparty global session types in Jason. In: DALT. Springer, Berlin

  4. Avgustinov P, Tibble J, de Moor O (2007) Making trace monitors feasible. SIGPLAN Not 42(10):589–608

    Article  Google Scholar 

  5. Baresi L, Ghezzi C, Guinea S (2004) Smart monitors for composed services. In: ICSOC. ACM, New York, pp 193–202

  6. Bettini L, et al. (2008) Global progress in dynamically interleaved multiparty sessions. In: CONCUR. LNCS, vol 5201. Springer, Berlin, pp 418–433

  7. Bocchi L, Chen T-C, Demangeon R, Honda K, Yoshida N (2013) Monitoring networks through multiparty session types. In: FMOODS. LNCS, vol 7892. Springer, Berlin, pp 50–65

  8. Bocchi L, Laneve C, Zavattaro G (2003) A calculus for long-running transactions. In: FMOODS. LNCS, vol 2884, Springer, Berlin, pp 124–138

  9. Boreale M, Bruni R, Nicola R, Loreti M (2008) Sessions and pipelines for structured service programming. In: Barthe G, Boer F (eds) FMOODS. LNCS, vol 5051. Springer, Berlin, pp 19–38

  10. Cambronero M-E et al (2011) Validation and verification of web services choreographies by using timed automata. J Log Algebraic Program 80(1):25–49

    Article  MATH  Google Scholar 

  11. Capecchi S, Giachino E, Yoshida N (2010) Global escape in multiparty session. In: FSTTCS. LNCS, vol 8, pp 338–351

  12. Carbone M (2009) Session-based choreography with exceptions. Electron Notes Theor Comput Sci 241:35–55

    Article  Google Scholar 

  13. Carbone M, Honda K, Yoshida N (2008) Structured interactional exceptions in session types. In: CONCUR. LNCS, vol 5201. Springer, Berlin, pp 402–417

  14. W3C WS-CDL. http://www.w3.org/2002/ws/chor/

  15. Chen T-C (2013) Theories for session-based governance for large-scale distributed systems. PhD thesis, Queen Mary, University of London, London

  16. Deniélou P-M, Yoshida N (2012) Multiparty session types meet communicating automata. In: ESOP. LNCS. Springer, Berlin, pp 194–213

  17. Gan Y, Chechik M, Nejati S, Bennett J, O’Farrell B, Waterhouse J (2007) Runtime monitoring of web service conversations. In: CASCON. ACM, New York, pp 42–57

  18. Ghezzi C, Guinea S (2007) Run-time monitoring in service-oriented architectures. In: Test and analysis of web services. Springer, Berlin, pp 237–264

  19. Hallé S, Bultan T, Hughes G, Alkhalaf M, Villemaire R (2010) Runtime verification of web service interface contracts. Computer 43(3):59–66

    Article  Google Scholar 

  20. Honda K, Yoshida N, Carbone M (2008) Multiparty Asynchronous Session Types. In: POPL. ACM, New York, pp 273–284

  21. Hu R, Kouzapas D, Pernet O, Yoshida N, Honda K (2010) Type-safe eventful sessions in Java. In: ECOOP’10. LNCS, vol 6183. Springer-Verlag, New York, pp 329–353

  22. Hu R, Neykova R, Yoshida N, Demangeon R, Honda K (2013) Practical interruptible conversations—distributed dynamic verification with session types and python. In: RV. LNCS, vol 8174. Springer, Berlin, pp 130–148

  23. Jakšić S, Padovani L (2012) Exception handling for copyless messaging. In: PPDP. ACM, New York, pp 151–162

  24. Jass Home Page. http://modernjass.sourceforge.net/

  25. Jboss Savara project. http://www.jboss.org/savara/downloads

  26. Krüger IH, Meisinger M, Menarini M (2007) Runtime verification of interactions: from mscs to aspects. In: RV, RV. Springer-Verlag, Berlin, pp 63–74

  27. Krüger IH, Meisinger M, Menarini M (2010) Interaction-based runtime verification for systems of systems integration. J Log Comput 20(3):725–742

    Article  Google Scholar 

  28. Lapadula A, Pugliese R, Tiezzi F (2007) A calculus for orchestration of web services. In: ESOP. LNCS, vol 4421. Springer, Berlin, pp 33–47

  29. LAVANA project. http://www.cs.um.edu.mt/svrg/Tools/LARVA/

  30. Li Z, Han J, Jin Y (2005) Pattern-based specification and validation of web services interaction properties. In: ICSOC’05, pp 73–86

  31. Li Z, Jin Y, Han J (2006) A runtime monitoring and validation framework for web service interactions. In: ASWEC, IEEE

  32. Minsky NH, Ungureanu V (2000) Law-governed interaction: a coordination and control mechanism for heterogeneous distributed systems. TOSEM 9:273–305

    Article  Google Scholar 

  33. Ng N, Yoshida N, Honda K (2012) Multiparty session c: Safe parallel programming with message optimisation. In: TOOLS. LNCS, vol 7304. Springer, Berlin, pp 202–218

  34. Ocean Observatories Initative. http://www.oceanobservatories.org/

  35. OOI codebase. https://github.com/ooici/pyon

  36. Scribble extensions for OOI integration. https://confluence.oceanobservatories.org/display/CIDev/Identify+required+Scribble+extensions+for+advanced+scenarios+of+R3+COI

  37. OOI, COI governance framework. https://confluence.oceanobservatories.org/display/syseng/CIAD+COI+OV+Governance+Framework

  38. Rubira CMF, Wu Z (1995) Fault tolerance in concurrent object-oriented software through coordinated error recovery. In: IEEE Computer Society, FTCS ’95, Washington, DC, pp 499–509

  39. Salaün G (2010) Analysis and verification of service interaction protocols - a brief survey. In: TAV-WEB. EPTCS, vol 35, pp 75–86

  40. JBoss Savara Project. http://www.jboss.org/savara

  41. Scribble Project homepage. http://www.scribble.org

  42. Full version of this paper. http://www.doc.ic.ac.uk/rn710/mon

  43. Tartanoglu F, Issarny V, Romanovsky A, Levy N (2003) Coordinated forward error recovery for compositeweb services. In: IEEE symposium on reliable distributed systems, pp 167–176

  44. Vieira HT, Caires L, Seco JC (2008) The conversation calculus: a model of service-oriented computation. In: ESOP. LNCS, vol 4960. Springer, Berlin, pp 269–283

  45. Xu J, Romanovsky A, Randell B (1998) Coordinated exception handling in distributed object systems: From model to system implementation. In: ICDCS, IEEE Computer Society, Washington, DC, pp 12–21

  46. Zhang W, Serban C, Minsky N (2007) Establishing global properties of multi-agent systems via local laws. In: E4MAS, pp 170–183

Download references

Acknowledgments

We thank Gary Brown, Matthew Arrot and the Scribble team for discussions and collaborations. This work has been partially sponsored by the Ocean Observatories Initiative, VMWare, Pivotal, Cognizant, EPSRC EP/K034413/1, EP/K011715/1, EP/L00058X/1, EP/G015635/1 and EP/G015481/1, EU project FP7-612985 UpScale and ICT COST Action IC1201 BETTY.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Raymond Hu.

Appendix: Proofs

Appendix: Proofs

This appendix includes a full proof of Theorem 5.3.3.

Theorem 5.3

(Session fidelity) If \(\varDelta \) corresponds to \(G_1,\dots ,G_n\) and \(\varDelta ,\varepsilon \rightarrow ^* \varDelta ',\varSigma '\), there exists \(\varDelta ',\varSigma ' \rightarrow ^*\varDelta '',\varepsilon \) such that \(\varDelta ''\) corresponds to \(G''_1,\dots ,G''_n\) which is a derivative of \(G_1,\dots ,G_n\).

Proof

We prove that if there is an intermediate correspondence between \(\varDelta ,\varSigma \) and \(G_1,\dots ,G_n\) and if \(\varDelta , \varepsilon \rightarrow \varDelta ',\varSigma '\), then there is an intermediate correspondence \(\varDelta ''\) and \(G''_1,\dots ,G''_n\) which is a derivative of \(G_1,\dots ,G_n\).

We use \(\varOmega , \varTheta \) alongside \(\varDelta \) to denote session environment. According to the derivative definition above, we extend the notion of evaluation contexts to global types.

Case \((\mathsf {Out})\) is trivial from the first rule of intermediate correspondence.

Case \((\mathsf {EOut})\). We have \(\varDelta = \varTheta , s[\mathtt {r}]:E^{\mathtt {c}_0}[\{\!| T |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r} ? l \rangle ; T']\). Correspondence gives

  • \(\varDelta = \varTheta _0, s[\mathtt {r}]:E^{\mathtt {c}_0}[\{\!| T |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r} ? l \rangle ; T'], \prod _{1 \le i \le n} s[\mathtt {r}_i]:{E_{i}}^{\mathtt {c}_i}[\{\!| T_i |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r} ? l \rangle ; T'_i]\) and

  • \(\varSigma = \varSigma _1, \varSigma _0\) with \(\varTheta _0;\varSigma _0\)

corresponding to \(G_2, \dots , G_n\) and \((\varDelta - \varTheta ');\varSigma _1\) corresponding to \(G_1\). We know that \(\varSigma ' = \varSigma _0, \prod _{1 \le i \le n} s[\mathtt {r}_i]:h_i.\mathtt {c}^{\mathtt {I}}[\mathtt {r},\mathtt {r}_i]\langle l \rangle \). Concluding is easy using the second rule of intermediate correspondence with \(k = 0\).

Case \((\mathsf {In})\). We assume \(\varDelta = \varTheta , s[\mathtt {r}']:E^{\mathtt {c}}[\mathtt {r}?\{l_i.T_i\}]\) and \(\varSigma = \varSigma _0, s[\mathtt {r}']:h.\mathtt {c}[\mathtt {r},\mathtt {r}']\langle l_j \rangle \). We know there exists \(G_1, \dots G_n\) and \(\varDelta _0\) such that \(\varDelta _0 = \varTheta _1, \dots , \varTheta _n\) with \(\varTheta _i = \bigcup _{\mathtt {r}\in G_i} G_i \uparrow ^\mathtt {r}\).

Without loss of generality we have \(\varTheta _1 = s[\mathtt {r}']:E^{\mathtt {c}}[\mathtt {r}?\{l_i.T_i\}], \varTheta '_1\). By the rules of projection, it means \(G_1 = \mathtt {r}{\rightarrow } \mathtt {r}' \!:\! \{ l_j. G_j \} _{j\in {J}}\), implying \(\varTheta '_1 = s[\mathtt {r}']:E^{\mathtt {c}'}[\mathtt {r}?\{l_i.T_i\}], \varTheta ''_1\). So we have

$$\begin{aligned} \varDelta ' = \varOmega , s[\mathtt {r}]:E^{\mathtt {c}}[T_j], s[\mathtt {r}']: E^{\mathtt {c}'}[\mathtt {r}?\{l_i.T_i\}], \varTheta '_1 \hbox { and } \varSigma ' = \varSigma _0, s[\mathtt {r}']:h.\mathtt {c}[\mathtt {r},\mathtt {r}']\langle l_j \rangle . \end{aligned}$$

We apply use \((\mathsf {In})\) to conclude, using the projection rule on \(G_j\).

Case \((\mathsf {EIn_1})\). We pose \(\mathtt {r}= \mathtt {r}_{k+1}\). We have \(\varSigma = \varSigma ', \mathtt {c}^{\mathtt {I}}[\mathtt {r}_0,\mathtt {r}_{k+1}]\langle l \rangle .h\) and \(\varphi (\varSigma ',\mathtt {c})\). Then let us define \(\varDelta = \varTheta , s[\mathtt {r}_{k+1}]:E^{\mathtt {c}_0}[\{\!| T_{k+1} |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}_0 ? l \rangle ; T']\) and \(\varDelta '= \varTheta ,\, s[\mathtt {r}_{k+1}]E^{\mathtt {c}_0}[\{\!| {\parallel } T {\parallel } |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}_0 ? l \rangle ; T']\). Without loss of generality we suppose \(\varDelta ; \varSigma \) corresponds to \(G\). We deduce that

  • \(G = F{\{\!| G_0 |\!\}^{\mathtt {c}} \langle l \ \mathrm {by}\ \mathtt {r} \rangle ; G'}{\_}\);

    \(\varDelta = s[\mathtt {r}_0]: E^{\_}[\{\!| T |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_] , \prod _{1 \le i \le k} s[\mathtt {r}_i]: {E_{i}}^{\_}[\{\!| {\parallel } T_i {\parallel } |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_]\), \(\prod _{k+1 \le j \le n} s[\mathtt {r}_{j}]: {E_{i}}^{\_}[\{\!| T_{j} |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_]\); and

  • \(\varSigma = \varSigma _0, \prod _{k+1 \le j \le n} s[\mathtt {r}_{j}]: \mathtt {c}^{\mathtt {I}}[\mathtt {r},\mathtt {r}_{j}]\langle l \rangle .h_j\).

Thus we have

  • \(\varDelta ' = s[\mathtt {r}_0]: E^{\_}[\{\!| T |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_] , \prod _{1\le i \le k+1} s[\mathtt {r}_i]: {E_{i}}^{\_}[\{\!| {\parallel } T_i {\parallel } |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_], \prod _{k+2 \le j \le n} s[\mathtt {r}_{j}]: {E_{i}}^{\_}[\{\!| T_{j} |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_]\) and

  • \(\varSigma ' = \varSigma _0, \prod _{k+2 \le j \le n} s[\mathtt {r}_{j}]: \mathtt {c}^{\mathtt {I}}[\mathtt {r},\mathtt {r}_{j}]\langle l \rangle .h_j\).

We conclude using the second definition of intermediate correspondence with \(k=k+1\).

Case \((\mathsf {EIn_2})\). We pose \(\mathtt {r}_n = \mathtt {r}\), we have \(\varSigma = \varSigma ', \mathtt {c}^{\mathtt {I}}[\mathtt {r}_0,\mathtt {r}_{n}]\langle l \rangle .h\) and \(\lnot \varphi (\varSigma ',\mathtt {c})\). Then \(\varDelta = \varTheta , s[\mathtt {r}_{n}]:E^{\mathtt {c}_0}[\{\!| T_n |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}_0 ? l \rangle ; T']\) and \(\varDelta '= \varTheta , s[\mathtt {r}_{k+1}]E^{\mathtt {c}_0}[\{\!| {\parallel } T {\parallel } |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}_0 ? l \rangle ; T']\). Without loss of generality we suppose \(\varDelta ; \varSigma \) corresponds to \(G\). We deduce that

  • \(G = F{\{\!| G_0 |\!\}^{\mathtt {c}} \langle l \ \mathrm {by}\ \mathtt {r} \rangle ; G'}{\_}\),

  • \(\varDelta = s[\mathtt {r}_0]: E^{\_}[\{\!| T |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_] , \prod _{1 \le i \le n-1} s[\mathtt {r}_i]: {E_{i}}^{\_}[\{\!| {\parallel } T_i {\parallel } |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_], s[\mathtt {r}_n]: {E_{n}}^{\_}[\{\!| T_n |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_] \) and

  • \(\varSigma = \varSigma _0, s[\mathtt {r}_{n}]: \mathtt {c}^{\mathtt {I}}[\mathtt {r},\mathtt {r}_n]\langle l \rangle .h\).

From the semantics, we also have

  • \(\varDelta ' = s[\mathtt {r}_0]: E^{\_}[\{\!| \mathtt {Eend} |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_] , \prod _{1 \le i \le n} s[\mathtt {r}_i]: {E_{i}}^{\_}[\{\!| \mathtt {Eend} |\!\}^{\mathtt {c}} \;\triangleright \; \langle \mathtt {r}' ? l \rangle ; \_]\) and

  • \(\varSigma = \varSigma _0, s[\mathtt {r}_{n}]:h\).

We use the hypothesis and the intermediate correspondence rule to prove that \(\varDelta ';\varSigma '\) corresponds to \(F{\{\!| \mathtt {Eend} |\!\}^{\mathtt {c}} \langle l \ \mathrm {by}\ \mathtt {r} \rangle ; G'}{\_}\) which is a derivative of \(G\). We conclude.

Case \((\mathsf {Disc'})\) is easy using the first definition of the intermediate correspondence.

Case \((\mathsf {EDisc_1})\) is similar to \((\mathsf {EIn_1})\).

Case \((\mathsf {EDisc_2})\) is similar to \((\mathsf {EIn_2})\).

We then prove the following progress property: if \(\varDelta ,\varSigma \) is in intermediate correspondence with \(G_1,\dots ,G_n\), and \(\varSigma \ne \varepsilon \) then there exist \(\varDelta ',\varSigma '\) with \(\varSigma '\) strictly smaller than \(\varSigma \). We prove it as follows:

  • if \(\varSigma \) contains \(\mathtt {c}[\mathtt {r},\mathtt {r}']\langle l \rangle \), we use the weak projection definitions to prove that \(\varDelta \) contains either \(s[\mathtt {r}']:E^{\mathtt {c}}[\mathtt {r}?\{l_i.T_i\}{}]\) or \(s[\mathtt {r}']:E^{\mathtt {c}'}[\{\!| {\parallel } T {\parallel } |\!\}^{]} \;\triangleright \; \langle \mathtt {r} ? l \rangle ; \_\) with \(T\) containing \(\mathtt {r}?\{l_i.T_i\}\). We conclude by applying \((\mathsf {In})\) or \((\mathsf {Disc'})\).

  • otherwise \(\varSigma \) contains \(\mathtt {c}^{\mathtt {I}}[\mathtt {r},\mathtt {r}']\langle l \rangle \) and we use the intermediate correspondence definition to discuss whether \(\mathtt {c}\) is inside an interrupted scope or not and then whether \(\varphi (\varSigma _0,\)) or not, the we conclude by applying \((\mathsf {EIn1}),\, (\mathsf {EIn2}),\, (\mathsf {EDisc1})\) or \((\mathsf {EDisc2})\).

By using these properties, we conclude the proof.\(\square \)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Demangeon, R., Honda, K., Hu, R. et al. Practical interruptible conversations: distributed dynamic verification with multiparty session types and Python. Form Methods Syst Des 46, 197–225 (2015). https://doi.org/10.1007/s10703-014-0218-8

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10703-014-0218-8

Keywords

Navigation