Rails 2.2 is almost done. I'm testing rc release and in railties/lib/initializer they add
require_dependency
As far as i remember litespeed lsapi has problem with this. Let me explain:
When we turn on (in production mode) config.cache_classes = true
Then rails 2.2 will load all models, helpers, controllers only once at first start. But it generate strange errors like:
i will show some exemples:
undefined method `limit' for nil:NilClass
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session/active_record_store.rb:73:in `data_column_size_limit'
----------------------------------------------------------------------
undefined method `zero?' for "1":String
[RAILS_ROOT]/app/controllers/movies/home_controller.rb:17:in `index'
This errors are only if cache_classes = true but without this it is imposible to run rails application fast.
Rails 2.1 and before didn't used require_dependency to load all classes but some time ago i was traing use it and has simillar isuses (errors in strange places) http://litespeedtech.com/support/for...ead.php?t=1712
At this point, we do really know where to start to trouble shoot this problem.
I had solution for described problem.
1. I use dispatcher.lsapi not RailsRunner.rb.
When i switched to RailsRunner my webpage starts working ok on lsapi BUT...
when i restart server there was errors:
Code:
Mysql::Error: MySQL server has gone away: SHOW FIELDS FROM `users`
Problem is witch db connections:
Code:
#Close all DB connections established during initialization
ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
while LSAPI.accept != nil
Dispatcher.dispatch
end
When lsapi starts ruby process and forks them first request get error with connection to db (about server gone) so i make litle change in dispatcher:
Code:
#Close all DB connections established during initialization
ActiveRecord::Base.connection.disconnect! and @reconnect = true if defined?(ActiveRecord::Base)
while LSAPI.accept != nil
if defined?(ActiveRecord::Base) and @reconnect
ActiveRecord::Base.connection.reconnect!
@reconnect = false
end
Dispatcher.dispatch
end