i keep on getting ActiveRecord::MissingAttributeError errors randomly everywhere in my program. i have passenger (30 instances) running with nginx. i don't have this problem in dev. When i remove cache money it works fine in production.
this is the error msg:
ActiveRecord::MissingAttributeError (missing attribute: deposit_amount):
lib/econveyance_pro/accounting/bsoa.rb:96:in `collect_deposit'
lib/econveyance_pro/accounting/bsoa.rb:24:in `calculate'
app/controllers/accounting_controller.rb:213:in `calculate_buyer_file_accounting'
app/controllers/accounting_controller.rb:175:in `generate_accounting'
app/controllers/accounting_controller.rb:153:in `generate_accounting_and_save'
lib/econveyance_pro/document_manager.rb:18:in `temporary_tables_xml'
lib/econveyance_pro/document_manager.rb:17:in `each'
lib/econveyance_pro/document_manager.rb:17:in `temporary_tables_xml'
app/controllers/document_manager_controller.rb:40:in `xml'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/railz/application_spawner.rb:385:in `start_request_handler'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/railz/application_spawner.rb:343:in `handle_spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/utils.rb:184:in `safe_fork'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/railz/application_spawner.rb:341:in `handle_spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:163:in `start'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/railz/application_spawner.rb:209:in `start'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server_collection.开发者_JAVA技巧rb:80:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
/opt/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.8/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
deposit_amount does exist in my db.
Did you change your database table schema? The memcached objects are probably using the old schema and need to be cleared out.
Flush memcached using $cache.flush_all, sending "flush_all" to memcached via 'telnet localhost 11211', or by restarting memcached.
Missing attribute might exist in your db, but does exists in your schema and migrations?
try accessing it via an sql query yourself, then in the console, if you can on both, check your controller for spelling mistakes in the sql
The thing is when i stop using cache money this part of the code works fine without out a problem. Soon as i enable cache money i get this error, i have been through the query couple of times.
I also get this error in random areas of the program for different attributes, when cache money is turned on.
I think it could be a production issue. When you start an application in production env, it makes cache inside of the application of all files. U didnt explain it completely, but i do think that the problem is because u did rolled a migration and maybe did not restart the server.
If this is the case it might be because the cache u are using may still have dome references to this attribute that doenst exist anymore. =)
精彩评论