Rails DB rake任务运行但从不退出

时间:2022-05-31 22:28:11

When I run any of the rake db tasks that Rails provides, they run successfully but never exit. I have to CTRL+C to quit the task. I've tested running it for over 8 hours and the problem persists.

当我运行Rails提供的任何rake db任务时,它们会成功运行但永远不会退出。我必须按CTRL + C退出任务。我已经测试了运行它超过8小时,问题仍然存在。

Here's the output if I run rake db:migrate --trace:

如果我运行rake db:migrate --trace,这是输出:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke db:load_config 
** Execute db:schema:dump
_

Like I said, everything runs as expected, but it hangs after db:schema:dump.

就像我说的,一切都按预期运行,但它在db:schema:dump之后挂起。

I'm using the following:

我正在使用以下内容:

  • Mac OS X 10.7.1 (Lion)
  • Mac OS X 10.7.1(Lion)

  • Ruby 1.9.2p290
  • Rails 3.1.0
  • MySQL 5.5.14
  • mysql2 gem 0.3.7
  • mysql2 gem 0.3.7

I'll also note that this is a base Rails app with no gems/code added. I can replicate with rails new testapp -d mysql then rake db:create or bundle exec rake db:create.

我还要注意,这是一个基础Rails应用程序,没有添加任何宝石/代码。我可以用rails new testapp -d mysql复制然后rake db:create或bundle exec rake db:create。

Has anyone run into this problem or know what I can do to further troubleshoot?

有没有人遇到这个问题或知道我可以做些什么来进一步排除故障?

2 个解决方案

#1


1  

I fixed the problem.

我解决了这个问题。

First, I tried uninstalling the version of MySQL that was installed using the official binary then reinstalling using Homebrew. That did nothing.

首先,我尝试卸载使用官方二进制文件安装的MySQL版本,然后使用Homebrew重新安装。那什么都没做。

I then ran brew update, restarted MySQL, and tried again. Eureka! It worked.

然后我运行brew更新,重新启动MySQL,并再次尝试。找到了!有效。

The culprit seems to have been a bug in an older version of one of the following:

罪魁祸首似乎是以下之一的旧版本中的一个错误:

libiconv
glib
gtk+

Those were the only formulas that were updated.

这些是唯一更新的公式。

#2


0  

same thing happen with me also but don't worry, i tried out bundle update after this i never face this issue.

同样的事情也发生在我身上,但不要担心,我尝试了捆绑更新后,我从来没有遇到过这个问题。

#1


1  

I fixed the problem.

我解决了这个问题。

First, I tried uninstalling the version of MySQL that was installed using the official binary then reinstalling using Homebrew. That did nothing.

首先,我尝试卸载使用官方二进制文件安装的MySQL版本,然后使用Homebrew重新安装。那什么都没做。

I then ran brew update, restarted MySQL, and tried again. Eureka! It worked.

然后我运行brew更新,重新启动MySQL,并再次尝试。找到了!有效。

The culprit seems to have been a bug in an older version of one of the following:

罪魁祸首似乎是以下之一的旧版本中的一个错误:

libiconv
glib
gtk+

Those were the only formulas that were updated.

这些是唯一更新的公式。

#2


0  

same thing happen with me also but don't worry, i tried out bundle update after this i never face this issue.

同样的事情也发生在我身上,但不要担心,我尝试了捆绑更新后,我从来没有遇到过这个问题。