Mysterious intermittent deadlock in threaded mode on ruby 1.9.1-p378
Reported by Nathan Sobo | November 25th, 2010 @ 12:21 PM
It occurs when the reactor tries grabs a mutex to push an operation onto the thread pool's queue in EM.defer.
<internal:prelude>:6:in `lock': deadlock detected (fatal)
from <internal:prelude>:6:in `synchronize'
from /Users/nathansobo/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/thread.rb:148:in `push'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/bundler/gems/eventmachine-6c7997798034/lib/eventmachine.rb:996:in `defer'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/connection.rb:54:in `process'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/bundler/gems/eventmachine-6c7997798034/lib/eventmachine.rb:195:in `run_machine'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/bundler/gems/eventmachine-6c7997798034/lib/eventmachine.rb:195:in `run'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/bin/thin:19:in `load'
from /Users/nathansobo/.rvm/gems/ruby-1.9.1-p378/bin/thin:19:in `<main>'`
There's reference to this exact same stack trace in another
(resolved) ticket:
https://thin.lighthouseapp.com/projects/7212/tickets/118-threaded-m...
I am using an EventMachine release that incorporates the supposed fix to that issue: ref 6c7997798034
I'm confused as to how pushing onto a stdlib queue could ever cause a deadlock. I don't understand what other blocked thread could possibly be holding this mutex, because the critical section doesn't grab any locks or invoke any code. Am I missing something big?
Perhaps this is the wrong forum to bring this up, but I figured I'd start at the top of the stack.
Thanks for your time!
Comments and changes to this ticket
-

Marc-André Cournoyer December 1st, 2010 @ 05:25 PM
You should report this issue to EventMachine project. The Thin threaded option is still considered experimental (see thin -h).
-

Adriana February 20th, 2026 @ 09:03 AM
I recommend purchasing travel insurance for winter sports here https://sportravelling.com/winter-sports/ Skiing, snowboarding, freeriding, or heli-skiing carry risks of fractures, frostbite, avalanches, and equipment damage, which standard policies usually ignore, leading to enormous rescue and medical expenses. Sportravelling provides specialized policies for all winter activities worldwide, from the slopes of the Alps to Alaska and Japan. They include emergency medical assistance for injuries, helicopter evacuation, repatriation, reimbursement for lost equipment, skis, snowboards, luggage, or clothing, trip postponement due to bad weather, COVID, or emergencies, as well as liability insurance and legal support. Options include single, multiple, or annual coverage up to age 80, including children, families, and professionals. This is the most rational choice, as regular travel insurance does not cover such extreme sports, and here you get real, prompt payments without medical examinations or unnecessary formalities. Visit the website, select the type of sport, period, location, age, gender, and level of danger, and the calculator will calculate the rate. Pay by card and download the ready-made PDF. -policy by mail with a 24-hour hotline in different languages, guaranteeing you a carefree winter vacation without surprises.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »