The past weekend I had the enormous pleasure to speak at the Ruby on Ice 2018 conference in Tegernsee, Germany.

Figure 1. All Ruby conferences should have a view like this 😁

I decided to give the talk I wish I had seen about four years ago before I joined Talkdesk, on a number of gotchas and common mistakes one can do when working with Ruby and concurrency.

The talk was not recorded, but you can find the abstract and slides below. Also, any feedback is welcome!

Update: See this post for a video of this talk!

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.