Skip to main content

Prefix-Based Tracing in Message-Passing Concurrency

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13290))

Abstract

The execution of concurrent applications typically involves some degree of nondeterminism, mostly due to the relative speeds of concurrent processes. An essential task in state-space exploration techniques for the verification of concurrent programs consists in finding points in an execution where alternative actions are possible. Here, the nondeterministic executions of a program can be represented by a tree-like structure. Given the trace of a concrete execution, one first identifies its branching points. Then, a new execution can be steered up to one of these branching points (using, e.g., a partial trace), so that an unexplored branch can be considered. From this point on, the execution proceeds nondeterministically, eventually producing a trace of the complete execution as a side-effect, and the process starts again. In this paper, we formalize this operation—partially driving the execution of a program and then producing a trace of the entire execution—, which we call prefix-based tracing. It combines ideas from both record-and-replay debugging and execution tracing. We introduce a semantics-based formalization of prefix-based tracing in the context of a message-passing concurrent language like Erlang. Furthermore, we also present an implementation of prefix-based tracing by means of a program instrumentation.

This work has been partially supported by grant PID2019-104735RB-C41 funded by MCIN/AEI/ 10.13039/501100011033, by the Generalitat Valenciana under grant Prometeo/2019/098 (DeepTrust), and by French ANR project DCore ANR-18-CE25-0007.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    In practice, dynamic partial order reduction techniques [4] are used to avoid exploring alternative executions which are causally equivalent to an already considered execution. Loosely speaking, two executions are causally equivalent if they produce the same outcome no matter if the sequence of actions is different. See, e.g., [11, 12] for a formal definition of causal equivalence in the context of the language Erlang.

  2. 2.

    Hence, the program is only instrumented once.

  3. 3.

    As in Erlang, functions and atoms (constants) begin with a lowercase letter while variables start with an uppercase symbol. The language has no user-defined data constructors, but allows the use of lists—following the usual Haskell-like notation—and tuples of the form \(\{e_1,\ldots ,e_n\}\), \(n\ge 1\) (a polyadic function).

  4. 4.

    Here, we consider the full syntax for receive statements, \(\mathsf {receive}~p_1~[\mathsf {when}~ g_1] \rightarrow e_1; \ldots ; p_n~[\mathsf {when}~g_n] \rightarrow e_n~ \mathsf {end}\), where each branch might have a guard \(g_i\) that must be evaluated to \( true \) in order to select this branch.

  5. 5.

    We say that two actions are causally related when one action cannot happen without the other, e.g., message sending and receiving, spawning a process and any action of this process, etc. Causality is often defined as the transitive closure of the above relation. When two actions are not causally related, we say that they are independent. Two executions are causally equivalent if they only differ in the order of independent actions. Equivalently, two executions are causally equivalent if they have the same log [12]. Actually, logs can be seen as a representation of so-called Mazurkiewicz traces [14]. We refer the interested reader to [12] for more details.

  6. 6.

    To be precise, the semantics in [12] does not consider process mailboxes nor message deliveries. Nevertheless, these actions are not observable in logs, and hence the property carry over easily to our case.

