OpenStack HAproxy 问题

OpenStack HAproxy issues

我正在使用 openshift-django17 to bootstrap my application on Openshift. Before I moved to Django 1.7, I was using authors previous repository for openshift-django16,但我没有遇到接下来要描述的问题。在 运行ning 成功大约 6 小时后,我收到以下错误:

Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

在我重新启动应用程序后,它可以毫无问题地运行几个小时,然后我再次遇到此错误。现在齿轮永远不应该进入空闲模式,因为我每 5 分钟从应用程序外部通过 RESTful POST API 发布一些数据。我有 运行 rhc tail 命令,我认为错误在于 HAproxy:

==> app-root/logs/haproxy.log <== [WARNING] 081/155915 (497777) : config : log format ignored for proxy 'express' since it has no log address. [WARNING] 081/155915 (497777) : Server express/local-gear is DOWN, reason: Layer 4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue. [ALERT] 081/155915 (497777) : proxy 'express' has no server available! [WARNING] 081/155948 (497777) : Server express/local-gear is UP, reason: Layer7 check passed, code: 200, info: "HTTP status check returned code 200", ch eck duration: 11ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue. [WARNING] 081/170359 (127633) : config : log format ignored for proxy 'stats' si nce it has no log address. [WARNING] 081/170359 (127633) : config : log format ignored for proxy 'express' since it has no log address. [WARNING] 081/170359 (497777) : Stopping proxy stats in 0 ms. [WARNING] 081/170359 (497777) : Stopping proxy express in 0 ms. [WARNING] 081/170359 (497777) : Proxy stats stopped (FE: 1 conns, BE: 0 conns). [WARNING] 081/170359 (497777) : Proxy express stopped (FE: 206 conns, BE: 312 co

我也 运行 一些 CRON 作业,每天一次,但我 99% 确定它与此无关。看起来像是 Openshift 方面的问题,对吧?我已经发布了作者存储库的 this issue on the github,他建议我尝试使用 Whosebug。

原来这是由于 openshift-django17 setting DEBUG in settings.py to True even though it was specified in environment variables as False (pull request for fix here). The reason 503 Service Temporarily Unavailable appeared was because of Openshift memory limit violations due to DEBUG being turned ON as stated in Django settings documentation for DEBUG 中的一个错误:

It is also important to remember that when running with DEBUG turned on, Django will remember every SQL query it executes. This is useful when you’re debugging, but it’ll rapidly consume memory on a production server.