Google Releases New ThreadSanitizer Data Race Detection Tool

The new ThreadSanitizer Version 2 helps developers find even more threading errors in code so that bugs can be reduced and systems can be made more efficient.

Download the authoritative guide: Big Data: Mining Data for Revenue

Google's latest ThreadSanitizer tool has been updated to Version 2, giving the five-year-old tool improved capabilities to help developers find more coding problems in less time than in the past.

ThreadSanitizer (aka TSan) is a runtime data race detector based on binary translation, which was originally developed by Google engineers in 2009, wrote Alexander Potapenko, a Google software engineer, in an April 21 post on The Chromium Blog. "The tool helped find thousands of threading errors in various projects, including almost 180 bugs in Chromium. In 2010, we started experimenting with compiler-based instrumentation instead of binary translation, and once the approach had proven itself, our team redesigned ThreadSanitizer from scratch, focusing on compile-time instrumentation for greater speed and accuracy."

Now the team has pushed the development of ThreadSanitizer v2 even farther, he wrote. Now part of both LLVM and GCC, the new tool is "able to detect data races in C++ and Go code, but it is also able to report synchronization issues like deadlocks, unjoined threads, destroying locked mutexes, use of async-signal unsafe code in signal handlers, and others."
The improved ThreadSanitizer v2 "recognizes atomic operations, so it produces far more accurate reports and can also find bugs in lock-free algorithms, which are hard to detect otherwise," wrote Potapenko. "For example, it has helped us find incorrect synchronization in LazyInstance, incorrect lock-free queue implementation and issues with concurrent sweeping in V8."
ThreadSanitizer v2 is up to 20 times faster than the old ThreadSanitizer, "which makes it possible to use it for heavyweight browser tests," he wrote. "Thanks to this, we've found several bugs in code that weren't covered by smaller unit tests, like races on the WebKit strings, garbage collection in Blink, a use-after-free in Blink, a handful of reports in WebRTC and many more. This has also improved bug reproducibility: The more times the test is repeated, the higher the chance to reproduce a flaky bug."

Almost 100 bugs were detected by the new tool in the last six months, he wrote. "Our future plans include extensive use of TSan on ClusterFuzz and adding regular testing for various Chromium subprojects to catch new regressions quickly," wrote Potapenko.

Developers can find more information on using the improved tools on the ThreadSanitizer page, he wrote. "The tool is easy to use and can be integrated with any build system: just add a single compile-time flag and run the program to see the error reports. For Chromium developers, there's a special page with instructions on"

Google is always working on new and improved tools for developers of their products.

In December 2013, Google added new Chrome tools , including expanded emulation and screencasting capabilities as well as new debugging tools, to help developers test and debug their mobile apps more quickly. The tools allowed app developers to see how their code displayed on mobile devices as they wrote, which helped them create better code and apps.

The new developer tools updates for Chrome follow another recent round of three new tools that were added in August 2013. Those tools included Workspaces, which allows developers to live-edit source files within DevTools with bidirectional disk persistence; CSS preprocessor mapping; and Snippets, which let developers create, edit, save and execute custom JavaScript snippets.

In July 2013, Google released a new Dart Software Development Kit and Editor in beta to help developers create their code more quickly. The company also began experimenting with a new network protocol, called QUIC (Quick UDP Internet Connections), which could help speed up network connections in the future.

The new Dart SDK and Editor was in its first beta release and contained performance and productivity improvements aimed at helping developers automate their code creation, produce smaller JavaScript code and deploy Dart Web apps.

In June 2013, Google unveiled a new Cloud Playground environment where developers can quickly try out ideas on a whim, without having to commit to setting up a local development environment that's safe for testing coding experiments outside the production infrastructure. The new Cloud Playground is presently limited to supporting Python 2.7 App Engine apps.

Also in June 2013, Google opened its Google Maps Engine API to developers so they can build consumer and business applications that incorporate the features and flexibility of Google Maps. By using the Maps API, developers can now use Google's cloud infrastructure to add their data on top of a Google Map and share that custom mash-up with consumers, employees or other users. The maps can then be shared internally by companies or organizations or be published on the Web.