简体   繁体   English

Rails Server 挂起,Rake db.migrate 挂起,似乎挂在 DB 服务器连接上,但我可以毫无问题地连接到 DB 服务器

[英]Rails Server hangs, Rake db.migrate hangs, appears to be hanging on DB server connection, but I can connect to DB server without a problem

I'm switching a project from Rails2 to Rails3.我正在将项目从 Rails2 切换到 Rails3。 I run:我跑:

rails server

The server starts up without errors:服务器启动时没有错误:

=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
loaded openid

When I connect to localhost:3000, the server registers a \GET request in the log, but never responds.当我连接到 localhost:3000 时,服务器在日志中注册了一个 \GET 请求,但从不响应。 The HTTP just hangs open. HTTP 只是挂开。 Inspecting the process shows that it is connecting to the localhost DB switching ports every 2 seconds.检查进程显示它每 2 秒连接到 localhost DB 交换端口。

  • Development.log shows "Started GET "/" for 127.0.0.1 at Mon Jun 06 12:44:08 -0400 2011" but nothing else. Development.log 显示“在 2011 年 6 月 6 日星期一 12:44:08 -0400 2011 开始 127.0.0.1 的“开始 GET”/”,但仅此而已。

  • Same issue occurs if I attempt to run any rake task.如果我尝试运行任何 rake 任务,也会出现同样的问题。

  • Other people in my office are running the same code in rails3 without problems (I tried it with a fresh git clone).我办公室的其他人在 rails3 中运行相同的代码没有问题(我尝试使用新的 git 克隆)。

  • I can connect to the localhost DB without any problems.我可以毫无问题地连接到本地主机数据库。

  • Problem did not occur when running rails2.运行 rails2 时没有出现问题。

Any ideas about where my problem is?关于我的问题出在哪里的任何想法? How I can debug (secret log files, places to sneak in a debugger to see what is going on, etc..)?我如何调试(秘密日志文件、潜入调试器以查看发生了什么等等)?

EDIT: Problem magically went away, how odd.编辑:问题神奇地消失了,多么奇怪。

You say the app hangs.你说应用程序挂起。 When you kill it, it should show a backtrace of where it was just before.当你杀死它时,它应该显示它之前所在位置的回溯。 This should give you a clue where to look for the problem.这应该为您提供在哪里寻找问题的线索。

A further investigation of this issue determined that the database.yml was incorrectly configured (the wrong ip address was being specified for local host).对此问题的进一步调查确定 database.yml 配置不正确(为本地主机指定了错误的 ip 地址)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM