在恐慌中保持安全:使用多方会话类型的仿射Rust编程
Stay Safe under Panic: Affine Rust Programming with Multiparty Session Types
摘要:
通信系统包括跨网络的各种软件组件。为了确保它们的鲁棒性,现代程序设计语言(如Rust)提供了强类型通道(其使用保证是仿射的(最多一次))和二进制通道上的取消操作。为了协调组件正确地相互通信和同步,我们使用多方会话类型的结构化机制,用仿射通信信道和隐式/显式取消机制对其进行扩展。这种新的类型规则,仿射多方会话类型(AMPST),确保取消终止多个独立运行的组件,并保证通信不会由于错误或突然终止而卡住。在AMPST的指导下,我们实现了一个与取消终止算法相关的Rust API自动生成工具(MultiCrusty),Rust编译器通过该工具自动检测不安全的程序。我们的评估表明,MultiCrusty提供了一种有效的机制,用于通信,同步和传播任意进程的取消通知。我们已经实现了几个用例,包括流行的应用程序协议(OAuth,SMTP)和具有异常处理模式的协议(断路器,分布式日志记录)。
英文摘要:
Communicating systems comprise diverse software components across networks. To ensure their robustness, modern programming languages such as Rust provide both strongly typed channels, whose usage is guaranteed to be affine (at most once), and cancellation operations over binary channels. For coordinating components to correctly communicate and synchronise with each other, we use the structuring mechanism from multiparty session types, extending it with affine communication channels and implicit/explicit cancellation mechanisms. This new typing discipline, affine multiparty session types (AMPST), ensures cancellation termination of multiple, independently running components and guarantees that communication will not get stuck due to error or abrupt termination. Guided by AMPST, we implemented an automated generation tool (MultiCrusty) of Rust APIs associated with cancellation termination algorithms, by which the Rust compiler auto-detects unsafe programs. Our evaluation shows that MultiCrusty provides an efficient mechanism for communication, synchronisation and propagation of the notifications of cancellation for arbitrary processes. We have implemented several usecases, including popular application protocols (OAuth, SMTP), and protocols with exception handling patterns (circuit breaker, distributed logging).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。