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.
Similar content being viewed by others
References
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)
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)
Open Source Mail Archive (2004) Message #150. URL http://osdir.com/ml/java.hsqldb.user/2004-03/msg00150.html
Open Source Mail Archive (2008) Bug 159. URL http://osdir.com/ml/java.openjdk.distro-packaging.devel/2008-06/msg00061.html
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)
Bensalem, S., Havelund, K.: Dynamic deadlock analysis of multi-threaded programs. In: Proc. of the Haifa Verification Conference, pp. 208–223 (2005)
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)
Corbett, J.C.: Evaluating deadlock detection methods for concurrent software. IEEE Trans. Softw. Eng. 22(3), 161–180 (1996)
Sun Developer Network Bug Database (2007). URL http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=xxxx, bug-id provided at citation
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)
Dutertre, B., de Moura, L.: A fast linear-arithmetic solver for DPLL(T). In: Proc. of Computer Aided Verification, pp. 81–94 (2006)
Engler, D., Ashcraft, K.: Racerx: effective, static detection of race conditions and deadlocks. ACM SIGOPS Oper. Syst. Rev. 37(5), 237–252 (2003)
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)
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)
Havelund, K., Pressburger, T.: Model checking JAVA programs using Java pathfinder. Int. J. Softw. Tools Technol. Transf. 2(4), 366–381 (2000)
Holzmann, G.J.: The SPIN Model Checker. Addison-Wesley, Reading (2003)
Jajuk Advanced Jukebox (2008). Bug Ticket #850. URL http://trac.jajuk.info/ticket/850
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)
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
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)
Lister, A.: The problem of nested monitor calls. SIGOPS Oper. Syst. Rev. 11(3), 5–7 (1977)
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)
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)
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)
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)
von Praun, C.: Detecting synchronization defects in multi-threaded object-oriented programs. PhD thesis, ETH Zurich (2004)
Ramalingam, G.: Context-sensitive synchronization-sensitive analysis is undecidable. ACM Trans. Program. Lang. Syst. 22(2), 416–430 (2000)
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)
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)
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)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Deshmukh, J.V., Emerson, E.A. & Sankaranarayanan, S. Symbolic modular deadlock analysis. Autom Softw Eng 18, 325–362 (2011). https://doi.org/10.1007/s10515-011-0085-0
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10515-011-0085-0