A Strategy for Race Condition Reproduction
Before we get into the specific techniques for reproducing race conditions, let’s establish an overall strategy to guide how we approach the problem. Reproducing race conditions requires being able to carefully orchestrate the sequence of events in the critical section, preferably in a way that will not change when we fix the race condition. Understanding the exact nature of the race condition lets us understand the boundaries of the critical section and therefore the scope of our possible control of the execution. We are looking for the seams within the critical section.
In Listing 13-2, our race condition is bounded by testing for the null
-ness of resource
at line 2 and the assignment to resource ...
Get Quality Code: Software Testing Principles, Practices, and Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.