我有来自mod_rails go“流氓”的ruby实例--这些进程不再列在passenger-status中,它们占用100%的cpu。
除了安装神/monit来杀死实例之外,有没有人能给我一些如何防止这种情况的建议?我在日志里找不到任何有帮助的东西。
发布于 2009-03-24 21:17:34
如果您使用的是Linux,您可以安装"strace“实用程序来查看Ruby进程正在做什么,这会消耗所有的CPU。这将为您提供一个很好的低级视图。它应该在包管理器中可用。然后,您可以:
$ sudo strace -p 22710
Process 22710 attached - interrupt to quit
...lots of stuff...
(press Ctrl+C)然后,如果您想在中间停止进程并转储堆栈跟踪,您可以遵循http://eigenclass.org/hiki.rb?ruby+live+process+introspection上关于在Ruby中使用GDB的指南,具体操作如下:
gdb --pid=(ruby process)
session-ruby
stdout_redirect
(in other terminal) tail -f /tmp/ruby_debug.(pid)
eval "caller"还可以使用ruby-debug Gem远程连接到您打开的调试套接字,如http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger中所述
Github上似乎也有一个项目关注于调试Passenger实例,它看起来很有趣,但缺乏文档:http://github.com/ddollar/socket-debugger/tree/master
发布于 2012-10-24 16:27:02
我有一个与Phusion Passenger相关的ruby进程,它消耗了大量CPU,尽管它本应处于空闲状态。
在我跑完之后这个问题就消失了
date -s "`date`"如this thread中所建议的。(那是在Debian Squeeze上)
显然,这个问题与闰秒有关,可能会影响许多其他应用程序,如MySQL、Java等。更多信息请访问this thread on lklm。
发布于 2009-03-08 13:00:05
这是passenger反复出现的问题。我见过很多次这个问题,帮助那些在ruby on rails上运行passenger的人。我没有解决方法,但是你可能想试试这个http://www.modrails.com/documentation/Users%20guide%20Apache.html#debugging_frozen
https://stackoverflow.com/questions/623205
复制相似问题