Ruby 进程吃掉 100% cpu
当我尝试从我的应用程序(使用设计)注销时,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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在development.rb中打开cache_classes
Try turning on cache_classes in development.rb