Ruby 进程吃掉 100% cpu

发布于 2024-12-14 13:24:26 字数 2803 浏览 0 评论 0原文

当我尝试从我的应用程序(使用设计)注销时,rails 应用程序挂起并且 ruby​​ 占用了 100% 的 CPU,在我重新启动服务器后,它仍然冻结(无法加载页面)。仅当我删除并重新创建数据库时它才消失。我正在使用 PostgreSQL,尝试切换到 MySQL,但没有帮助。使用 mongrel(也发生在 webrick 中)。 Ruby 1.9.2,rails 3.0.9

strace

futex(0xe1be68, FUTEX_WAKE_PRIVATE, 1)  = 1
futex(0xe1c3fc, FUTEX_WAIT_PRIVATE, 1, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGINT (Interrupt) @ 0 (0) ---
rt_sigreturn(0x2)                       = -1 EINTR (Interrupted system call)
futex(0xe1c3fc, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
futex(0xe1c458, FUTEX_WAKE_PRIVATE, 1)  = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0

控制台输出:

Started GET "/signout" for 127.0.0.1 at 2011-11-09 10:11:13 +0200
  SQL (1.0ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = '"jokes"'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum
  Processing by SessionsController#destroy as HTML
Redirected to http://localhost:3000/
Completed 302 Found in 1ms

我不太确定那里会发生什么?

UPD* 这冻结不仅发生在注销时,而且是随机发生的:( Mac 上的其他开发人员也没有这个问题,我运行 Ubuntu 11.10,在 10.04 上尝试过,仍然有它。

When im trying to logout from my app (using devise) rails application hangs and ruby eat 100% of CPU, after im restarting server it's stil frezeed(cant load page). It gone only when im drop and recreate my database. Im using PostgreSQL, trying to switch to MySQL, didnt help. Use mongrel(happens with webrick too). Ruby 1.9.2, rails 3.0.9

strace

futex(0xe1be68, FUTEX_WAKE_PRIVATE, 1)  = 1
futex(0xe1c3fc, FUTEX_WAIT_PRIVATE, 1, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGINT (Interrupt) @ 0 (0) ---
rt_sigreturn(0x2)                       = -1 EINTR (Interrupted system call)
futex(0xe1c3fc, FUTEX_WAIT_PRIVATE, 1, NULL) = 0
futex(0xe1c458, FUTEX_WAKE_PRIVATE, 1)  = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0xe1be68, FUTEX_WAIT_PRIVATE, 2, NULL) = 0

console output:

Started GET "/signout" for 127.0.0.1 at 2011-11-09 10:11:13 +0200
  SQL (1.0ms)   SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
 FROM pg_attribute a LEFT JOIN pg_attrdef d
 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
 WHERE a.attrelid = '"jokes"'::regclass
 AND a.attnum > 0 AND NOT a.attisdropped
 ORDER BY a.attnum
  Processing by SessionsController#destroy as HTML
Redirected to http://localhost:3000/
Completed 302 Found in 1ms

Im not really sure what happens there?

UPD* This is freeze happens not only on logout, it's happens randomly :( Also other developer on mac havent this problem, im running Ubuntu 11.10, tried on 10.04, still have it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

芯好空 2024-12-21 13:24:26

尝试在development.rb中打开cache_classes

Try turning on cache_classes in development.rb

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文