Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perplexing Ruby/MySQL Error: "invalid packet: sequence number mismatch"

I'm running a Rails app with MySQL on Heroku and this error has me totally perplexed. Everything works fine if I try to select a single row, often if I try to select a handful. But if I try to select *, or even a few dozen/hundred 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'm truly at my wit's end here, so any help would be greatly appreciated!

David

like image 912
David Avatar asked Jan 20 '11 14:01

David


1 Answers

Looks similar to a bug in the ruby-mysql connector when you try and run will_paginate with all, such as @author.books.all.paginate(...)

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

the quick fix there is to move back to gem ruby-mysql 2.9.3

Check for known bugs in whichever mysql connector gem you are running

like image 119
genkilabs Avatar answered Sep 21 '22 22:09

genkilabs