2010-12-07 15 views
0

我工作的一個Rails(2.3.4)應用程序,它是一個使用MySQL的空間擴展,因此我使用GeoRuby(1.3.4)和spatial_adapter(1.1.2)的寶石。ActiveSupport.remove_constant - 異常NameError

,因爲我開始不過使用GeoRuby的Point對象以來,我遇到麻煩時的ActiveSupport試圖處理請求後刪除常量:

[ pid=18105 thr=67398490 file=utils.rb:176 time=2010-12-07 15:00:38.894 ]: *** Exception NameError in application (cannot remove Object::Geometry) (process 18105, thread #<Thread:0x808d6b4>): 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `remove_const' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `remove_constant' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `instance_eval' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `remove_constant' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:450:in `remove_unloadable_constants!' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:450:in `each' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:450:in `remove_unloadable_constants!' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:236:in `clear' 
from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/dispatcher.rb:64:in `cleanup_application' 
from /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/reloader.rb:17:in `close' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/rack/request_handler.rb:136:in `process_request' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/utils.rb:479:in `safe_fork' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `__send__' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:180:in `start' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `__send__' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' 
from /opt/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/helper-scripts/passenger-spawn-server:99 

這最終導致Apache的接收SIGTERM(可能是因爲它正在消耗線程或其他東西),所以服務器偶爾無法響應任何請求。

奇怪的是'Object :: Geometry' - 我期望讀'GeoRuby :: SimpleFeatures :: Geometry'來代替(我使用了幾個GeoRuby :: SimpleFeatures :: Point,它是幾何的一個子類)。

我也注意到如何在3.0.0的ActiveSupport,爲remove_constant的代碼是從我使用的版本不同。該更新是否解決了這個問題?如果是的話,是否需要更新Rails 3.0?

回答

0

我鴨的磁帶通過在active_support/dependencies.rb與開始救援端子句周圍有問題的代碼(該remove_constant方法體),以忽略異常固定它。我不知道這是否有任何負面的副作用,但至少它不會造成現在的Apache,然後再重新啓動每一個。

相關問題