我的ROR + Nginx + Passenger + AWS正在发送502坏网关

时间:2017-02-22 02:30:51

标签: ruby-on-rails amazon-web-services amazon-ec2

我正在使用ROR + Nginx +乘客和亚马逊网络服务开发Android服务。

服务器运行良好,但昨天服务器突然被击落。

我试图解决这个问题,但我无法解决。

这是我的问题。

首先,EC2实例的log / production.log不会写任何日志。 我可以在我的Android应用程序日志中收到502错误的网关错误消息。

其次,包括http,https在内的所有请求都由502 badgateway响应。

第三,我的AWS负载均衡器记录了50X错误。

我想这个问题与ELB有关,但我不知道如何解决。

我有ssl证书,而且我只有一个EC2实例。

任何帮助将不胜感激。

被修改

2017-02-22 00:22:30.9139 25313/7f222067b700 age/Cor/Con/CheckoutSession.cpp:269 ]: [Client 1-356202] Returning HTTP 503 due to: Request queue full (configured max. size: 100)
[ 2017-02-22 00:24:00.3704 25313/7f221ee09700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/ec2-user/popcake: An error occurred while starting up the preloader: it did not write a startup response in time.
  Error ID: 10045ede
  Error details saved to: /tmp/passenger-error-JS1Bnt.html
  Message from application: An error occurred while starting up the 

preloader: it did not write a startup response in time. Please read <a href="https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems">this article</a> for more information about this problem.<br>
    <h2>Raw process output:</h2>
    (empty)

    [ 2017-02-22 00:24:00.4527 25313/7f222067b700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-353433] Cannot checkout session because a spawning error occurred. The identifier of the error is 10045ede. Please see earlier logs for details about the error.
[ 2017-02-22 00:30:29.0872 25313/7f222067b700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-22 00:30:29.1173 25313/7f2227bfc840 age/Cor/CoreMain.cpp:901 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-22 00:30:29.1174 25313/7f221fe7a700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2017-02-22 00:30:29.1174 25313/7f221fe7a700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished

[ 2017-02-22 00:30:29.2400 25318/7f77237e2700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ 2017-02-22 00:30:29.2741 25318/7f772a775840 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ 2017-02-22 00:30:29.3043 25318/7f77237e2700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2017-02-22 00:30:29.3042 25318/7f7722fe1700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2017-02-22 00:30:29.3048 25318/7f7722fe1700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2017-02-22 00:30:29.3720 25318/7f772a775840 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished

[ 2017-02-22 00:30:29.4023 25313/7f222067b700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)

1 个答案:

答案 0 :(得分:0)

如果你看到你添加的日志,它说&#34;请求队列已满&#34;,基本上你有一些长时间运行的api,因为队列之后被抛出了50x充分。

重新启动nginx可能暂时解决了这个问题,但是你需要查看你的api的响应时间,看看哪些性能很慢并修复它们,否则它将是一个反复出现的问题,你必须每天重启nginx。