Skip to main content

Deadlocks as Runtime Exceptions

  • Conference paper
  • First Online:
Book cover Programming Languages (SBLP 2015)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9325))

Included in the following conference series:

  • 443 Accesses

Abstract

Deadlocks are a common type of concurrency bug. When a deadlock occurs, it is difficult to clearly determine whether there is an actual deadlock or if the application is slow or hanging due to a different reason. It is also difficult to establish the cause of the deadlock. In general, developers deal with deadlocks by using analysis tools, introducing application-specific deadlock detection mechanisms, or simply by using techniques to avoid the occurrence of deadlocks by construction. In this paper we propose a different approach. We believe that if deadlocks manifest at runtime, as exceptions, programmers will be able to identify these deadlocks in an accurate and timely manner. We leverage two insights to make this practical: (i) most deadlocks occurring in real systems involve only two threads acquiring two locks (TTTL deadlocks); and (ii) it’s possible to detect TTTL deadlocks efficiently enough for most practical systems. We conducted a study on bug reports and found that more than 90 % of identified deadlocks were indeed TTTL. We extended Java’s ReentrantLock class to detect TTTL deadlocks and measured the performance overhead of this approach with a conservative benchmark. For applications whose execution time is not dominated by locking, the overhead is estimated as below 6 %. Empirical usability evaluation in two experiments showed that students finished tasks 16.87 % to 30.7 % faster on the average using our approach with the lock being the most significant factor behind it, and, in one of the experiments answers were significantly more accurate (81.25 % more correct bugs found).

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 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.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

Notes

  1. 1.

    Lucene: http://lucene.apache.org/.

  2. 2.

    Eclipse: https://eclipse.org/.

  3. 3.

    OpenJDK: http://openjdk.java.net/.

  4. 4.

    Lucene bug reports list: http://goo.gl/DhVI3t.

  5. 5.

    Eclipse bug reports: http://goo.gl/qQnrEm.

  6. 6.

    OpenJDK bug reports: http://goo.gl/xYFfsO.

  7. 7.

    Bug reports sample: http://goo.gl/zNsIGz.

