Testing race conditions with memory access tracing and stack-based delay injection