502 Bad Gateway / rails 4 / nginx / passenger 5.0.18 /

时间:2016-01-26 05:12:36

标签: ruby-on-rails nginx passenger

我找不到我的错误......以及如何修复它。

它似乎有2个错误

cat /var/log/nginx/error.log

    /usr/lib/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb:69:in `fork'

    Cannot allocate memory - fork(2) (Errno::ENOMEM)
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb:69:in `accept_and_process_next_client'
    from /usr/lib/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb:139:in `run_main_loop'
    from /usr/share/passenger/helper-scripts/rack-preloader.rb:154:in `<module:App>'
    from /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
    from /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
    : Could not spawn process for application /home/ubuntu/timetable: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger.
      Error ID: 2d3d1156
      Error details saved to: /tmp/passenger-error-jzMFIA.html
      Message from application: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger. Please read <a href="https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems">this article</a> for more information about this problem.<br>



    [ 2016-01-26 04:32:31.3265 26971/7f99b78c9700 Spa/SmartSpawner.h:726 ]: 

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.
    [ 2016-01-26 04:32:31.3265 26971/7f99b78c9700 Spa/SmartSpawner.h:727 ]: The application preloader seems to have crashed, restarting it and trying again...
    App 29879 stdout:
    App 29879 stderr:  --> Compiling passenger_native_support.so for the current Ruby interpreter...
    App 29879 stderr:
    App 29879 stderr:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
    App 29879 stderr:
    App 29879 stderr:      Warning: compilation didn't succeed. To learn why, read this file:
    App 29879 stderr:      /tmp/passenger_native_support-ttojm4.log
    App 29879 stderr:  --> Downloading precompiled passenger_native_support.so for the current Ruby interpreter...
    App 29879 stderr:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
    App 29879 stderr:      Could not download https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release/5.0.18/rubyext-ruby-2.2.2-x86_64-linux.tar.gz: no download tool found (curl or wget required)
    App 29879 stderr:      Trying next mirror...
    App 29879 stderr:      Could not download https://s3.amazonaws.com/phusion-passenger/binaries/passenger/by_release/5.0.18/rubyext-ruby-2.2.2-x86_64-linux.tar.gz: no download tool found (curl or wget required)
    App 29879 stderr:  --> Continuing without passenger_native_support.so.
    App 29879 stderr:
    [ 2016-01-26 04:32:40.3811 26971/7f99dbb3b700 App/Poo/AnalyticsCollection.cpp:60 ]: ERROR: Cannot fork() a new process: Cannot allocate memory (errno=12)
      Backtrace:
         in 'void Passenger::ApplicationPool2::Pool::realCollectAnalytics()' (AnalyticsCollection.cpp:185)
         in 'static void Passenger::ApplicationPool2::Pool::collectAnalytics(Passenger::ApplicationPool2::PoolPtr)' (AnalyticsCollection.cpp:55)



    [ 2016-01-26 04:32:45.4877 26971/7f99dbb3b700 App/Poo/AnalyticsCollection.cpp:60 ]: ERROR: Cannot fork() a new process: Cannot allocate memory (errno=12)
      Backtrace:
         in 'void Passenger::ApplicationPool2::Pool::realCollectAnalytics()' (AnalyticsCollection.cpp:185)
         in 'static void Passenger::ApplicationPool2::Pool::collectAnalytics(Passenger::ApplicationPool2::PoolPtr)' (AnalyticsCollection.cpp:55)




    [ 2016-01-26 04:32:50.5652 26971/7f99dbb3b700 App/Poo/AnalyticsCollection.cpp:60 ]: ERROR: Cannot fork() a new process: Cannot allocate memory (errno=12)
      Backtrace:
         in 'void Passenger::ApplicationPool2::Pool::realCollectAnalytics()' (AnalyticsCollection.cpp:185)
         in 'static void Passenger::ApplicationPool2::Pool::collectAnalytics(Passenger::ApplicationPool2::PoolPtr)' (AnalyticsCollection.cpp:55)

    [ 2016-01-26 04:32:55.8830 26971/7f99dbb3b700 App/Poo/AnalyticsCollection.cpp:60 ]: ERROR: Cannot fork() a new process: Cannot allocate memory (errno=12)
      Backtrace:
         in 'void Passenger::ApplicationPool2::Pool::realCollectAnalytics()' (AnalyticsCollection.cpp:185)
         in 'static void Passenger::ApplicationPool2::Pool::collectAnalytics(Passenger::ApplicationPool2::PoolPtr)' (AnalyticsCollection.cpp:55)

    [ 2016-01-26 04:33:01.1370 26971/7f99dbb3b700 App/Poo/AnalyticsCollection.cpp:104 ]: Process (pid=28934, group=/home/ubuntu/timetable/public (development)) no longer exists! Detaching it from the pool.
    [ 2016-01-26 04:33:01.1509 26971/7f99dbb3b700 age/Cor/CoreMain.cpp:794 ]: Disconnecting long-running connections for process 28934, application /home/ubuntu/timetable/public (development)
    App 29879 stderr: sh: 1:
    App 29879 stderr: env: not found
    App 29906 stdout:

如何解决这个问题..我花了2天时间搜索这个问题。

我使用aws ec2,nginx + passenger,ruby on rails

1 个答案:

答案 0 :(得分:1)

我有同样的问题。

尝试重新启动某些服务以避免用完ram,否则会获得更大的实例。

在我的t1.micro上重启sql对我有用。