From: "Jones, Brian - McClatchy Interactive" Date: 2007-11-07T06:07:19+09:00 Subject: Re: Long running SQL query via ActiveRecord blocking the entire Ruby process? > To my surprise, a long running SQL query via ActiveRecord > blocks an entire Ruby process (all the other threads are > blocked while the thread that runs the SQL query is waiting > for the result set) > > Has anyone else found this to be the case? (am I mistaken?) > Is there any way to avoid this other than spawning a separate process? > > [Ruby version 1.8.4, ActiveRecord version 1.14.4 on Linux] As far as I know, things like Mongrel obtain a global lock -> run the request through rails -> and release the lock. Rails isn't thread safe, and a great deal of hackery depends upon this non-threaded mode of operation. To handle multiple requests, you'll need multiple processes. I'm curious, do you have something attempting to run the same rails in multiple ruby threads at the same time? Brian