Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1697 (closed defect: invalid)

Opened 5 years ago

Last modified 4 years ago

webrick db connection fix breaks mysql

Reported by: court3nay Assigned to: David
Priority: high Milestone:
Component: ActiveRecord Version: 0.13.0
Severity: critical Keywords: webrick pooling connection
Cc: court3nay@gmail.com, ryan.platte+railsticket1697@gmail.com

Description

the latest fixes to webrick conn pooling screw up the db connection.

webrick, windows, mysql 4.1.17 (c bindings ver 2.5ish)

 svn update vendor/rails
 ruby script/server
       - first db access works. any subsequent db accesses get "packets out of order" error.
 cd vendor/rails
 svn update -r 1790
 everything works again.

Change History

07/10/05 21:36:51 changed by court3nay

from my logs. note the db craps out *halfway through* a request

Processing PhotosController#show (for [ip] at Sun Jul 10 19:02:40 Pacific Daylight Time 2005)
  Parameters: {"action"=>"show", "id"=>"3218", "controller"=>"photos"}
  Photo Columns (0.000000)   SHOW FIELDS FROM photos
  Address Columns (0.000000)   SHOW FIELDS FROM addresses
  Photo Load Including Associations (0.000000)    * long sql statement * WHERE photos.id = '3218' 
  Hit Load (0.000000)   Packets out of order: 4<>102: SELECT * FROM hits WHERE link_id=3218 and type='PhotoHit' 
  Geocoded Load (0.000000)   Packets out of order: 5<>102: SELECT * FROM geocoded WHERE geocoded.address_id = 764 LIMIT 1


ActiveRecord::StatementInvalid ('Packets out of order' error was received from the database. Please update your mysql bindings (gem update mysql) and read http://dev.mysql.com/doc/mysql/en/password-hashing.html for more information.):
    /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:133:in `execute'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:230:in `select'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:97:in `select_all'
    /vendor/rails/activerecord/lib/active_record/base.rb:374:in `find_by_sql'
    /vendor/rails/activerecord/lib/active_record/base.rb:341:in `find'
    /vendor/rails/activerecord/lib/active_record/base.rb:339:in `find'
    /vendor/rails/activerecord/lib/active_record/associations/has_one_association.rb:60:in `find_target'
    /vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:77:in `load_target'
    /vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:19:in `reload'
    /vendor/rails/activerecord/lib/active_record/associations.rb:609:in `geocoded'
    /vendor/rails/activerecord/lib/active_record/associations.rb:602:in `geocoded'
    /app/models/address.rb:13:in `lat'
    /vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:24:in `send'
    /vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:24:in `method_missing'
    /app/models/photo.rb:45:in `lat'
    /app/controllers/photos_controller.rb:86:in `show'
    /vendor/rails/actionpack/lib/action_controller/base.rb:756:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:756:in `perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:41:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:80:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:356:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:356:in `process'
    /vendor/rails/railties/lib/dispatcher.rb:32:in `dispatch'
    /vendor/rails/railties/lib/webrick_server.rb:105:in `handle_dispatch'
    /vendor/rails/railties/lib/webrick_server.rb:71:in `service'
    c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'
    c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'
    /vendor/rails/railties/lib/webrick_server.rb:57:in `dispatch'
    script/server:49


Rendering R:/courtenay/coding/rails/sv5_working/vendor/rails/actionpack/lib/action_controller/templates/rescues/layout.rhtml (500 Internal Error)
  User Columns (0.000000)   Packets out of order: 1<>97: SHOW FIELDS FROM users
  User Columns (0.000000)   Packets out of order: 1<>105: SHOW FIELDS FROM users
  User Columns (0.000000)   Packets out of order: 1<>104: SHOW FIELDS FROM users
  User Columns (0.000000)   Packets out of order: 1<>4: SHOW FIELDS FROM users
  User Columns (0.000000)   SHOW FIELDS FROM users

07/11/05 06:52:18 changed by david

I'm unable to replicate this problem. I've tried using both the Ruby and C based adapter against my 4.1.11 MySQL and all works fine. Anyone else seeing this?

Are you not having the same problem with FCGI, then?

07/11/05 07:03:40 changed by court3nay

its on my dev box (no fastcgi, just webrick)

will investigate more with a new checkout of rails

07/11/05 07:05:04 changed by david

This sounds like the dreaded old password/new connector problem.

07/11/05 07:26:57 changed by court3nay

ironically, i wrote that exact error message.

07/12/05 00:36:14 changed by court3nay

  • status changed from new to closed.
  • resolution set to invalid.

fix: update your mysql bindings.

problem: ARRRGH!! it's almost impossible for windows users to gem install mysql. trust me! you can go from source, cygwin, gcc, mingw, whatever you like. just. doesn't. work. (for me)

how to fix (for anyone searching for this, in future).

  1. download the 'ruby for apache' installer. it's actually 'mysql and apache bindings for ruby for windows'. http://rubyforge.org/forum/forum.php?forum_id=3391
  2. install it. select "mysql.so".
  3. there is no step 3. except maybe restart everything.

(you may need to copy libmysql.dll from your mysql dir to windows\system32)

08/18/05 12:26:20 changed by nathan@brandalism.com

I'm seeing the same error on my OSX box, Tiger version 10.4.2, MySQL version 4.1.11

08/18/05 12:33:35 changed by nathan

I ran across a fix for the mysql errors on OSX. See <URL: http://www.gpshewan.com/articles/2005/07/28/running-typo-locally-on-osx >. Basically OSX users need to select version 3.3 of the GCC compiler when building the mysql gem.

10/03/05 13:38:54 changed by Ryan Platte <ryan.platte+railsticket1697@gmail.com>

  • cc changed from court3nay@gmail.com to court3nay@gmail.com, ryan.platte+railsticket1697@gmail.com.

I got this error also using MySQL 4.1.11 under OS X Tiger, but with the pure-Ruby MySQL binding. Is there a fix available for that binding?

Also, did it turn out that this problem was not related to the Rails version after all? That was part of the original report but I didn't see it refuted directly after that.

10/03/05 14:18:55 changed by Ryan Platte <ryan.platte+railsticket1697@gmail.com>

  • status changed from closed to reopened.
  • resolution deleted.

Looks like someone solved the pure-Ruby binding problem on the Rails wiki:

http://wiki.rubyonrails.com/rails/pages/MySQL+Database+access+problem

When I have a spare moment, I'll run the tests against that patch (though for me the problem was never showing up during tests), and attach it to this ticket.

11/05/05 21:08:55 changed by david

  • keywords changed from webrick pooling connection to fd webrick pooling connection.

11/13/05 10:37:08 changed by bitsweat

  • keywords changed from fd webrick pooling connection to webrick pooling connection.
  • status changed from reopened to closed.
  • resolution set to invalid.

It's unclear what the problem is here. This is a grab bag of common errors involving the MySQL bindings.

Please reopen with evidence of a real, reproducible problem with database connections that is particular to webrick.