Perplexity Ruby / MySQL Error: "Invalid package: sequence number mismatch"

I am running a Rails application from MySQL on Heroku, and this error is completely perplexing to me. Everything works fine if I try to select one row, often if I try to select several. But if I try to select * or even several tens / hundreds of records, I get the following error:

ActiveRecord::StatementInvalid: Mysql::ProtocolError: invalid packet: sequence number mismatch(52 != 29(expected)): SELECT `people`.* FROM `people` LIMIT 30 OFFSET 10 /home/slugs/70bb5dad-9387-46c4-935d-cf74e70276a8/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log' /home/slugs/70bb5dad-9387-46c4-935d-cf74e70276a8/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:289:in `execute' /home/slugs/70bb5dad-9387-46c4-935d-cf74e70276a8/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/mysql_adapter.rb:619:in `select' /home/slugs/70bb5dad-9387-46c4-935d-cf74e70276a8/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all' 

Running Rails 3, Ruby 1.8.6, and MySQL 5.1.42.

I am really here, so any help would be greatly appreciated!

David

+6
ruby mysql ruby-on-rails
source share
4 answers

It looks like an error in the ruby-mysql connector when trying to run will_paginate with everyone, for example @ author.books.all.paginate (...)

https://github.com/tmtm/ruby-mysql/issues#issue/8

Quick fix to get back to gem ruby-mysql 2.9.3

Check for known errors depending on what you use when working with mysql buffer

+11
source share

This is what I do to configure my setup (on Ubuntu):

 sudo apt-get install mysql-server-5.1 mysql-client-5.1 libmysqlclient-dev sudo gem install mysql 

Make sure you are using the mysql gem, and not something else (e.g. ruby-mysql).

0
source share

In my situation, downgrading to ruby-mysql 2.9.3 did not solve it completely.

I also had to update this file: https://github.com/tmtm/ruby-mysql/commit/07ddfafafbd1d46bbb71c7cb54ae0f03bc998d27

And just to fix this problem ruby-mysql 2.9.4 works fine on ubuntu 10.04, but not on macos the snow leopard.

0
source share

I had this problem in the rails3 application, and it was decided that it was necessary to lower the rating of rubies from version 2.0.0 to version 1.9.3.

0
source share

All Articles