Fixing, preventing, and recovering from concurrency bugs