Facebook revealed a new open source tool today that’s designed to help developers build more complex apps with less work by detecting bugs that are typically difficult to suss out and squash. Called RacerD, it’s a system that examines code for nasty issues known as race conditions and helps identify how to prevent them.
Race conditions appear when coders try to implement concurrency in their programs, so that an app can work on multiple tasks at once. That’s all well and good, but gnarly bugs can crop up when two or more parts of the program try to change the same data at the same time. In that case, it’s possible for both operations to get the incorrect result, screwing up things further down the line.
But finding race conditions is incredibly difficult. It’s basically impossible to test for all the potential problems in an app, and the bugs resulting from a race condition can be inconsistent and hard to diagnose. That’s where RacerD comes in.
Facebook’s system runs when a piece of code is compiled, producing a report about where in a program possible race conditions could arise. Peter O’Hearn, a research scientist at Facebook, said in an interview that while RacerD isn’t guaranteed to catch all of the race condition bugs, it will find most of them.
Using RacerD, Facebook’s Android team caught over 1,000 race condition bugs while they converted that app’s news feed to use concurrency. The conversion provided a 5 percent performance increase for the app, which is a significant improvement in this case.
Right now, RacerD is compatible with Java, though O’Hearn said that the company is working on making it compatible with C++ as well.