References

  1. Abdulla, P.A., Aronis, S., Jonsson, B., Sagonas, K.: Source sets: a foundation for optimal dynamic partial order reduction. J. ACM 64(4), 25:1–25:49 (2017). https://doi.org/10.1145/3073408

  2. Christakis, M., Gotovos, A., Sagonas, K.: Systematic testing for detecting concurrency errors in Erlang programs. In: Proceedings of the 6th IEEE International Conference on Software Testing, Verification and Validation (ICST 2013), pp. 154–163. IEEE Computer Society (2013). https://doi.org/10.1109/ICST.2013.50

  3. Erlang website (2021). https://www.erlang.org/

  4. Flanagan, C., Godefroid, P.: Dynamic partial-order reduction for model checking software. In: Palsberg, J., Abadi, M. (eds.) Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2005), pp. 110–121. ACM (2005). https://doi.org/10.1145/1040305.1040315

  5. Godefroid, P.: Model checking for programming languages using VeriSoft. In: POPL, pp. 174–186 (1997). https://doi.org/10.1145/263699.263717

  6. González-Abril, J.J., Vidal, G.: Causal-consistent reversible debugging: improving CauDEr. In: Morales, J.F., Orchard, D. (eds.) PADL 2021. LNCS, vol. 12548, pp. 145–160. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-67438-0_9

    Chapter  Google Scholar 

  7. González-Abril, J.J., Vidal, G.: A lightweight approach to computing message races with an application to causal-consistent reversible debugging (2021). http://arxiv.org/abs/2112.12869

  8. Hwang, G., Tai, K., Huang, T.: Reachability testing: an approach to testing concurrent software. Int. J. Softw. Eng. Knowl. Eng. 5(4), 493–510 (1995). https://doi.org/10.1142/S0218194095000241

    Article  Google Scholar 

  9. Lanese, I., Nishida, N., Palacios, A., Vidal, G.: CauDEr: a causal-consistent reversible debugger for Erlang. In: Gallagher, J.P., Sulzmann, M. (eds.) FLOPS 2018. LNCS, vol. 10818, pp. 247–263. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-90686-7_16

    Chapter  Google Scholar 

  10. Lanese, I., Nishida, N., Palacios, A., Vidal, G.: A theory of reversibility for Erlang. J. Log. Algebraic Methods Program. 100, 71–97 (2018). https://doi.org/10.1016/j.jlamp.2018.06.004

    Article  MathSciNet  MATH  Google Scholar 

  11. Lanese, I., Palacios, A., Vidal, G.: Causal-consistent replay debugging for message passing programs. In: Pérez, J.A., Yoshida, N. (eds.) FORTE 2019. LNCS, vol. 11535, pp. 167–184. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-21759-4_10

    Chapter  Google Scholar 

  12. Lanese, I., Palacios, A., Vidal, G.: Causal-consistent replay reversible semantics for message passing concurrent programs. Fundam. Inform. 178(3), 229–266 (2021). https://doi.org/10.3233/FI-2021-2005

    Article  MathSciNet  MATH  Google Scholar 

  13. Lei, Y., Carver, R.H.: Reachability testing of concurrent programs. IEEE Trans. Softw. Eng. 32(6), 382–403 (2006). https://doi.org/10.1109/TSE.2006.56

    Article  Google Scholar 

  14. Mazurkiewicz, A.: Trace theory. In: Brauer, W., Reisig, W., Rozenberg, G. (eds.) ACPN 1986. LNCS, vol. 255, pp. 278–324. Springer, Heidelberg (1987). https://doi.org/10.1007/3-540-17906-2_30

    Chapter  Google Scholar 

  15. Nishida, N., Palacios, A., Vidal, G.: A reversible semantics for Erlang. In: Hermenegildo, M.V., Lopez-Garcia, P. (eds.) LOPSTR 2016. LNCS, vol. 10184, pp. 259–274. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63139-4_15

    Chapter  Google Scholar 

  16. Svensson, H., Fredlund, L.A., Earle, C.B.: A unified semantics for future Erlang. In: 9th ACM SIGPLAN Workshop on Erlang, pp. 23–32. ACM (2010). https://doi.org/10.1145/1863509.1863514

Download references

Acknowledgements

The authors would like to thank Ivan Lanese for his useful remarks on a preliminary version of this paper. We would also like to thank the anonymous reviewers and the participants of LOPSTR 2021 for their suggestions to improve this work.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Germán Vidal .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

González-Abril, J.J., Vidal, G. (2022). Prefix-Based Tracing in Message-Passing Concurrency. In: De Angelis, E., Vanhoof, W. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2021. Lecture Notes in Computer Science, vol 13290. Springer, Cham. https://doi.org/10.1007/978-3-030-98869-2_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-98869-2_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-98868-5

  • Online ISBN: 978-3-030-98869-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics