[Backgroundrb-devel] postgres barfage revisted

Ezra Zygmuntowicz ezmobius at gmail.com
Mon Mar 5 17:57:16 EST 2007


	Yeah with the new multi process bdrb you probably need to set  
allow_concurrency to false. I don't think you will have a problem  
with it like that. If you do run into a problem then you may have to  
put a mutex around the calls to your database:

@mymutex = Mutex.new

@mymutex.synchronize {
     # calls to database in here.


On Mar 5, 2007, at 2:13 PM, Jack Nutting wrote:

> First of all, I'd like to do what I've seen several others here do:
> thank Ezra and any other contributors for producing a really great
> plugin.  Even though I'm having some minor problems, this is all so
> approachable and easy to work with and dig into...  I hate to think of
> the hoops you'd need to jump through (both as creator of such a system
> and as a user) to do something similar in Java.
> Now then...  I've stumbled across the problem described here:
> http://rubyforge.org/pipermail/backgroundrb-devel/2006-August/ 
> 000299.html
> wherein the native Ruby adaptor for Postgres causes Backgroundrb to
> crap out with messages like this:
> ActiveRecord::StatementInvalid: NoMethodError: undefined method
> `async_query' for #<PGconn:0x22ed648>:
> The author's suggested solutions were to either use the compiled
> ruby-postgres, or set ActiveRecord::Base.allow_concurrency to false in
> a start script.
> Well, the first option seems tricky to me;  I haven't succeeded in
> getting that compiled for Mac OS X yet (granted, I haven't given it
> too much effort yet), so I figured I'd try the second option.  I
> couldn't find any start script where I could actually make that
> setting have any effect, and eventually I realized that it's being set
> to true at worker_rails.rb:21.  If I comment out that line, suddenly
> I'm back in business!
> What I wonder is if I'm setting myself up for future catastrophe with
> that change.  I figure it's got to be in there for *some* reason.  I
> think I read somewhere that Backgroundrb changed from a multi-thread
> to a multi-process architecture not too long ago;  Is that line,
> setting allow_concurrency to true, a holdover from the multi-threaded
> days that's no longer needed?
> -- 
> // jack
> // http://www.nuthole.com
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel

-- Ezra Zygmuntowicz 
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)

More information about the Backgroundrb-devel mailing list