skip to main content
10.1145/3331542.3342571acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Runtime type safety for Erlang/otp behaviours

Published:18 August 2019Publication History

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.

References

  1. Thomas Arts, John Hughes, Joakim Johansson, and Ulf T. Wiger. 2006. Testing telecoms software with QuviQ QuickCheck. In Erlang Workshop. ACM, 2–10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle Scholar
  3. Richard Carlsson. 2001. An introduction to Core Erlang. In PLI01 Erlang Workshop.Google ScholarGoogle Scholar
  4. Richard Carlsson. 2009. cerl.erl, Erlang/OTP compiler application. https://github.com/erlang/otp/blob/41672f4/lib/compiler/src/cerl.erlGoogle ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. Koen Claessen and John Hughes. 2000. QuickCheck: a lightweight tool for random testing of Haskell programs. In ICFP. ACM, 268–279. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle Scholar
  9. Ericsson A.B. 2019. STDLIB Reference Manual (3.8 ed.). Ericsson A.B. http://erlang.org/doc/apps/stdlib/index.htmlGoogle ScholarGoogle Scholar
  10. Simon Fowler. 2016. An Erlang Implementation of Multiparty Session Actors. In ICE (EPTCS), Vol. 223. 36–50.Google ScholarGoogle ScholarCross RefCross Ref
  11. Adrian Francalanza and Aldrin Seychell. 2015. Synthesising correct concurrent runtime monitors. Formal Methods in System Design 46, 3 (2015), 226–261. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Lars-Åke Fredlund and Hans Svensson. 2007. McErlang: a model checker for a distributed functional programming language. In ICFP. ACM, 125–136. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Alkis Gotovos, Maria Christakis, and Konstantinos Sagonas. 2011. Test-driven development of concurrent programs using Concuerror. In Erlang Workshop. ACM, 51–61. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Björn Gustavsson. 2018. Core Erlang by example. http://blog.erlang. org/core-erlang-by-example/Google ScholarGoogle Scholar
  15. Björn Gustavsson. 2018. Core Erlang optimisations. http://blog.erlang. org/core-erlang-optimizations/Google ScholarGoogle Scholar
  16. Joseph Harrison. 2018. Automatic detection of Core Erlang message passing errors. In Erlang Workshop. ACM, 37–48. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Joseph Harrison. 2019. OTyPe: Proof-of-concept runtime monitoring for gen_server.Google ScholarGoogle Scholar
  18. Huiqing Li and Simon Thompson. 2011. A User-extensible Refactoring Tool for Erlang Programs. Technical report. University of Kent. 182–196 pages.Google ScholarGoogle Scholar
  19. Tobias Lindahl and Konstantinos Sagonas. 2005. TypEr: a type annotator of Erlang code. In Erlang Workshop. ACM, 17–25. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Tobias Lindahl and Kostis Sagonas. 2006. Dialyzer, a DIscrepancy AnaLYZer for ERlang programs. http://erlang.org/doc/man/dialyzer. htmlGoogle ScholarGoogle Scholar
  21. Tobias Lindahl and Konstantinos Sagonas. 2006. Practical type inference based on success typings. In PPDP. ACM, 167–178. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Rumyana Neykova and Nobuko Yoshida. 2017. Let it recover: multiparty protocol-induced recovery. In CC. ACM, 98–108. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Josef Svenningsson. 2018. Gradualizer. https://github.com/josefs/ GradualizerGoogle ScholarGoogle Scholar

Index Terms

  1. Runtime type safety for Erlang/otp behaviours

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          Erlang 2019: Proceedings of the 18th ACM SIGPLAN International Workshop on Erlang
          August 2019
          73 pages
          ISBN:9781450368100
          DOI:10.1145/3331542

          Copyright © 2019 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 18 August 2019

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate51of68submissions,75%

          Upcoming Conference

          ICFP '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader