Quote:
Originally Posted by mistwang
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
it reconnect only at first request ofcorse.