Facebook is known to most as a social network -- in fact, to many, it is "the" social network. However, it also releases a lot of its internal code and apps as open source projects for other developers to use. Accordingly, it has published a new "race detector," named RacerD, to help other developers find bugs in Java code.
A race detector looks for data races, also known as race conditions. This is when an event depends on something happening before it. RacerD searches for unsynchronized memory accesses in the app's code, where one of these accesses is a write. If that write access is changing something, then other memory accesses could be reading old data, causing a race condition.
Facebook's Android team used RacerD to weed out bugs when taking the News Feed from a single-threaded model to multi-threaded.
Facebook has been running RacerD on its Android app codebase for ten months and in that time, it has caught a thousand data race incidents, which have been fixed by Facebook's Android developers before the code reached production. The Facebook News Feed in the Android app has also been converted from single-threaded -- meaning one command is processed at a time -- to multi-threaded, so multiple commands can be executed at the same time. This makes the app faster and gives users a better experience, and it's all thanks to the team behind RacerD.
This will be especially useful for startups or "indie" developers making apps for Android, who have limited resources and need to have code-checking automated as much as possible. Java is a notoriously difficult language to learn and execute, so even for a seasoned developer, RacerD is almost certainly going to be helpful. Furthermore, multi-threaded applications are hard to code, and when data races do occur, RacerD may be a godsend for a small-time developer or startup struggling with an Android app.
RacerD is open source as of today and available for the Java programming language. The corresponding blog post is long and massively technical, describing how RacerD came about, what it does and how it does it and how to use it in your own Java projects. If you're a developer, it's well worth the read.