# Migrate hangs on Mac OS X

**URL:** <https://www.ruby-forum.com/t/migrate-hangs-on-mac-os-x/55282>\
**Category:** Rails\
**Created:** [March 19, 2006, 12:18am UTC](https://www.ruby-forum.com/t/migrate-hangs-on-mac-os-x/55282 "2006-03-19T00:18:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![parki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b782af/32.png) [@parki](https://www.ruby-forum.com/u/parki)\
**Post date:** [March 19, 2006, 12:18am UTC](https://www.ruby-forum.com/t/migrate-hangs-on-mac-os-x/55282/1 "2006-03-19T00:18:25Z")

</div>

Hello:

A plea for help. I’m following the instructions here:

[http://developer.apple.com/tools/rubyonrails.html](http://developer.apple.com/tools/rubyonrails.html)

I have everything working on my main machine, but my laptop is refusing  
to work. When I get to the step of ‘rake migrate’ the process hangs. I  
have the output below.

The mysql gem is installed, and a test program can talk to the database  
fine.

The only difference that I can see between the machine that works, and  
the machine that doesn’t is that the working one has mysql 4.1.5, and  
the non-working one has 4.1.18 (current).

Stumped.

Anyone?

Bueller?

Thanks.

parki…

expenses: rake migrate -t  
(in /Users/parki/develop/rails/expenses)  
\*\* Invoke migrate (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute migrate  
^Crake aborted!

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/vendor/mysql.rb:1079:in  
`read' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:1079:in `read’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/vendor/mysql.rb:499:in  
`read' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:492:in `command’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/vendor/mysql.rb:339:in  
`stat' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:147:in `active?’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:103:in  
`retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:107:in  
`retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/migration.rb:178:in  
`migrate' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/tasks/databases.rake:3 /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/tasks/databases.rake:2:in `call’  
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:in `invoke’  
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `each’  
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7 /usr/bin/rake:18:in `load’  
/usr/bin/rake:18

---

<div class="post-metadata">

**Author:** ![parki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b782af/32.png) [@parki](https://www.ruby-forum.com/u/parki)\
**Post date:** [March 19, 2006, 1:08am UTC](https://www.ruby-forum.com/t/migrate-hangs-on-mac-os-x/55282/2 "2006-03-19T01:08:26Z")

</div>

Brian P. wrote:

> Hello:
> 
> A plea for help. I’m following the instructions here:
> 
> [http://developer.apple.com/tools/rubyonrails.html](http://developer.apple.com/tools/rubyonrails.html)

I did a bit more digging - the migration stalls here in mysql.rb - it’s  
waiting on the 4 bytes for length, which presumably never come back from  
the server:

```
def read()
  buf = []
  len = nil
  @sock.sync = false
  while len == nil or len == MAX_PACKET_LENGTH do
a = @sock.read(4) <------------------------------- HERE
len = a[0]+a[1]*256+a[2]*256*256
pkt_nr = a[3]
if @pkt_nr != pkt_nr then
  raise "Packets out of order: #{@pkt_nr}<>#{pkt_nr}"
end
@pkt_nr = @pkt_nr + 1 & 0xff
buf << @sock.read(len)
  end
  @sock.sync = true
  buf.join
rescue
  errno = Error::CR_SERVER_LOST
  raise Error::new(errno, Error::err(errno))
end

```

---

<div class="post-metadata">

**Author:** ![parki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b782af/32.png) [@parki](https://www.ruby-forum.com/u/parki)\
**Post date:** [March 19, 2006, 11:52pm UTC](https://www.ruby-forum.com/t/migrate-hangs-on-mac-os-x/55282/3 "2006-03-19T23:52:19Z")

</div>

Fixed.

I don’t know what was causing this, but I re-installed MySql, and  
everything is working perfectly.

Weird.

Happy!

parki…

Brian P. wrote:

> Brian P. wrote:
> 
> > Hello:
> > 
> > A plea for help. I’m following the instructions here:
> > 
> > [http://developer.apple.com/tools/rubyonrails.html](http://developer.apple.com/tools/rubyonrails.html)
> 
> I did a bit more digging - the migration stalls here in mysql.rb - it’s  
> waiting on the 4 bytes for length, which presumably never come back from  
> the server:
> 
> ```
> def read()
> buf = []
> len = nil
> @sock.sync = false
> while len == nil or len == MAX_PACKET_LENGTH do
> 
> ```
> 
> a = @sock.read(4) \<------------------------------- HERE  
> len = a[0]+a[1]\*256+a[2]_256_256  
> pkt\_nr = a[3]  
> if @pkt\_nr != pkt\_nr then  
> raise “Packets out of order: #{@pkt\_nr}\<\>#{pkt\_nr}”  
> end  
> @pkt\_nr = @pkt\_nr + 1 & 0xff  
> buf \<\< @sock.read(len)  
> end  
> @sock.sync = true  
> buf.join  
> rescue  
> errno = Error::CR\_SERVER\_LOST  
> raise Error::new(errno, Error::err(errno))  
> end

---

<div class="post-metadata">

**Author:** ![parki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b782af/32.png) [@parki](https://www.ruby-forum.com/u/parki)\
**Post date:** [March 20, 2006, 6:38am UTC](https://www.ruby-forum.com/t/migrate-hangs-on-mac-os-x/55282/4 "2006-03-20T06:38:22Z")

</div>

Did you change your settings in the database.yml to correspond to your  
MySQL  
install?

That would be the next place I’d check to make sure that you have the  
correct settings.

Ryan
