Timeout Asynchronous Session Types: Safe Asynchronous Mixed-Choice For Timed Interactions

Jonah Pears,Laura Bocchi,Maurizio Murgia,Andy King
2024-10-05
Abstract:Mixed-choice has long been barred from models of asynchronous communication since it compromises the decidability of key properties of communicating finite-state machines. Session types inherit this restriction, which precludes them from fully modelling timeouts -- a core property of web and cloud services. To address this deficiency, we present (binary) Timeout Asynchronous Session Types (TOAST) as an extension to (binary) asynchronous timed session types, that permits mixed-choice. TOAST deploys timing constraints to regulate the use of mixed-choice so as to preserve communication safety. We provide a new behavioural semantics for TOAST which guarantees progress in the presence of mixed-choice. Building upon TOAST, we provide a calculus featuring process timers which is capable of modelling timeouts using a $\mathtt{receive-after}$ pattern, much like Erlang, and capture the correspondence with TOAST specifications via a type system for which we prove subject reduction.
Logic in Computer Science
What problem does this paper attempt to address?
The core problem that this paper attempts to solve is: **Introduce mixed - choice in the asynchronous communication model to support timeouts while ensuring the security of communication and the executability of the protocol**. Specifically, the paper points out that in the traditional asynchronous communication model, due to the existence of mixed - choice, the decidability of key properties (such as deadlock - freedom) will be destroyed, so mixed - choice is usually prohibited. However, mixed - choice is crucial for modeling features such as timeouts, especially in Web and cloud computing services. To solve this problem, the author proposes **Timeout Asynchronous Session Types (TOAST)**, which is an extended binary asynchronous timed session type that allows the use of mixed - choice without sacrificing communication security. ### Main contributions: 1. **Introducing TOAST**: By adding time constraints to ensure the safety of mixed - choice, TOAST can support timeouts in an asynchronous environment. 2. **Providing a new process calculus**: Extend the existing timed session calculus to support the Erlang - style `receive - after` pattern for expressing timeouts. 3. **Introducing timers**: Add timers to the process calculus so that processes can choose different branches according to time conditions, thereby enhancing the expressive power of the system. 4. **Formal verification**: Prove the correspondence between TOAST and the process calculus through the type system and establish the Subject Reduction theorem. ### Problems solved: - **Safety of mixed - choice**: Ensure through time constraints that mixed - choice does not lead to deadlock or other unreachable states. - **Support for timeouts**: Allow the use of timeout mechanisms in asynchronous communication, which is very important for handling failures and unexpected delays. - **Enhancement of expressive power**: By introducing timers and time - sensitive conditional statements, the expressive power of the system is enhanced, enabling it to describe complex communication protocols more precisely. In summary, this paper solves the safety problem of mixed - choice in asynchronous communication and provides support for the timeout mechanism by introducing TOAST and its related mechanisms, thereby enhancing the expressive power and practicality of session types.