This article is more than 1 year old

Facebook tackles race hate problem head on with programming tool

Clashing threads put in their place by RacerD

In Facebook's advertising business, a race condition might be construed as an ethnic descriptor used to prevent purchased ads from being displayed to a particular racial group.

Among its software engineers, it's a programming problem that arises when multiple operations run concurrently but are executed in an unexpected order. For example, if two threads running at the same time want to simultaneously increment the value of a shared integer, one of the threads may overwrite the other's change, and the variable will only be incremented once rather than twice.

Facebook deals with concurrency problems like this on a very large scale, and its computer scientists have invested considerable time and energy creating development tools to mitigate bugs of this sort.

In May, the social network's code boffins talked up their work on projects such as AL, a declarative language for writing bug checkers for Infer, a static code analyzer open sourced by the company.

On Thursday this week, they revealed RacerD, which rather than being an oblique reference to Speed Racer's older brother, Racer X turns out to be software for finding data races in Java code.

Automated

Data races and race conditions are both concurrency problems. Though they're not the same thing, there's often overlap. One distinction worth noting is that data races are more easily identified through automated analysis.

While perhaps best known among developers for its perverse affinity for PHP, Facebook also uses quite a bit of Java, particularly for its Android apps. Its engineers last year began rewriting News Feed for Android to move it from sequential processing to a multi-threaded model. It was a risky transition, recount Facebook research scientist Sam Blackshear and engineering manager Peter O'Hearn in a blog post, because concurrency errors tend to be difficult to diagnose and fix.

The social network's developer tools team had been exploring algorithms that would allow them to prove the absence of data races in code, to make concurrency more manageable at scale.

Asked for help by the News Feed for Android team, they shifted their focus to proving the opposite – the presence of data races under specific circumstances.

RacerD is the result. The now-publicly released open-source software looks for unsynchronized memory access, where write operations are involved. It works with Infer, which means it doesn't need to run code it is testing. Instead, it relies on symbolic reasoning to plot the possible paths through the app.

And it appears to work fairly well. After 10 months scouring Facebook's Android codebase, say Blackshear and O'Hearn, RacerD has caught more than 1,000 multi-threading issues, enabling Facebook engineers make fixes before deployment.

Now others who see a need for static concurrency analysis in Java code that uses locks or @ThreadSafe annotations can put RacerD to the test. ®

More about

TIP US OFF

Send us news


Other stories you might like