[Mongrel] Mongrels stop responding

Kirk Haines wyhaines at gmail.com
Tue Apr 1 18:06:32 EDT 2008

On Tue, Apr 1, 2008 at 3:56 PM, Jonathan Rochkind <rochkind at jhu.edu> wrote:
> I hadn't heard about threading issues. What if I'm still on 1.8.5 (I'm
> not the one who asked the question, but I do use mongrels and
> threading)--should I be concerned?

There are two issues.

When 1.8.5 was out, it was discovered that Array#shift had a stupid
bug in it that effectively leaked memory.  Mutex uses an Array to keep
a queue of threads that are waiting for a mutex, and it uses
Array#push and Array#shift to put things into the queue and take them
out of it..

There was a crude workaround, which was to monkey patch Mutex to use
Array#unshift and Array#pop, instead, which didn't leak.

However, an intrepid Rubyist took this opportunity to reimplement the
Ruby threading primitives as a C extension instead of pure Ruby.
Thus, the fastthread library was born.

Fastthread was accepted into Ruby 1.8.6 to replace the pure ruby
primitives, but the first several releases/patch levels had bugs.

Mongrel will use fastthread, so Ruby 1.8.5 w/ fastthread is a
perfectly fine platform.

If you are on Ruby 1.8.6, though, you need to be on p110 or higher, as
that patch level has both properly working threading primitives, and
has Array#shift fixed so it doesn't leak.

Kirk Haines

More information about the Mongrel-users mailing list