Concurrency is an extremely powerful technique that should be part of every Rubyist's tool belt. But when a lot of people pick up tools such as puma, concurrent-ruby or even JRuby, they are at the same time thrilled by all the power that threads and concurrency gets them, and afraid for the day when a concurrency bug will come and chew their arm (or service) off.
But what do we normally mean when we talk about a concurrency bug? What do they look like? And how do you fix them, preferably without giving up performance or readability? In this talk, I will show examples of Ruby patterns and techniques that lead to unsafe behavior in the presence of multi-threading, be it in MRI or JRuby. I will then discuss how they can be spotted, why they are problematic, and propose safe alternatives.