使用Apache和mod_wsgi的HTTP 503错误

我在Django中编写了一个webapp,我使用mod_wsgi在Apache 2.4下运行。

乍一看,它工作正常。 但是,当Apache进程运行了一段时间后,webapp开始响应503错误。 在F5之后,你可以通过很多次。

令人讨厌的是我没有任何与我的Apache error.log相关的任何东西 ,所以我不知道从哪里开始debugging。 我唯一的领导是浏览器中显示的错误: 503 Service Unavailable

其他网站(PHP)不受影响。 重新启动Apache服务器可以立即解决问题。

我的这个webapp的Apacheconfiguration:

  WSGIDaemonProcess app python-path=/opt/app home=/opt/app WSGIProcessGroup app WSGIScriptAlias /app /opt/app/wsgi.py 

我发现这个,但我不认为这是问题,因为套接字已经放在/var/run/apache2/在我的情况(不是“Apache日志目录”)。 这个目录对其他人是可读的。 套接字本身有模式700 ,但拥有正确的所有者( www-data )。

有任何想法吗?

编辑:

我注意到,当问题发生时,我重新启动Apache来修复它,Apache需要很长的时间才能退出。 在错误日志中,我发现这些消息:

 [Sun Jun 25 14:14:18.935566 2017] [core:warn] [pid 374:tid 140587055682752] AH00045: child process 21761 still did not exit, sending a SIGTERM [Sun Jun 25 14:14:18.935637 2017] [core:warn] [pid 374:tid 140587055682752] AH00045: child process 21812 still did not exit, sending a SIGTERM [Sun Jun 25 14:14:20.937578 2017] [core:warn] [pid 374:tid 140587055682752] AH00045: child process 21761 still did not exit, sending a SIGTERM [Sun Jun 25 14:14:20.937640 2017] [core:warn] [pid 374:tid 140587055682752] AH00045: child process 21812 still did not exit, sending a SIGTERM [Sun Jun 25 14:14:22.939827 2017] [core:warn] [pid 374:tid 140587055682752] AH00045: child process 21761 still did not exit, sending a SIGTERM [Sun Jun 25 14:14:22.939893 2017] [core:warn] [pid 374:tid 140587055682752] AH00045: child process 21812 still did not exit, sending a SIGTERM [Sun Jun 25 14:14:24.942034 2017] [core:error] [pid 374:tid 140587055682752] AH00046: child process 21761 still did not exit, sending a SIGKILL [Sun Jun 25 14:14:24.942176 2017] [core:error] [pid 374:tid 140587055682752] AH00046: child process 21812 still did not exit, sending a SIGKILL 

所以从外观来看,问题可能是由(WSGI)线程挂起造成的? 我如何继续debugging呢?