ABSTRACT
Callback-oriented Erlang/OTP behaviours such as the gen_server library are susceptible to malformed requests and ill-typed messages, causing server processes to crash unless a defensive programming style is used. We contribute an alternative approach in the form of a fully automatic hybrid analysis of callback modules using a notion of type safety based upon a sub-typing relation for Erlang. A combination of compile-time type inference, automatic code injection, and modifications to the request dispatch code of gen_server are used to demonstrate how generic server processes can be protected from client-side type errors.
- Thomas Arts, John Hughes, Joakim Johansson, and Ulf T. Wiger. 2006. Testing telecoms software with QuviQ QuickCheck. In Erlang Workshop. ACM, 2–10. Google ScholarDigital Library
- Duncan Paul Attard and Adrian Francalanza. 2016. A Monitoring Tool for a Branching-Time Logic. In RV (Lecture Notes in Computer Science), Vol. 10012. Springer, 473–481.Google Scholar
- Richard Carlsson. 2001. An introduction to Core Erlang. In PLI01 Erlang Workshop.Google Scholar
- Richard Carlsson. 2009. cerl.erl, Erlang/OTP compiler application. https://github.com/erlang/otp/blob/41672f4/lib/compiler/src/cerl.erlGoogle Scholar
- Ian Cassar, Adrian Francalanza, Luca Aceto, and Anna Ingólfsdóttir. 2017. eAOP: an aspect oriented programming framework for Erlang. In Erlang Workshop. ACM, 20–30. Google ScholarDigital Library
- Maria Christakis and Konstantinos Sagonas. 2011. Detection of Asynchronous Message Passing Errors Using Static Analysis. In PADL (Lecture Notes in Computer Science), Vol. 6539. Springer, 5–18. Google ScholarDigital Library
- Koen Claessen and John Hughes. 2000. QuickCheck: a lightweight tool for random testing of Haskell programs. In ICFP. ACM, 268–279. Google ScholarDigital Library
- Ericsson A.B. 2019. Erlang Run-Time System Application (ERTS) User’s Guide (10.3 ed.). Ericsson A.B. http://erlang.org/doc/apps/erts/users_ guide.htmlGoogle Scholar
- Ericsson A.B. 2019. STDLIB Reference Manual (3.8 ed.). Ericsson A.B. http://erlang.org/doc/apps/stdlib/index.htmlGoogle Scholar
- Simon Fowler. 2016. An Erlang Implementation of Multiparty Session Actors. In ICE (EPTCS), Vol. 223. 36–50.Google ScholarCross Ref
- Adrian Francalanza and Aldrin Seychell. 2015. Synthesising correct concurrent runtime monitors. Formal Methods in System Design 46, 3 (2015), 226–261. Google ScholarDigital Library
- Lars-Åke Fredlund and Hans Svensson. 2007. McErlang: a model checker for a distributed functional programming language. In ICFP. ACM, 125–136. Google ScholarDigital Library
- Alkis Gotovos, Maria Christakis, and Konstantinos Sagonas. 2011. Test-driven development of concurrent programs using Concuerror. In Erlang Workshop. ACM, 51–61. Google ScholarDigital Library
- Björn Gustavsson. 2018. Core Erlang by example. http://blog.erlang. org/core-erlang-by-example/Google Scholar
- Björn Gustavsson. 2018. Core Erlang optimisations. http://blog.erlang. org/core-erlang-optimizations/Google Scholar
- Joseph Harrison. 2018. Automatic detection of Core Erlang message passing errors. In Erlang Workshop. ACM, 37–48. Google ScholarDigital Library
- Joseph Harrison. 2019. OTyPe: Proof-of-concept runtime monitoring for gen_server.Google Scholar
- Huiqing Li and Simon Thompson. 2011. A User-extensible Refactoring Tool for Erlang Programs. Technical report. University of Kent. 182–196 pages.Google Scholar
- Tobias Lindahl and Konstantinos Sagonas. 2005. TypEr: a type annotator of Erlang code. In Erlang Workshop. ACM, 17–25. Google ScholarDigital Library
- Tobias Lindahl and Kostis Sagonas. 2006. Dialyzer, a DIscrepancy AnaLYZer for ERlang programs. http://erlang.org/doc/man/dialyzer. htmlGoogle Scholar
- Tobias Lindahl and Konstantinos Sagonas. 2006. Practical type inference based on success typings. In PPDP. ACM, 167–178. Google ScholarDigital Library
- Rumyana Neykova and Nobuko Yoshida. 2017. Let it recover: multiparty protocol-induced recovery. In CC. ACM, 98–108. Google ScholarDigital Library
- Josef Svenningsson. 2018. Gradualizer. https://github.com/josefs/ GradualizerGoogle Scholar
Index Terms
- Runtime type safety for Erlang/otp behaviours
Recommendations
Bidirectional typing for Erlang
Erlang 2021: Proceedings of the 20th ACM SIGPLAN International Workshop on ErlangErlang is a strict, dynamically typed functional programming language popular for its use in distributed and fault-tolerant applications. The absence of static type checking allows ill-typed programs to cause type errors at run time. The benefits of ...
Typing the wild in Erlang
Erlang 2018: Proceedings of the 17th ACM SIGPLAN International Workshop on ErlangDeveloping a static type system suitable for Erlang has been of ongoing interest for almost two decades now. The challenge with retrofitting a static type system onto a dynamically typed language, such as Erlang, is the loss of flexibility in ...
Really Natural Linear Indexed Type Checking
IFL '14: Proceedings of the 26nd 2014 International Symposium on Implementation and Application of Functional LanguagesRecent works have shown the power of linear indexed type systems for enforcing complex program properties. These systems combine linear types with a language of type-level indices, allowing more fine-grained analyses. Such systems have been fruitfully ...
Comments