错误PhusionPassenger :: Rack :: ApplicationSpawner ::错误

时间:2012-11-23 02:32:09

标签: ruby apache passenger redmine

我和乘客有错。

我在VPS中设置了redmine。当我在webrick中运行时它运行正常。我曾经乘客在80号港口运行redmine。

路径:usr / local / apache / conf / httpd.conf

 LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
 PassengerRuby /usr/bin/ruby
 PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17

 PassengerMaxPoolSize 2
 PassengerMaxInstancesPerApp 2
 PassengerPoolIdleTime 100


 <VirtualHost 112.78.6.191:80>
    ServerName projects.gzerone.com
    ServerAlias www.projects.gzerone.com
    DocumentRoot /home/gzerone/public_html/redmine-2.1.2/public
RailsEnv production
     #ErrorLog /usr/local/apache/logs/redmine.error.log
#RackBaseURI /rails
     ServerAdmin webmaster@projects.gzerone.com
     #UseCanonicalName Off
    #CustomLog /usr/local/apache/domlogs/projects.gzerone.com combined
    #CustomLog /usr/local/apache/domlogs/projects.gzerone.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
     ## User gzerone # Needed for Cpanel::ApacheConf
<Directory /home/gzerone/public_html/redmine-2.1.2/public>
    #AllowOverride all
     Allow from all
    # MultiViews must be turned off.
    Options -MultiViews
</Directory>

<IfModule mod_suphp.c>
    suPHP_UserGroup gzerone gzerone
</IfModule>
<IfModule !mod_disable_suexec.c>
    <IfModule !mod_ruid2.c>
        SuexecUserGroup gzerone gzerone
    </IfModule>
</IfModule>
<IfModule mod_ruid2.c>
    RUidGid gzerone gzerone
</IfModule>
ScriptAlias /cgi-bin/ /home/gzerone/public_html/redmine-2.1.2/public/cgi-bin/


# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/gzerone/projects.gzerone.com/*.conf"

enter image description here

在apache的error_log中:

[ pid=23984 thr=23634338875820 file=utils.rb:176 time=2012-11-23 10:39:34.067 ]: *** Exception Errno::ENOMEM in PhusionPassenger::Rack::ApplicationSpawner (Cannot allocate memory - fork(2)) (process 23984, thread #<Thread:0x2afd98bf1358>):
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:462:in `fork'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/utils.rb:462:in `safe_fork'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rack_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rack_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/helper-scripts/passenger-spawn-server:99

我希望。你提出任何建议来解决它。

2 个答案:

答案 0 :(得分:1)

正如您在日志中看到的那样,ApplicationSpawner由于内存不足错误而崩溃。你的内存不足。

你可以做几件事:

  • 使用保守的产卵,以便您没有ApplicationSpawner进程。由于您的池大小仅为2,因此使用ApplicationSpawner并不会给您带来任何好处。
  • 添加更多交换空间。
  • 升级你的内存。

答案 1 :(得分:0)

出现同样的问题,我认为它与Passenger控件和优化选项(如PassengerMaxPoolSize)有关。您可能需要将其设置为高于2.我注意到第一次有人在另一台计算机上同步查看我的应用程序时发生了错误。

要快速修复,请尝试进入项目目录并按bundle install重新绑定应用,然后重新启动网络服务器,sudo service httpd restart这应该会重置Passenger。

此外,缺少config.ru文件会导致相同的错误消息。您可能想查看讨论here

希望我能告诉你为什么会发生这种情况,希望有人愿意。我很想了解mysef的确切问题,永久修复。