Heroku Problem During Database Pull of Rails App: Mysql::Error MySQL server has gone away
Asked Answered
P

3

6

Attempting to pull my database from Heroku gives an error partway through the process (below).

Using: Snow Leopard; heroku-1.8.2; taps-0.2.26; rails-2.3.5; mysql-5.1.42. Database is smallish, as you can see from the error message.

Heroku tech support says it's a problem on my system, but offers nothing in the way of how to solve it.

I've seen the issue reported before - for example here. How can I get around this problem?

The error:

$ heroku db:pull
Auto-detected local database: mysql://[...]@localhost/[...]?encoding=utf8
Receiving schema
Receiving data
17 tables, 9,609 records
[...]
/Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:166:in `query': Mysql::Error MySQL server has gone away (Sequel::DatabaseError)
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:166:in `_execute'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:125:in `execute'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/connection_pool.rb:101:in `hold'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:461:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:125:in `execute'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:296:in `execute_dui'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset.rb:276:in `execute_dui'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:365:in `execute_dui'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `import'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `each'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `import'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:144:in `transaction'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/connection_pool.rb:108:in `hold'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:461:in `synchronize'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:138:in `transaction'
    from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/dataset/convenience.rb:126:in `import'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:211:in `cmd_receive_data'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:203:in `loop'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:203:in `cmd_receive_data'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:196:in `each'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:196:in `cmd_receive_data'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:175:in `cmd_receive'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/commands/db.rb:17:in `pull'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/commands/db.rb:119:in `taps_client'
    from /Library/Ruby/Gems/1.8/gems/taps-0.2.26/lib/taps/client_session.rb:21:in `start'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/commands/db.rb:115:in `taps_client'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/commands/db.rb:16:in `pull'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/command.rb:45:in `send'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/command.rb:45:in `run_internal'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/../lib/heroku/command.rb:17:in `run'
    from /Library/Ruby/Gems/1.8/gems/heroku-1.8.2/bin/heroku:14
    from /usr/bin/heroku:19:in `load'
    from /usr/bin/heroku:19
Pulchritudinous answered 30/3, 2010 at 21:5 Comment(2)
Found this post, have the same problem. Any luck? I wondered about encoding since my local db is in utf-8 by default, but haven't been able to get it to work.Felipe
Don't use a different database in production and development. Don't use taps. Use pgbackups. Try postgresapp.com for installing postgres on os x.Slouch
O
16

I ran into the same issue on my system. I finally figured out that the problem is the error lies.

Digging into the Sequel library I was able to determine that the actual error I was receiving was "Got a packet bigger than 'max_allowed_packet' bytes". Setting the following in /etc/my.cnf and restarting mysql fixed the issue for me.

[mysqld]
   max_allowed_packet = 32M

By default mysql is configured to allow a maximum of 1 meg data loads. The above sets the limit to 32 megs.

Overturf answered 2/6, 2010 at 14:29 Comment(1)
Don't forget to restart mysql!Allheal
I
1

It is a problem on your system. Your connection to your local MySQL server has been dropped while trying to push to Heroku. A newer version of Sequel may help, but I'm not sure if taps will use it.

Icily answered 30/3, 2010 at 22:59 Comment(0)
T
-1

As above this does work. Simply create a file: /etc/my.cnf and restart mysql.

[mysql]
max_allowed_packet=32M
[mysqld]
max_allowed_packet=32M
Tautologize answered 17/11, 2010 at 19:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.