kirancodes.me
To Proof Maintenance & Beyond!

Is this class thread-safe? inferring documentation using graph-based learning

Andrew Habib, Michael Pradel

Abstract

Thread-safe classes are pervasive in concurrent, object-oriented software. However, many classes lack documentation regarding their safety guarantees under multi-threaded usage. This lack of documentation forces developers who use a class in a concurrent program to either carefully inspect the implementation of the class, to conservatively synchronize all accesses to it, or to optimistically assume that the class is thread-safe. To overcome the lack of documentation, we present TSFinder, an approach to automatically classify classes as supposedly thread-safe or thread-unsafe. The key idea is to combine a lightweight static analysis that extracts a graph representation from classes with a graph-based classifier. After training the classifier with classes known to be thread-safe and thread-unsafe, it achieves an accuracy of 94.5% on previously unseen classes, enabling the approach to infer thread safety documentation with high confidence. The classifier takes about 3 seconds per class, i.e., it is efficient enough to infer documentation for many classes.

BibTeX
@inproceedings{Habib-Pradel:ASE18,
  author    = {Andrew Habib and
               Michael Pradel},
  title     = {Is this class thread-safe? inferring documentation using graph-based learning},
  booktitle = {ASE},
  pages     = {41--52},
  publisher = {{ACM}},
  year      = {2018},
}

Related papers