Skip to main content
QUICK REVIEW

[Paper Review] Designing Asynchronous Multiparty Protocols with Crash-Stop Failures

Adam D. Barwell, Ping Hou|arXiv (Cornell University)|Jan 1, 2023
Distributed systems and fault toleranceComputer Science4 citations
TL;DR

This paper presents Teatrino, a code generation toolchain that extends asynchronous multiparty session types with crash-stop failure semantics, enabling type-safe, deadlock-free, and live distributed protocols in Scala. It integrates formal global and local type semantics with crash-handling branches, ensuring correctness by construction through integration with Scribble and Effpi, and demonstrates practical feasibility with sub-3ms code generation times across diverse protocols.

ABSTRACT

Session types provide a typing discipline for message-passing systems. However, most session type approaches assume an ideal world: one in which everything is reliable and without failures. Yet this is in stark contrast with distributed systems in the real world. To address this limitation, we introduce Teatrino, a code generation toolchain that utilises asynchronous multiparty session types (MPST) with crash-stop semantics to support failure handling protocols. We augment asynchronous MPST and processes with crash handling branches. Our approach requires no user-level syntax extensions for global types and features a formalisation of global semantics, which captures complex behaviours induced by crashed/crash handling processes. The sound and complete correspondence between global and local type semantics guarantees deadlock-freedom, protocol conformance, and liveness of typed processes in the presence of crashes. Our theory is implemented in the toolchain Teatrino, which provides correctness by construction. Teatrino extends the Scribble multiparty protocol language to generate protocol-conforming Scala code, using the Effpi concurrent programming library. We extend both Scribble and Effpi to support crash-stop behaviour. We demonstrate the feasibility of our methodology and evaluate Teatrino with examples extended from both session type and distributed systems literature.

Motivation & Objective

  • To close the gap between theoretical session type systems and real-world distributed systems by modeling crash-stop failures in asynchronous multiparty protocols.
  • To provide a practical, scalable code generation toolchain that ensures communication safety, deadlock-freedom, and liveness in the presence of crashes.
  • To extend the Scribble protocol description language and Effpi concurrency library with crash detection and handling capabilities without requiring user-level syntax extensions.
  • To demonstrate that formal guarantees from global type semantics can be preserved in asynchronous systems with crash-stop failures, restoring decidability compared to prior asynchronous approaches.

Proposed method

  • Extends asynchronous multiparty session types with crash-handling branches in global types, modeling crash-stop failures where processes may stop interacting arbitrarily.
  • Introduces a formal global semantics that captures crash-induced behaviors, ensuring sound and complete correspondence between global and local types.
  • Employs a top-down methodology: global types specify protocols and are projected into local types per role, guaranteeing protocol conformance and correctness.
  • Generates type-safe Scala code using the Effpi library, leveraging Scala 3's match types and dependent function types to encode session types at the type level.
  • Enhances Scribble to express global types with crash-handling branches and extends Effpi to support crash detection and recovery in generated code.
  • Implements a three-phase code generation pipeline: parsing Scribble input, generating an EffpiIR intermediate representation, and emitting Scala code with role-specific functions and pattern matching for branches.

Experimental results

Research questions

  • RQ1Can crash-stop failures be formally modeled within asynchronous multiparty session types while preserving key guarantees like deadlock-freedom and liveness?
  • RQ2Does extending global types with crash-handling branches allow for a sound and complete correspondence between global and local type semantics in an asynchronous setting?
  • RQ3Can a practical toolchain be built that generates correct-by-construction, crash-resilient distributed systems from high-level protocol specifications?
  • RQ4How does the inclusion of crash-handling branches affect code generation performance and scalability in real-world protocols?
  • RQ5To what extent can existing session type tooling (Scribble and Effpi) be extended to support failure handling without requiring language-level syntax extensions?

Key findings

  • Teatrino generates correct-by-construction Scala code for distributed protocols with crash-stop failure handling, ensuring communication safety, deadlock-freedom, and liveness.
  • All protocol variants were generated in under 3ms, with total generation times ranging from 0.18ms to 2.42ms across 15 examples, demonstrating practical performance.
  • Code generation time correlates strongly with the number of role-implementing functions, which increases with meaningful branching (i.e., multiple non-crash-handling choices), but also scales with protocol size.
  • Parsing and code generation are the most expensive phases, with code generation requiring at least two traversals of the EffpiIR representation, suggesting potential for optimization.
  • The toolchain successfully handles complex protocols such as OAuth and Circuit Breaker variants, generating up to 14 role-implementing functions and supporting nested recursion and choice structures.
  • EffpiIR generation scales with protocol size and merging complexity during type projection, and is less expensive than parsing or code generation, indicating it is a lightweight transformation step.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.