Automated Software Engineering

, Volume 18, Issue 3–4, pp 325–362 | Cite as

Symbolic modular deadlock analysis

  • Jyotirmoy V. Deshmukh
  • E. Allen Emerson
  • Sriram Sankaranarayanan
Article

Abstract

Methods in object-oriented concurrent libraries often encapsulate internal synchronization details. As a result of information hiding, clients calling the library methods may cause thread safety violations by invoking methods in an unsafe manner. This is frequently a cause of deadlocks. Given a concurrent library, we present a technique for inferring interface contracts that specify permissible concurrent method calls and patterns of aliasing among method arguments. In this work, we focus on deriving contracts that guarantee deadlock-free execution for the methods in the library. The contracts also help client developers by documenting required assumptions about the library methods. Alternatively, the contracts can be statically enforced in the client code to detect potential deadlocks in the client. Our technique combines static analysis with a symbolic encoding scheme for tracking lock dependencies, allowing us to synthesize contracts using a SMT solver. Additionally, we investigate extensions of our technique to reason about deadlocks in libraries that employ signaling primitives such as wait-notify for cooperative synchronization. Our prototype tool analyzes over a million lines of code for some widely-used Java libraries within an hour, thus demonstrating its scalability and efficiency. Furthermore, the contracts inferred by our approach have been able to pinpoint real deadlocks in clients, i.e. deadlocks that have been a part of bug-reports filed by users and developers of client code.

Keywords

Deadlock prediction Static analysis Concurrent libraries 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Agarwal, R., Stoller, S.D.: Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables. In: Proc. of Workshop on Parallel and Distributed Systems: Testing and Debugging, pp. 51–60 (2006) CrossRefGoogle Scholar
  2. Agarwal, R., Wang, L., Stoller, S.: Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring. Hardware and Software, Verification and Testing, pp. 191–207 (2006) Google Scholar
  3. Open Source Mail Archive (2004) Message #150. URL http://osdir.com/ml/java.hsqldb.user/2004-03/msg00150.html
  4. Artho, C., Biere, A.: Applying static analysis to large-scale, multi-threaded Java programs. In: Proc. of the 13th Australian Conference on Software Engineering, p. 68 (2001) Google Scholar
  5. Bensalem, S., Havelund, K.: Dynamic deadlock analysis of multi-threaded programs. In: Proc. of the Haifa Verification Conference, pp. 208–223 (2005) Google Scholar
  6. Clarke, E.M., Emerson, E.A.: Design and synthesis of synchronization skeletons using branching-time temporal logic. In: Logics of Programs, pp. 52–71 (1981) Google Scholar
  7. Corbett, J.C.: Evaluating deadlock detection methods for concurrent software. IEEE Trans. Softw. Eng. 22(3), 161–180 (1996) CrossRefGoogle Scholar
  8. Sun Developer Network Bug Database (2007). URL http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=xxxx, bug-id provided at citation
  9. Deshmukh, J.V., Emerson, E.A., Sankaranarayanan, S.: Symbolic deadlock analysis in concurrent libraries and their clients. In: Proc. of the 24th IEEE /ACM International Conference on Automated Software Engineering, pp. 480–491 (2009) Google Scholar
  10. Dutertre, B., de Moura, L.: A fast linear-arithmetic solver for DPLL(T). In: Proc. of Computer Aided Verification, pp. 81–94 (2006) CrossRefGoogle Scholar
  11. Engler, D., Ashcraft, K.: Racerx: effective, static detection of race conditions and deadlocks. ACM SIGOPS Oper. Syst. Rev. 37(5), 237–252 (2003) CrossRefGoogle Scholar
  12. Flanagan, C., Freund, S.N., Yi, J.: Velodrome: a sound and complete dynamic atomicity checker for multithreaded programs. In: Proc. of PLDI, pp. 293–303 (2008) Google Scholar
  13. Havelund, K.: Using runtime analysis to guide model checking of Java programs. In: Proc. of SPIN Workshop on Model Checking of Software, pp. 245–264 (2000) CrossRefGoogle Scholar
  14. Havelund, K., Pressburger, T.: Model checking JAVA programs using Java pathfinder. Int. J. Softw. Tools Technol. Transf. 2(4), 366–381 (2000) MATHCrossRefGoogle Scholar
  15. Holzmann, G.J.: The SPIN Model Checker. Addison-Wesley, Reading (2003) Google Scholar
  16. Jajuk Advanced Jukebox (2008). Bug Ticket #850. URL http://trac.jajuk.info/ticket/850
  17. Lahiri, S.K., Musuvathi, M.: An efficient decision procedure for UTVPI constraints. In: Proc. of Frontiers of Combining Systems, 5th International Workshop, pp. 168–183 (2005) Google Scholar
  18. Lamport, L.: Time, clocks, and the ordering of events in a distributed system. Commun. ACM 21(7), 558–565 (1978). URL http://portal.acm.org.ezproxy.lib.utexas.edu/citation.cfm?id=359563 MATHCrossRefGoogle Scholar
  19. Li, L., Verbrugge, C.: A practical MHP information analysis for concurrent Java programs. In: Proc. of the 17th International Workshop on Languages and Compilers for Parallel Computing, pp. 194–208 (2004) Google Scholar
  20. Lister, A.: The problem of nested monitor calls. SIGOPS Oper. Syst. Rev. 11(3), 5–7 (1977) CrossRefGoogle Scholar
  21. de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Proc. of Tools and Algorithms for the Construction and Analysis of Systems, pp. 337–340 (2008) CrossRefGoogle Scholar
  22. Naik, M., Aiken, A., Whaley, J.: Effective static race detection for Java. In: Proc. of the 2006 ACM SIGPLAN Conf. on Programming Language Design and Implementation, pp. 308–319. ACM, New York (2006) CrossRefGoogle Scholar
  23. Naik, M., Park, C.S., Sen, K., Gay, D.: Effective static deadlock detection. In: Proc. of the 31st International Conference on Software Engineering, pp. 386–396 (2009) Google Scholar
  24. Otto, F., Moschny, T.: Finding synchronization defects in Java programs: extended static analyses and code patterns. In: Proc. of 1st International Workshop on Multicore Software Engineering, pp. 41–46 (2008) CrossRefGoogle Scholar
  25. von Praun, C.: Detecting synchronization defects in multi-threaded object-oriented programs. PhD thesis, ETH Zurich (2004) Google Scholar
  26. Ramalingam, G.: Context-sensitive synchronization-sensitive analysis is undecidable. ACM Trans. Program. Lang. Syst. 22(2), 416–430 (2000) CrossRefGoogle Scholar
  27. Shanbhag, V.K.: Deadlock-detection in Java-library using static-analysis. In: Proc. of the 15th Asia-Pacific Software Engineering Conference, pp. 361–368 (2008) CrossRefGoogle Scholar
  28. Vallée-Rai, R., Hendren, L., Sundaresan, V., Lam, P., Gagnon, E., Co, P.: Soot—a Java Optimization Framework. In: Proc. of the 1999 Conference of the Centre for Advanced Studies on Collaborative Research, pp. 125–135 (1999) Google Scholar
  29. Williams, A., Thies, W., Ernst, M.D.: Static deadlock detection for Java libraries. In:Proc. of the European Conference on Object-Oriented Programming, pp. 602–629 (2005) Google Scholar

Copyright information

© Springer Science+Business Media, LLC 2011

Authors and Affiliations

  • Jyotirmoy V. Deshmukh
    • 1
  • E. Allen Emerson
    • 2
  • Sriram Sankaranarayanan
    • 3
  1. 1.Department of Computer and Information ScienceUniversity of PennsylvaniaPhiladelphiaUSA
  2. 2.Department of Computer ScienceThe University of Texas at AustinAustinUSA
  3. 3.Department of Computer ScienceUniversity of Colorado BoulderBoulderUSA

Personalised recommendations