1

問題を再現する手順は何ですか?

  1. パッセンジャー 4.0.23 を使用して、ゴムを使用して amazon ec2 にレールをセットアップします。
  2. 配備
  3. Apache ログを確認する

期待される出力は何ですか?代わりに何が表示されますか?

RailsのWebサイトが機能することを期待しています。ページを表示できません。

Phusion Passenger、Rails、OSのバージョン

Rails 4.0.0 Passenger 4.0.23 OS Amazon EC2 上の Ubuntu 12.04

以下の追加情報。

ruby gem を使用して amazon ec2 インスタンスをセットアップしました。すべてがうまくいきました。そして、デプロイは成功しました。しかし、アプリをライブで見ることができませんでした。Apache のログを確認したところ、パッセンジャー エラーがありました。

[website]       [ 2013-11-12 16:39:57.9413 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout] Started GET "/" for 127.0.0.1 at 2013-11-12 16:39:57 -0500
[website]       [ 2013-11-12 16:39:57.9487 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout] Processing by HighVoltage::PagesController#show as */*
[website]       [ 2013-11-12 16:39:57.9489 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Parameters: {"id"=>"home"}
[website]       [ 2013-11-12 16:39:57.9490 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Rendered pages/home.html.slim within layouts/application (1.4ms)
[website]       [ 2013-11-12 16:39:57.9491 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Rendered layouts/_header.html.slim (1.0ms)
[website]       [ 2013-11-12 16:39:57.9492 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Rendered layouts/_mob_os_icons.html.slim (0.0ms)
[website]       [ 2013-11-12 16:39:57.9493 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Rendered layouts/_social_icons.html.slim (0.0ms)
[website]       [ 2013-11-12 16:39:57.9494 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Rendered layouts/_footer.html.slim (0.5ms)
[website]       [ 2013-11-12 16:39:57.9520 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout]   Rendered layouts/_support_form.html.slim (3.8ms)
[website]       [ 2013-11-12 16:39:57.9524 31599/7f14572a4700 Pool2/Implementation.cpp:1274 ]: [App 31913 stdout] Completed 200 OK in 9ms (Views: 8.4ms | ActiveRecord: 0.0ms)
[website]       [ 2013-11-12 16:39:58.0194 31599/7f145e841700 Pool2/Spawner.h:796 ]: [App 2343 stdout] 
[website]       [ 2013-11-12 16:40:06.8283 31599/7f145e841700 Pool2/SmartSpawner.h:305 ]: Preloader for /mnt/aniways_website-production/releases/20131112204117 started on PID 2343, listening on unix:/tmp/passenger.1.0.31592/generation-0/backends/preloader.2343
[website]       [ 2013-11-12 16:40:07.1492 31599/7f145e841700 Pool2/SmartSpawner.h:693 ]: An error occurred while spawning a process: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger.
[website]       [ 2013-11-12 16:40:07.1494 31599/7f145e841700 Pool2/SmartSpawner.h:694 ]: The application preloader seems to have crashed, restarting it and trying again...
[website]       [ 2013-11-12 16:40:07.1727 31599/7f145e882700 Pool2/Implementation.cpp:1274 ]: [App 2343 stderr] /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/lib/phusion_passenger/preloader_shared_helpers.rb:66:in `fork': Cannot allocate memory - fork(2) (Errno::ENOMEM)
[website]       [ 2013-11-12 16:40:07.1729 31599/7f145e882700 Pool2/Implementation.cpp:1274 ]: [App 2343 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/lib/phusion_passenger/preloader_shared_helpers.rb:66:in `accept_and_process_next_client'
[website]       [ 2013-11-12 16:40:07.1730 31599/7f145e882700 Pool2/Implementation.cpp:1274 ]: [App 2343 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/lib/phusion_passenger/preloader_shared_helpers.rb:116:in `run_main_loop'
[website]       [ 2013-11-12 16:40:07.1810 31599/7f145e882700 Pool2/Implementation.cpp:1274 ]: [App 2343 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/helper-scripts/rack-preloader.rb:151:in `<module:App>'
[website]       [ 2013-11-12 16:40:07.1811 31599/7f145e882700 Pool2/Implementation.cpp:1274 ]: [App 2343 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
[website]       [ 2013-11-12 16:40:07.1812 31599/7f145e882700 Pool2/Implementation.cpp:1274 ]: [App 2343 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/helper-scripts/rack-preloader.rb:28:in `<main>'
[website]       [ 2013-11-12 16:40:08.7635 31599/7f145e841700 Pool2/Spawner.h:796 ]: [App 2491 stdout] 
[website]       [ 2013-11-12 16:40:13.0087 31599/7f145e841700 Pool2/SmartSpawner.h:305 ]: Preloader for /mnt/aniways_website-production/releases/20131112204117 started on PID 2491, listening on unix:/tmp/passenger.1.0.31592/generation-0/backends/preloader.2491
[website]       [ 2013-11-12 16:40:13.1094 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr] /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/lib/phusion_passenger/preloader_shared_helpers.rb:66:in `fork'
[website]       [ 2013-11-12 16:40:13.1111 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr] : Cannot allocate memory - fork(2) (Errno::ENOMEM)
[website]       [ 2013-11-12 16:40:13.1113 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/lib/phusion_passenger/preloader_shared_helpers.rb:66:in `accept_and_process_next_client'
[website]       [ 2013-11-12 16:40:13.1114 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/lib/phusion_passenger/preloader_shared_helpers.rb:116:in `run_main_loop'
[website]       [ 2013-11-12 16:40:13.1115 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/helper-scripts/rack-preloader.rb:151:in `<module:App>'
[website]       [ 2013-11-12 16:40:13.1117 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
[website]       [ 2013-11-12 16:40:13.1118 31599/7f145e78a700 Pool2/Implementation.cpp:1274 ]: [App 2491 stderr]    from /usr/local/rubies/2.0.0-p0/lib/ruby/gems/2.0.0/gems/passenger-4.0.23/helper-scripts/rack-preloader.rb:28:in `<main>'
[website]       [ 2013-11-12 16:40:13.2386 31599/7f145e841700 Pool2/Implementation.cpp:849 ]: Could not spawn process for group /mnt/aniways_website-production/releases/20131112204117#default: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger.
[website]            in 'void Passenger::ApplicationPool2::Spawner::throwAppSpawnException(const string&, Passenger::SpawnException::ErrorKind, Passenger::ApplicationPool2::Spawner::NegotiationDetails&)' (Spawner.h:689)
[website]            in 'Passenger::ApplicationPool2::SmartSpawner::SpawnResult Passenger::ApplicationPool2::SmartSpawner::sendSpawnCommand(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:682)
[website]            in 'Passenger::ApplicationPool2::SmartSpawner::SpawnResult Passenger::ApplicationPool2::SmartSpawner::sendSpawnCommandAgain(const Exception&, const Passenger::ApplicationPool2::Options&) [with Exception = Passenger::SpawnException]' (SmartSpawner.h:692)
[website]            in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:760)
[website]            in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:782)
[website] 

アップデート

Hongli のアドバイスに従い、MaxPoolSize を 5 に減らしました。

今、私はこれをエラーログに記録します。

[ 2013-11-13 14:12:07.5599 5103/7fa04475e740 agents/HelperAgent/Main.cpp:619 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.5096/generation-0/request
[ 2013-11-13 14:12:07.5780 5108/7f4e3dddd740 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.5096/generation-0/logging
[ 2013-11-13 14:12:07.5820 5100/7f470d55d740 agents/Watchdog/Main.cpp:761 ]: All Phusion Passenger agents started!
[Wed Nov 13 14:12:07 2013] [notice] Apache/2.2.22 (Ubuntu) proxy_html/3.0.1 mod_ssl/2.2.22 OpenSSL/1.0.1 Phusion_Passenger/4.0.23 configured -- resuming normal operations
[ 2013-11-13 14:12:11.0335 5103/7fa044687700 Pool2/Spawner.h:796 ]: [App 5252 stdout] 
[ 2013-11-13 14:12:14.0589 5103/7fa044687700 Pool2/SmartSpawner.h:305 ]: Preloader for /mnt/jashwant_website-production/releases/20131113190730 started on PID 5252, listening on unix:/tmp/passenger.1.0.5096/generation-0/backends/preloader.5252
[ 2013-11-13 14:12:14.3681 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout] Started GET "/" for 127.0.0.1 at 2013-11-13 14:12:14 -0500
[ 2013-11-13 14:12:14.4019 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout] Processing by HighVoltage::PagesController#show as */*
[ 2013-11-13 14:12:14.4101 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Parameters: {"id"=>"home"}
[ 2013-11-13 14:12:14.5424 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Rendered pages/home.html.slim within layouts/application (59.9ms)
[ 2013-11-13 14:12:14.5987 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Rendered layouts/_header.html.slim (23.9ms)
[ 2013-11-13 14:12:14.7445 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Rendered layouts/_mob_os_icons.html.slim (7.4ms)
[ 2013-11-13 14:12:14.7631 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Rendered layouts/_social_icons.html.slim (7.2ms)
[ 2013-11-13 14:12:14.7633 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Rendered layouts/_footer.html.slim (155.8ms)
[ 2013-11-13 14:12:14.8396 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout]   Rendered layouts/_support_form.html.slim (71.4ms)
[ 2013-11-13 14:12:14.8413 5103/7fa0445d0700 Pool2/Implementation.cpp:1274 ]: [App 5277 stdout] Completed 200 OK in 431ms (Views: 377.7ms | ActiveRecord: 0.0ms)

これは、サーバーのセットアップが成功したことを意味すると思います。しかし、それでも自分のサイトをオンラインで閲覧することはできません。(私はすでにセキュリティグループをチェックしました.0.0.0.0からポート80/443を許可しています.mysqlでも同じです.Rails/log/production.logは空です.

UPDATE 2 これはhaproxyログに表示されます

Nov 13 15:02:23 localhost haproxy[5580]: Server passenger_proxy/website is DOWN, reason: Layer7 wrong status, code: 404, info: "Not Found", check duration: 5ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
4

2 に答える 2

2

Phusion Passenger の著者はこちら。

ログでこれに気づきましたか?

 Cannot allocate memory - fork(2) (Errno::ENOMEM)

これは、システムのメモリが不足していることを意味します。

そして、これに気づきますか?

 An error occurred while starting the web application.
 It exited before signalling successful startup back to Phusion Passenger.

これは、Passenger が Web アプリのプロセスを生成しようとしたが、前述のエラー (メモリ不足) のために失敗したことを意味します。

できることは 3 つあります。

  • メモリをアップグレードします。
  • スワップスペースをアップグレードします。
  • Passenger の設定を微調整して、多くのプロセスが開始されないようにします。これにより、メモリを節約できます。オプションの微調整については、パッセンジャーのマニュアルを参照してください。
于 2013-11-13T13:14:31.770 に答える