As an additional note: this weekend I also needed to set
config.cache_classes = true in development.rb on my Mac, as suddenly ActiveRecord was giving me trouble. While rufus-scheduler was still running some major update, then as soon as I would open the first screen in my browser, rufus-scheduler would immediately get trigger() caught exception stack level too deep or trigger() caught exception undefined method `countries=' for #<BusinessPlan:0x38a0b58> (here, "countries=" is an ActiveRecord auto-generated method for an HABTM association; the exception also occurred for other auto-generated methods -- until the exception occurred ActiveRecord surely knew about those methods, as it was populating the MySQL database just fine) I could also see that some module I use in both the web pages and the scheduler was being initialised a second time. That is probably some major flaw in my code, but the problem took me to a Rails 2.0.2 bug at http://dev.rubyonrails.org/ticket/10896 The scary workaround to enable caching helps, as far as I can tell... Now, maybe this might be relevant for the Oracle sequence problem? Maybe ActiveRecord is also caching its sequences? A few more maybes, just for the archives: Maybe for me the sudden change is due to starting rufus-scheduler from enviroment.rb (earlier I started it in ApplicationController, which of course needs someone to request some web page to get it). Or, maybe it is caused by running the scheduler much earlier now (rather than only after 1 hour, the first run is now started before anyone probably requested some web page). Or, maybe it is because I added "ActiveRecord::Base.allow_concurrency = true" last week and since had not opened a web page while rufus-scheduler was running. Or, maybe I only noticed now because I set up a specific log file for the scheduler... Arjan. -----Original Message----- From: Arjan van Bentem Sent: Friday, May 30, 2008 10:46 AM To: OpenWFEru users Subject: RE: [openwferu-users] Re: Threads and ActiveRecord > ActiveRecord::Base.allow_concurrency = true > That did the trick. We had multiple jobs/threads using ActiveRecord. Just for the archives: apart from ActiveRecord::Base.allow_concurrency I also explicitly needed to add some Mutex things to code using Net::HTTP (to be more precise: OAuth), when executed by rufus-scheduler. Though I was only using a single instance of the scheduler, my workflow application also uses the same code. When an application user would trigger this code while the scheduler was also running it, I happily found the following in the log, making me realise I forgot about thread safety: Processing TaskController#update ... Net::HTTPBadResponse (wrong status line: "e_end>2037-12-31 00:00:00</pub_date_end>"): /usr/local/lib/ruby/1.8/net/http.rb:2031:in `read_status_line' /usr/local/lib/ruby/1.8/net/http.rb:2018:in `read_new' /usr/local/lib/ruby/1.8/net/http.rb:1059:in `request' /usr/local/lib/ruby/gems/1.8/gems/oauth-0.2.4/lib/oauth/consumer.rb:101: in `request' /usr/local/lib/ruby/gems/1.8/gems/oauth-0.2.4/lib/oauth/token.rb:44:in `request' /usr/local/lib/ruby/gems/1.8/gems/oauth-0.2.4/lib/oauth/token.rb:79:in `get' Not caused by rufus-scheduler, of course! Arjan. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OpenWFEru users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/openwferu-users?hl=en -~----------~----~----~----~------~----~------~--~---
