Thomas Parslow
2005-Aug-30 13:21 UTC
ActiveRecord::StatementInvalid error after app has been running for a while
Hi, I''m having a bit of a problem with a rails app and I wonder if anyone can help. It seems to run fine for a while, but if it''s left running too long (left running as a fastcgi or webrick process that is) it starts failing with an "ActiveRecord::StatementInvalid" error (i''ve included the full error from the log file below). I''m seeing this on both WEBrick on Windows XP (development environment) and Apache 2 with Fast CGI on Windows 2000 (production). Both using MySQL 4.1.13. Does anyone have any idea what the problem could be? The complete error message (from production.log) is: ----------------------------------------------------------------------------- ActiveRecord::StatementInvalid (Invalid argument: SELECT * FROM users WHERE login = ''admin'' AND password ''f268d34b95a6e379704365c14f4af0de262bdca2'' LIMIT 1): C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:462:in `log'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:121:in `execute'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:230:in `select'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:97:in `select_all'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:376:in `find_by_sql'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:343:in `find'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:341:in `find'' /app/models/user.rb:18:in `authenticate'' /app/controllers/security_controller.rb:7:in `login'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `send'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `perform_action_without_filters'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `measure'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in `perform_action'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:144:in `process_request'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:64:in `process!'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:55:in `each_cgi'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:595:in `each'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:595:in `each_cgi'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:55:in `process!'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:21:in `process!'' C:/rails/ordertrack/public/dispatch.fcgi:24 ----------------------------------------------------------------------------- Thanks very much for any help. tom
Steve Downey
2005-Aug-31 19:10 UTC
Re: ActiveRecord::StatementInvalid error after app has been running for a while
Thomas Parslow wrote:>Hi, > >I''m having a bit of a problem with a rails app and I wonder if anyone can help. > >It seems to run fine for a while, but if it''s left running too long >(left running as a fastcgi or webrick process that is) it starts >failing with an "ActiveRecord::StatementInvalid" error (i''ve included >the full error from the log file below). > >I''m seeing this on both WEBrick on Windows XP (development >environment) and Apache 2 with Fast CGI on Windows 2000 (production). >Both using MySQL 4.1.13. > >Does anyone have any idea what the problem could be? > > >I seem to remember someone saying that MySql (on Windows?) will disconnect after some amount of time (8 hours) if there is no activity. Could that be your problem?