[Mongrel] Mongrel spewing backtraces and nanosleeping

Jacob Atzen jacob at jacobatzen.dk
Thu Sep 14 11:27:52 EDT 2006

On Thu, Sep 14, 2006 at 08:07:38AM -0600, Kirk Haines wrote:
> I am wondering if this might arise because of a potential race
> condition within Sync?  A 'Thread.critical = true' does not affect
> threads that did not exist at the time that it was called, and the
> lock() in Sync does quite a bit of work between when it declares a
> critical area and when a thread either gets the lock or does not.
> If a bunch of threads are killed very quickly, one of the remaining
> threads will get into that thread critical section, but I think it may
> be possible for a newly spawned thread to also get into there before
> the other one finishes its work.
> If that happens, and two threads think they have the lock, while Sync
> thinks only one does, then when the one that does not have the lock
> calls unlock, you get the error that you reported.
> Jacob, I have attached a version of thread.rb that makes a slight
> change to Mutex to avoid the memory management issues that the stock
> one runs into with regard to Array.  It is otherwise identical to the
> stock thread.rb.  I am curious if you replace your thread.rb with this
> one, and flip Mongrel back to using Mutex, if you can still get this
> same failure mode to happen?

How do I get Mongrel to use Mutex?

- Jacob Atzen

More information about the Mongrel-users mailing list