Skip to main content

Sound Concurrent Traces for Online Monitoring

  • Conference paper
  • First Online:
Model Checking Software (SPIN 2023)

Abstract

Monitoring concurrent programs typically rely on collecting traces to abstract program executions. However, existing approaches targeting general behavioral properties are either not tailored for online monitoring, are no longer maintained, or implement naive instrumentation that often leads to unsound verdicts. We first define the notion of when a trace is representative of a concurrent execution. We then present a non-blocking vector clock algorithm to collect sound concurrent traces on the fly reflecting the partial order between events. Moreover, concurrent events in the representative trace pose a soundness problem for monitors synthesized from total order formalisms. For this, we extract a causal dependence relation from the monitor to check if the trace has the needed orderings and define the conditions to decide at runtime when a collected trace is monitorable. We implement our contributions in a tool, FACTS, which instruments programs compiling to Java bytecode, constructs sound representative traces, and warns the monitor about non-monitorable traces. We evaluate our work and compare it with existing approaches.

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

Access this chapter

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

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    The algorithm might miss, in some marginal cases, ordering information resulting in sound but unfaithful traces (see Sect. 5).

  2. 2.

    Such as \(\texttt{synchronized}\) in Java.

  3. 3.

    We depict actions using the notation \(\mathtt {id.label^{tid}_{resource}}\) in diagrams.

  4. 4.

    We assume familiarity with partial orders and partially ordered sets.

  5. 5.

    We omit some null checks to simplify the presentation of the algorithm, however, assume that joining \(e. VC \) with a null value does not affect it.

  6. 6.

    Atomic operations such as compare-and-swap are handled differently since we check for the result of the operation before emitting an action.

  7. 7.

    In the technical report [68], we extract \(\mathcal {I}_D\) from 55 event-based property specifications from [1, 24] written as Quantified Regular Expressions (QREs).

  8. 8.

    Implementation details can be found in the technical report [68].

  9. 9.

    We also collect linear traces as collected by Java-MOP [21] and show the number of ordering corrections made with concurrent traces, details in [68].

References

  1. Patterns in property specifications for finite-state verification home page. https://matthewbdwyer.github.io/psp/patterns.html

  2. Akka documentation. http://akka.io/docs/ (2022)

  3. JSR-133: Java Memory Model and Thread Specification Revision (2004). http://jcp.org/jsr/detail/133.jsp

  4. Adve, S.V., Gharachorloo, K.: Shared memory consistency models: a tutorial. Computer 29(12), 66–76 (1996). https://doi.org/10.1109/2.546611

    Article  Google Scholar 

  5. Agarwal, A., Garg, V.K.: Efficient dependency tracking for relevant events in shared-memory systems. In: Proceedings of the Twenty-Fourth Annual ACM Symposium on Principles of Distributed Computing, pp. 19–28. PODC 2005, Association for Computing Machinery, New York, NY, USA (2005). https://doi.org/10.1145/1073814.1073818

  6. Agha, G.: Actors: A Model of Concurrent Computation in Distributed Systems. MIT Press, Cambridge, MA, USA (1986)

    Google Scholar 

  7. Ahamad, M., Neiger, G., Burns, J.E., Kohli, P., Hutto, P.W.: Causal memory: definitions, implementation, and programming. Distrib. Comput. 9(1), 37–49 (1995). https://doi.org/10.1007/BF01784241

    Article  MathSciNet  MATH  Google Scholar 

  8. Allan, C., et al.: Adding trace matching with free variables to AspectJ. In: Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, pp. 345–364. OOPSLA 2005, ACM (2005). https://doi.org/10.1145/1094811.1094839

  9. Attard, D.P., Cassar, I., Francalanza, A., Aceto, L., Ingólfsdóttir, A.: A runtime monitoring tool for actor-based systems (2022). https://www.um.edu.mt/library/oar/handle/123456789/23062

  10. Barringer, H., Falcone, Y., Havelund, K., Reger, G., Rydeheard, D.E.: Quantified event automata: towards expressive and efficient runtime monitors. In: FM 2012: Formal Methods - 18th International Symposium, Paris, France, 27–31 August 2012. Proceedings, pp. 68–84 (2012). https://doi.org/10.1007/978-3-642-32759-9_9

  11. Bartocci, E., et al.: First international Competition on Runtime Verification: rules, benchmarks, tools, and final results of CRV 2014. Int. J. Softw. Tools Technol. Transfer 21(1), 31–70 (2017). https://doi.org/10.1007/s10009-017-0454-5

    Article  Google Scholar 

  12. Bartocci, E., Falcone, Y., Francalanza, A., Reger, G.: Introduction to runtime verification. In: Bartocci, E., Falcone, Y. (eds.) Lectures on Runtime Verification. LNCS, vol. 10457, pp. 1–33. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-75632-5_1

    Chapter  Google Scholar 

  13. Bauer, A., Leucker, M., Schallhart, C.: Runtime verification for ITL and TLTL. ACM Trans. Softw. Eng. Methodol. 20(4), 1–64 (2011). https://doi.org/10.1145/2000799.2000800

  14. Bensalem, S., Havelund, K.: Dynamic deadlock analysis of multi-threaded programs. In: Ur, S., Bin, E., Wolfsthal, Y. (eds.) HVC 2005. LNCS, vol. 3875, pp. 208–223. Springer, Heidelberg (2006). https://doi.org/10.1007/11678779_15

    Chapter  Google Scholar 

  15. Bianchi, F.A., Margara, A., Pezzè, M.: A survey of recent trends in testing concurrent software systems. IEEE Trans. Software Eng. 44(8), 747–783 (2018). https://doi.org/10.1109/TSE.2017.2707089

    Article  Google Scholar 

  16. Blackburn, S.M., et al.: The DaCapo benchmarks: java benchmarking development and analysis. In: Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-oriented Programming Systems, Languages, and Applications, pp. 169–190. OOPSLA 2006, ACM (2006). https://doi.org/10.1145/1167473.1167488

  17. Bodden, E., Hendren, L., Lam, P., Lhoták, O., Naeem, N.A.: Collaborative Runtime Verification with Tracematches. J. Log. Comput. 20(3), 707–723 (2010). https://doi.org/10.1093/logcom/exn077

    Article  MathSciNet  MATH  Google Scholar 

  18. Cain, H.W., Lipasti, M.H.: Verifying sequential consistency using vector clocks. In: Proceedings of the Fourteenth Annual ACM Symposium on Parallel Algorithms and Architectures, pp. 153–154. SPAA 2002, Association for Computing Machinery, New York, NY, USA (2002). https://doi.org/10.1145/564870.564897

  19. Cassar, I., Francalanza, A.: On implementing a monitor-oriented programming framework for actor systems. In: Integrated Formal Methods - 12th International Conference, IFM 2016, Reykjavik, Iceland, 1–5 June 2016, Proceedings, pp. 176–192 (2016). https://doi.org/10.1007/978-3-319-33693-0_12

  20. Chen, F., Roşu, G.: Parametric and sliced causality. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 240–253. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-73368-3_27

    Chapter  Google Scholar 

  21. Chen, F., Roşu, G.: Java-MOP: a monitoring oriented programming environment for java. In: Halbwachs, N., Zuck, L.D. (eds.) TACAS 2005. LNCS, vol. 3440, pp. 546–550. Springer, Heidelberg (2005). https://doi.org/10.1007/978-3-540-31980-1_36

    Chapter  MATH  Google Scholar 

  22. Chen, F., Serbanuta, T.F., Rosu, G.: jPredictor: a predictive runtime analysis tool for java. In: Proceedings of the 30th International Conference on Software Engineering, pp. 221–230. ICSE 2008, Association for Computing Machinery, New York, NY, USA (2008). https://doi.org/10.1145/1368088.1368119

  23. Colombo, C., Pace, G.J., Schneider, G.: LARVA – Safer monitoring of real-time java programs (tool paper). In: Hung, D.V., Krishnan, P. (eds.) Seventh IEEE International Conference on Software Engineering and Formal Methods, SEFM 2009, Hanoi, Vietnam, 23–27 November 2009, pp. 33–37. IEEE Computer Society (2009). https://doi.org/10.1109/SEFM.2009.13

  24. Dwyer, M.B., Avrunin, G.S., Corbett, J.C.: Patterns in property specifications for finite-state verification. In: Proceedings of the 21st International Conference on Software Engineering, pp. 411–420. ICSE 1999, Association for Computing Machinery, New York, NY, USA (1999). https://doi.org/10.1145/302405.302672

  25. El-Hokayem, A., Falcone, Y.: Can we monitor all multithreaded programs? In: Colombo, C., Leucker, M. (eds.) RV 2018. LNCS, vol. 11237, pp. 64–89. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-03769-7_6

    Chapter  Google Scholar 

  26. Falcone, Y., Fernandez, J., Mounier, L.: What can you verify and enforce at runtime? Int. J. Softw. Tools Technol. Transf. 14(3), 349–382 (2012). https://doi.org/10.1007/s10009-011-0196-8

  27. Falcone, Y., Havelund, K., Reger, G.: A Tutorial on Runtime Verification. In: Engineering Dependable Software Systems, pp. 141–175. IOS Press (2013)

    Google Scholar 

  28. Falcone, Y., Ničković, D., Reger, G., Thoma, D.: Second international competition on runtime verification. In: Bartocci, E., Majumdar, R. (eds.) RV 2015. LNCS, vol. 9333, pp. 405–422. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-23820-3_27

    Chapter  Google Scholar 

  29. Farzan, A., Madhusudan, P., Razavi, N., Sorrentino, F.: Predicting null-pointer dereferences in concurrent programs. In: Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering. FSE 2012, Association for Computing Machinery, New York, NY, USA (2012). https://doi.org/10.1145/2393596.2393651

  30. Flanagan, C., Freund, S.N.: Atomizer: A dynamic atomicity checker for multithreaded programs. SIGPLAN Not. 39(1), 256–267 (2004). https://doi.org/10.1145/982962.964023

  31. Flanagan, C., Freund, S.N.: FastTrack: Efficient and precise dynamic race detection. In: Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 121–133. PLDI 2009, Association for Computing Machinery, New York, NY, USA (2009). https://doi.org/10.1145/1542476.1542490

  32. Gao, Q., Zhang, W., Chen, Z., Zheng, M., Qin, F.: 2ndstrike: Toward manifesting hidden concurrency typestate bugs. SIGPLAN Not. 46(3), 239–250 (2011). https://doi.org/10.1145/1961296.1950394

  33. Gastin, P., Kuske, D.: Uniform satisfiability problem for local temporal logics over Mazurkiewicz traces. Inf. Comput. 208(7), 797–816 (2010). https://doi.org/10.1016/j.ic.2009.12.003

    Article  MathSciNet  MATH  Google Scholar 

  34. Harris, T., Marlow, S., Peyton-Jones, S., Herlihy, M.: Composable memory transactions. In: Proceedings of the Tenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pp. 48–60. PPoPP 2005, Association for Computing Machinery, New York, NY, USA (2005). https://doi.org/10.1145/1065944.1065952

  35. Herlihy, M., Shavit, N.: The Art of Multiprocessor Programming, 1st edn. Revised Reprint. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA (2012)

    Google Scholar 

  36. Huang, J., Luo, Q., Rosu, G.: Gpredict: generic predictive concurrency analysis. In: 37th IEEE/ACM International Conference on Software Engineering, ICSE 2015, vol. 1, pp. 847–857 (2015). https://doi.org/10.1109/ICSE.2015.96

  37. Huang, J., Meredith, P.O., Rosu, G.: Maximal sound predictive race detection with control flow abstraction. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation. p. 337–348. PLDI 2014, Association for Computing Machinery, New York, NY, USA (2014). https://doi.org/10.1145/2594291.2594315

  38. Joshi, P., Sen, K.: Predictive typestate checking of multithreaded java programs. In: Proceedings of the 2008 23rd IEEE/ACM International Conference on Automated Software Engineering, pp. 288–296. ASE 2008, IEEE Computer Society, USA (2008). https://doi.org/10.1109/ASE.2008.39

  39. Joshi, Y., Tchamgoue, G.M., Fischmeister, S.: Runtime verification of ITL on lossy traces. In: Proceedings of the Symposium on Applied Computing (2017)

    Google Scholar 

  40. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: Getting started with AspectJ. Commun. ACM 44(10), 59–65 (2001)

    Article  MATH  Google Scholar 

  41. Kupferman, O., Y. Vardi, M.: Model checking of safety properties. Form. Methods Syst. Des. 19(3), 291–314 (2001). https://doi.org/10.1023/A:1011254632723

  42. Lamport: How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comput. C-28(9), 690–691 (1979). https://doi.org/10.1109/TC.1979.1675439

  43. Lamport, L.: A new solution of Dijkstra’s concurrent programming problem. Commun. ACM 17(8), 453–455 (1974). https://doi.org/10.1145/361082.361093

  44. Lamport, L.: Time, clocks, and the ordering of events in a distributed system. Commun. ACM 21(7), 558–565 (1978). https://doi.org/10.1145/359545.359563

  45. Lea, D.: A java fork/join framework. In: Proceedings of the ACM 2000 Java Grande Conference, San Francisco, CA, USA, 3–5 June 2000, pp. 36–43 (2000). https://doi.org/10.1145/337449.337465

  46. Lea, D., Bloch, J., Midkiff, S., Holmes, D., Bowbeer, J., Peierls, T.: JSR-166: Concurrency utilities. https://www.jcp.org/en/jsr/detail?id=166

  47. Leucker, M., Schallhart, C.: A brief account of runtime verification. J. Logic Algebraic Program. 78(5), 293–303 (2009). https://doi.org/10.1016/j.jlap.2008.08.004

    Article  MATH  Google Scholar 

  48. Lodaya, K., Weil, P.: Rationality in algebras with a series operation. Inf. Comput. 171(2), 269–293 (2001). https://doi.org/10.1006/inco.2001.3077

    Article  MathSciNet  MATH  Google Scholar 

  49. Luo, Q., Rosu, G.: EnforceMOP: a runtime property enforcement system for multithreaded programs. In: Proceedings of International Symposium in Software Testing and Analysis (ISSTA2013), pp. 156–166. ACM (2013). http://dl.acm.org/citation.cfm?doid=2483760.2483766

  50. Manna, Z., Pnueli, A.: A hierarchy of temporal properties (invited paper, 1989). In: Proceedings of the Ninth Annual ACM Symposium on Principles of Distributed Computing, pp. 377–410. PODC 1990, Association for Computing Machinery, New York, NY, USA (1990). https://doi.org/10.1145/93385.93442

  51. Manna, Z., Pnueli, A.: Temporal Verification of Reactive Systems: Safety. Springer-Verlag, New York, Inc (1995). https://doi.org/10.1007/978-1-4612-4222-2

  52. Manson, J., Pugh, W., Adve, S.V.: The java memory model. In: Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 378–391. POPL 2005, ACM (2005). https://doi.org/10.1145/1040305.1040336

  53. Mathur, U., Viswanathan, M.: Atomicity checking in linear time using vector clocks, pp. 183–199. Association for Computing Machinery, New York, NY, USA (2020). https://doi.org/10.1145/3373376.3378475

  54. Mattern, F.: Virtual time and global states of distributed systems. In: Parallel and Distributed Algorithms, pp. 215–226. North-Holland (1988)

    Google Scholar 

  55. 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 

  56. Meenakshi, B., Ramanujam, R.: Reasoning about layered message passing systems. Comput. Lang. Syst. Struct. 30(3–4), 171–206 (2004). https://doi.org/10.1016/j.cl.2004.02.003

    Article  MATH  Google Scholar 

  57. Nielsen, M., Plotkin, G.D., Winskel, G.: Petri nets, event structures and domains, part I. Theor. Comput. Sci. 13, 85–108 (1981). https://doi.org/10.1016/0304-3975(81)90112-2

    Article  MATH  Google Scholar 

  58. Peled, D., Havelund, K.: Refining the safety–liveness classification of temporal properties according to monitorability. In: Margaria, T., Graf, S., Larsen, K.G. (eds.) Models, Mindsets, Meta: The What, the How, and the Why Not? LNCS, vol. 11200, pp. 218–234. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-22348-9_14

    Chapter  Google Scholar 

  59. Prokopec, A., et al.: Renaissance: a modern benchmark suite for parallel applications on the JVM. In: Proceedings Companion of the 2019 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity, pp. 11–12. SPLASH Companion 2019, Association for Computing Machinery, New York, NY, USA (2019). https://doi.org/10.1145/3359061.3362778

  60. Reger, G., Cruz, H.C., Rydeheard, D.: MarQ: monitoring at runtime with QEA. In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 596–610. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46681-0_55

    Chapter  Google Scholar 

  61. Reger, G., Hallé, S., Falcone, Y.: Third international competition on runtime verification. In: Falcone, Y., Sánchez, C. (eds.) RV 2016. LNCS, vol. 10012, pp. 21–37. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-46982-9_3

    Chapter  Google Scholar 

  62. Roemer, J., Genç, K., Bond, M.D.: SmartTrack: efficient predictive race detection. In: Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 747–762. PLDI 2020, Association for Computing Machinery, New York, NY, USA (2020). https://doi.org/10.1145/3385412.3385993

  63. Rosu, G., Sen, K.: An instrumentation technique for online analysis of multithreaded programs. In: 18th International Parallel and Distributed Processing Symposium, 2004. Proceedings, pp. 268- (2004). https://doi.org/10.1109/IPDPS.2004.1303344

  64. Sen, K., Rosu, G., Agha, G.: Runtime safety analysis of multithreaded programs. SIGSOFT Softw. Eng. Notes 28(5), 337–346 (2003). https://doi.org/10.1145/949952.940116

  65. Serbanuta, T., Chen, F., Rosu, G.: Maximal causal models for sequentially consistent systems. In: Runtime Verification, Third International Conference, RV 2012, Istanbul, Turkey, 25–28 September 2012, Revised Selected Papers, pp. 136–150 (2012). https://doi.org/10.1007/978-3-642-35632-2_16

  66. Shin, K., Ramanathan, P.: Real-time computing: a new discipline of computer science and engineering. Proc. IEEE 82(1), 6–24 (1994). https://doi.org/10.1109/5.259423

    Article  Google Scholar 

  67. Soueidi, C., El-Hokayem, A., Falcone, Y.: Opportunistic monitoring of multithreaded programs. In: Lambers, L., Uchitel, S. (eds.) FASE 2023. LNCS, vol. 13991, pp. 173–194. Springer, Cham (2023). https://doi.org/10.1007/978-3-031-30826-0_10

  68. Soueidi, C., Falcone, Y.: Sound concurrent traces for online monitoring technical report (2023). https://doi.org/10.6084/m9.figshare.21940205

  69. Soueidi, C., Kassem, A., Falcone, Y.: BISM: bytecode-level instrumentation for software monitoring. In: Deshmukh, J., Ničković, D. (eds.) RV 2020. LNCS, vol. 12399, pp. 323–335. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-60508-7_18

    Chapter  Google Scholar 

  70. Strom, R.E., Yemini, S.: Typestate: A programming language concept for enhancing software reliability. IEEE Trans. Soft. Eng. 12(1), 157–171 (1986). https://doi.org/10.1109/TSE.1986.6312929

  71. Virouleau, P., Broquedis, F., Gautier, T., Rastello, F.: Using data dependencies to improve task-based scheduling strategies on NUMA architectures. In: Dutot, P.-F., Trystram, D. (eds.) Euro-Par 2016. LNCS, vol. 9833, pp. 531–544. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-43659-3_39

    Chapter  Google Scholar 

  72. Wang, L., Stoller, S.: Runtime analysis of atomicity for multithreaded programs. IEEE Trans. Software Eng. 32(2), 93–110 (2006). https://doi.org/10.1109/TSE.2006.1599419

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Chukri Soueidi .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Soueidi, C., Falcone, Y. (2023). Sound Concurrent Traces for Online Monitoring. In: Caltais, G., Schilling, C. (eds) Model Checking Software. SPIN 2023. Lecture Notes in Computer Science, vol 13872. Springer, Cham. https://doi.org/10.1007/978-3-031-32157-3_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-32157-3_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-32156-6

  • Online ISBN: 978-3-031-32157-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics