Static Deadlock Detection for Java Libraries

  • Amy Williams
  • William Thies
  • Michael D. Ernst
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3586)


Library writers wish to provide a guarantee not only that each procedure in the library performs correctly in isolation, but also that the procedures perform correctly when run in conjunction. To this end, we propose a method for static detection of deadlock in Java libraries. Our goal is to determine whether client code exists that may deadlock a library, and, if so, to enable the library writer to discover the calling patterns that can lead to deadlock.

Our flow-sensitive, context-sensitive analysis determines possible deadlock configurations using a lock-order graph. This graph represents the order in which locks are acquired by the library. Cycles in the graph indicate deadlock possibilities, and our tool reports all such possibilities. We implemented our analysis and evaluated it on 18 libraries comprising 1245 kLOC. We verified 13 libraries to be free from deadlock, and found 14 distinct deadlocks in 3 libraries.


Symbolic State Program Point Deadlock Detection Java Library Client Code 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Artho, C., Biere, A.: Applying static analysis to large-scale, multi-threaded Java programs. In: ASWEC, pp. 68–75 (2001)Google Scholar
  2. 2.
    Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe programming: preventing data races and deadlocks. In: OOPSLA, pp. 211–230 (2002)Google Scholar
  3. 3.
    Breuer, P.T., Garcia-Valls, M.: Static deadlock detection in the Linux kernel. In: Ada-Europe, pp. 52–64 (2004)Google Scholar
  4. 4.
    Chaki, S., Clarke, E., Ouaknine, J., Sharygina, N.: Automated, compositional and iterative deadlock detection. In: MEMOCODE (2004)Google Scholar
  5. 5.
    Chaki, S., Clarke, E.M., Groce, A., Jha, S., Veith, H.: Modular verification of software components in C. IEEE TSE 30, 388–402 (2004)Google Scholar
  6. 6.
    Chase, D.R., Wegman, M., Zadeck, F.K.: Analysis of pointers and structures. In: PLDI (1990)Google Scholar
  7. 7.
    Corbett, J.C.: Evaluating deadlock detection methods for concurrent software. IEEE TSE 22, 161–180 (1996)Google Scholar
  8. 8.
    Demartini, C., Iosif, R., Sisto, R.: A deadlock detection tool for concurrent Java programs. Software: Practice and Experience 29, 577–603 (1999)CrossRefGoogle Scholar
  9. 9.
    DMS Decision Management Systems GmbH: The Kopi Project (2004),
  10. 10.
    Engler, D., Ashcraft, K.: RacerX: Effective, static detection of race conditions and deadlocks. In: SOSP, pp. 237–252 (2003)Google Scholar
  11. 11.
    Flanagan, C., Qadeer, S.: A type and effect system for atomicity. In: POPL, pp. 338–349 (2003)Google Scholar
  12. 12.
    Friedman-Hill, E.: Jess, the Java expert system shell (2004),
  13. 13.
    Havelund, K., Pressburger, T.: Model checking Java programs using Java PathFinder. STTT 2, 366–381 (2000)MATHGoogle Scholar
  14. 14.
    Havelund, K.: Using runtime analysis to guide model checking of Java programs. In: SPIN, pp. 245–264 (2000)Google Scholar
  15. 15.
    Havelund, K., Roşu, G.: Monitoring Java programs with Java PathExplorer. In: RV. (2001)Google Scholar
  16. 16.
  17. 17.
    Knizhnik, K., Artho, C.: Jlint (2005),
  18. 18.
    Li, T., Ellis, C.S., Lebeck, A.R., Sorin, D.J.: Pulse: A dynamic deadlock detection mechanism using speculative execution. In: USENIX Technical Conference, pp. 31–44 (2005)Google Scholar
  19. 19.
    Masticola, S.P., Ryder, B.G.: A model of Ada programs for static deadlock detection in polynomial time. In: Workshop on Parallel and Distributed Debugging (1991)Google Scholar
  20. 20.
    San Diego State University: SDSU Java library (2004),
  21. 21.
    Shih, C.S., Stankovic, J.A.: Survey of deadlock detection in distributed concurrent programming environments and its application to real-time systems. Technical report, UMass UM-CS-1990-069 (1990)Google Scholar
  22. 22.
    Singhal, M.: Deadlock detection in distributed systems. IEEE Computer 22, 37–48 (1989)Google Scholar
  23. 23.
    Sun Microsystems, Inc.: Java Development Kit (2004),
  24. 24.
    von Praun, C.: Detecting Synchronization Defects in Multi-Threaded Object-Oriented Programs. PhD thesis, Swiss Federal Institute of Technology, Zurich (2004)Google Scholar
  25. 25.
    Williams, A., Thies, W., Ernst, M.D.: Static deadlock detection in Java libraries. Research Abstract #102, MIT Computer Science and Artificial Intelligence Laboratory (February 2004)Google Scholar
  26. 26.
    Williams, A.L.: Static detection of deadlock for Java libraries. Master’s thesis, MIT Dept. of EECS (2005)Google Scholar
  27. 27.
    Zeng, F.: Deadlock resolution via exceptions for dependable Java applications. In: DSN, pp. 731–740 (2003)Google Scholar
  28. 28.
    Zeng, F., Martin, R.P.: Ghost locks: Deadlock prevention for Java. In: MASPLAS (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Amy Williams
    • 1
  • William Thies
    • 1
  • Michael D. Ernst
    • 1
  1. 1.Computer Science and Artificial Intelligence LaboratoryMassachusetts Institute of TechnologyCambridgeUSA

Personalised recommendations