DiscoverhexdevsFixing a Thread-Safety Bug with Nate Berkopec
Fixing a Thread-Safety Bug with Nate Berkopec

Fixing a Thread-Safety Bug with Nate Berkopec

Update: 2023-04-04
Share

Description

Can you tell if a Ruby gem is really thread-safe or not? And how do you fix a seemingly thread-safety issue that can be something else entirely?

We had no idea. So we asked Nate Berkopec to help us. Nate is an expert in Ruby performance.

The verdict: nuking all shared global mutable state in your Ruby code is a bad idea if you don't know what you're doing!

Listen to this episode to learn:
- How and why faker-ruby became thread-unsafe, especially for Puma users
- Questions to ask yourself when trying to debug thread-safety issues
- Shared global mutable state is not always the villain, and is not the source of all thread-safety issues
- Nate's "watch-out" list of things that can cause undesired behavior when running multi-threaded Ruby applications: Constants, Class Variables, and Rack Middleware.

Episode Notes
🔗 Full transcript and links


-----

A special thanks to Valentino Stoll, nfstern02, and Gregg P for sponsoring hexdevs!

Enjoy!

Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Fixing a Thread-Safety Bug with Nate Berkopec

Fixing a Thread-Safety Bug with Nate Berkopec

hexdevs