10.7 · Deadlocks, main-actor hops, Thread Sanitizer and Instruments

Concurrency bugs are the ones you cannot reproduce on demand. You need tools that catch them before they bite, and a short list of patterns to recognise.

Mental model. Do not hunt a race by reading. Make the machine report it: sanitizers at test time, instruments at profile time, compiler errors at build time.

Finding the bugs

Deadlocks, races, actor hops, and the tools for each.

  1. How do you find and fix deadlocks, data races and slow main-actor hops? 10.7.1 · L5
    Data races (two threads touching the same memory, one writing, with no synchronisation) are found by Thread Sanitizer (Product ▸ Scheme ▸ Diagnostics ▸ Thread…

More in Concurrency