I tested tracknowledge with Rails 2.2 yesterday. The main problem was with plugins: two out of the six I use failed with the same issue when used with threadsafe!
The issue is that ActiveSupport’s autoloading is turned off once threadsafe! is executed because autoloading is inherently thread-unsafe. These plugins were not explicitly requiring their classes in init.rb but instead relying on autoloading like so:
config/environment.rb:
Rails::Initializer.run do |config| config.threadsafe! end ExceptionNotifier.exception_recipients = %w(mikeATtracknowledge.org)
Yes, ExceptionNotifier was one of the broken plugins along with the GeoKit plugin. The fix is simple:
diff --git a/vendor/plugins/exception_notification/init.rb b/vendor/plugins/exception_notification/init.rb index b39bd95..b1dd2d9 100644 --- a/vendor/plugins/exception_notification/init.rb +++ b/vendor/plugins/exception_notification/init.rb @@ -1 +1,4 @@ require "action_mailer" +require 'exception_notifier' +require 'exception_notifiable' +require 'exception_notifier_helper'
If you maintain a Rails plugin, make sure you verify that all classes are loaded in init.rb or you could very well have problems too.

5 responses so far ↓
1 Sanjay // Nov 16, 2008 at 8:28 am
Mike, do you have an equivalent patch for Geokit?
2 mperham // Nov 16, 2008 at 12:30 pm
If I remember correctly, geokit is just missing a single require:
require ‘geo_kit/geocoders’
Bill, one of the geokit devs, is in process of fixing this and a JRuby incompatibility which I found.
3 Tom // Dec 17, 2008 at 9:53 am
Mike, do you remember where the GeoKit patch (the require…) goes exactly? Thanks, Tom
4 mperham // Dec 17, 2008 at 12:02 pm
vendor/plugins/geokit/init.rb, after the other requires.
5 Tom // Dec 17, 2008 at 1:42 pm
Thanks! Hm, already there. I got the latest SVN-copy, I guess from beginning of ‘08. Maybe it’s fixed.
Leave a Comment