References

  1. Lu, S., et al.: Learning from mistakes: a comprehensive study on real world concurrency bug characteristics. In: ACM Sigplan Notices, vol. 43, no. 3. ACM (2008)

    Google Scholar 

  2. Singhal, M.: Deadlock detection in distributed systems. Computer 22(11), 37–48 (1989)

    Article  Google Scholar 

  3. Knapp, E.: Deadlock detection in distributed databases. ACM Computing Surveys (CSUR) 19(4), 303–328 (1987)

    Article  Google Scholar 

  4. Marino, D., et al.: Detecting deadlock in programs with data-centric synchronization. In: 2013 35th International Conference on Software Engineering (ICSE). IEEE (2013)

    Google Scholar 

  5. Marlow, S.: Parallel and Concurrent Programming in Haskell: Techniques for Multicore and Multithreaded Programming. O’Reilly, Aug 2013

    Google Scholar 

  6. Aimonetti, M.: Go Bootcamp: Chap. 8 - Concurrency. http://www.golangbootcamp.com/book/concurrency

  7. Engler, D., Ashcraft, K.: RacerX: effective, static detection of race conditions and deadlocks. SIGOPS Oper. Syst. Rev. 37(5), 237–252 (2003)

    Article  Google Scholar 

  8. Shanbhag, V.K.: Deadlock-detection in java-library using static-analysis. In: Asia-PacificSoftware Engineering Conference, pp. 361–368 (2008)

    Google Scholar 

  9. Williams, A., Thies, W., Awasthi, P.: Static deadlock detection for java libraries. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 602–629. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  10. Da Luo, Z., Das, R., Qi, Y.: Multicore sdk: a practical and efficient deadlock detector for real-world applications. In: 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation (ICST). IEEE (2011)

    Google Scholar 

  11. Cai, Y., Chan, W.K.: MagicFuzzer: scalable deadlock detection for large-scale applications. In: Proceedings of the 2012 International Conference on Software Engineering. IEEE Press (2012)

    Google Scholar 

  12. Pyla, H.K., Varadarajan, S.: Avoiding deadlock avoidance. In: Proceedings of the 19th International Conference on Parallel Architectures and Compilation Techniques. ACM (2010)

    Google Scholar 

  13. Pyla, H.K., Varadarajan, S.: Transparent runtime deadlock elimination. In: Proceedings of the 21st International Conference on Parallel Architectures and Compilation Techniques, PACT 2012, pp. 477–478. ACM, New York (2012)

    Google Scholar 

  14. Pyla, H.K.: Safe Concurrent Programming and Execution (2013)

    Google Scholar 

  15. Biswas, S., et al.: Efficient, Software-Only Data Race Exceptions (2015)

    Google Scholar 

  16. Qin, F., Tucek, J., Zhou, Y., Sundaresan, J.: Rx: Treating bugs as allergies–a safe method to survive software failures. ACM Trans. Comput. Syst., 25(3), August 2007

    Google Scholar 

  17. Havelund, K., Pressburger, T.: Model checking java programs using java pathfinder. Int. J. Softw. Tools Technol. Transf. 2(4), 366–381 (2000)

    Article  MATH  Google Scholar 

  18. Java’s ReentrantLock with DeadlockException. https://github.com/rafaelbrandao/java-lock-deadlock-exception

  19. Eclipe’s OrderedLock class description. Documentation http://cct.lsu.edu/ rguidry/ecl31docs/api/org/eclipse/core/internal/jobs/OrderedLock.html

  20. Sanchez, I: Latin Squares and its applications on software engineering. Master’s thesis, Federal University of Pernambuco, Recife, Brazil (2011)

    Google Scholar 

  21. Accioly, P.: Comparing different testing strategies for software product lines. Master’s thesis, Federal University of Pernambuco, Recife, Brazil (2012)

    Google Scholar 

  22. Runeson, P.: Using students as experiement subjects - an analysis on graduate and freshmen student data. In: Proceedings of the 7th International Conference on Empirical Assessment in Software Engineering. Keele University, UK, pp. 95–102 (2003)

    Google Scholar 

  23. Staron, M.: Using students as subjects in experiments - a quantitative analysis of the influence of experimentation on students’ learning process. In: CSEE & T, pp. 221–228. IEEE Computer Society (2007)

    Google Scholar 

  24. Box, G.E.P., Hunter, J.S., Hunter, W.G.: Statistics for Experimenters: Design, Innovation, and Discovery. Wiley-Interscience (2005)

    Google Scholar 

  25. Agresti, A.: A survey of exact inference for contingency tables. Statistical Science, pp. 131–153 (1992)

    Google Scholar 

  26. Lozi, J.-P., David, F., Thomas, G., Lawall, J., Muller, G.: Remote core locking: migrating critical-section execution to improve the performance of multithreaded applications. In: Proceedings of the 2012 USENIX Annual Technical Conference (USENIX ATC 2012), Berkeley, CA, USA (2012)

    Google Scholar 

Download references

Acknowledgments

We thank feedback from anonymous reviewers and from SPG group at CIn/UFPE. Rafael was supported by a grant provided by CAPES. Fernando is supported by CNPq/Brazil (304755/2014-1, 487549/2012-0 and 477139/2013-2), FACEPE/Brazil (APQ- 0839-1.03/14) and INES (CNPq 573964/2008-4, FACEPE APQ-1037-1.03/08, and FACEPE APQ-0388-1.03/14).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Rafael Lobo .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Lobo, R., Castor, F. (2015). Deadlocks as Runtime Exceptions. In: Pardo, A., Swierstra, S. (eds) Programming Languages. SBLP 2015. Lecture Notes in Computer Science(), vol 9325. Springer, Cham. https://doi.org/10.1007/978-3-319-24012-1_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-24012-1_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-24011-4

  • Online ISBN: 978-3-319-24012-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics