4

First of all: I'm working on a web server using Apache/2.2.31 (Unix) and Django 1.8 with WSGI.

Everything was fine until I did some changes to my views.py file and touched the wsgi.py in order for changes to take effect. Right after, everytime I try to access with the browser to any page on my domain, it returns the following message:

Service Temporarily Unavailable

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

Additionally, a 503 Service Temporarily Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

My Apache's error_log has the following entries:

[Mon Dec 28 23:06:02 2015] [error] [client xx.xx.xx.xx] (11)Resource temporarily unavailable: mod_wsgi (pid=24172): Unable to connect to WSGI daemon process 'name_of_my_project' on '/route/to/apache/log/wsgi.1922.18.1.sock' after multiple attempts as listener backlog limit was exceeded., referer: http://myproject.com/
[Mon Dec 28 23:06:17 2015] [error] [client xx.xx.xx.xx] (11)Resource temporarily unavailable: mod_wsgi (pid=24172): Unable to connect to WSGI daemon process 'name_of_my_project' on '/route/to/apache/log/wsgi.1922.18.1.sock' after multiple attempts as listener backlog limit was exceeded., referer: http://myproject.com/
[Mon Dec 28 23:16:02 2015] [error] [client xx.xx.xx.xx] (11)Resource temporarily unavailable: mod_wsgi (pid=28572): Unable to connect to WSGI daemon process 'name_of_my_project' on '/route/to/apache/log/wsgi.1922.18.1.sock' after multiple attempts as listener backlog limit was exceeded.
[Mon Dec 28 23:16:17 2015] [error] [client xx.xx.xx.xx] (11)Resource temporarily unavailable: mod_wsgi (pid=28572): Unable to connect to WSGI daemon process 'name_of_my_project' on '/route/to/apache/log/wsgi.1922.18.1.sock' after multiple attempts as listener backlog limit was exceeded.

I've been looking for a solution all day and I've found this: https://groups.google.com/forum/#!topic/modwsgi/H7qPoqYNJdI

and this unanswered question: https://stackoverflow.com/questions/33549891/mod-wsgi-returning-503-service-unavailable

but I don't know how to fix it. Please, help me.

Community
  • 1
  • 1
  • Interesting. I always restart Apache to apply changes, and have never had a problem. It might be helpful to post your Apache/virtualhost wsgi settings. – Nostalg.io Dec 29 '15 at 09:03

3 Answers3

0

After finding no answers, I solved it restarting Apache.

0

From: http://engineering.hackerearth.com/2013/11/21/scaling-python-django-application-apache-mod_wsgi/

Tweaking mpm-worker configuration

<IfModule mpm_worker_module>
    StartServers         2
    MinSpareThreads      10
    MaxSpareThreads      25
    ThreadLimit          25
    ThreadsPerChild      25
    MaxClients           75
    MaxRequestsPerChild   0
</IfModule>

This configuration enforces following rules:

Initial number of server processes started is two.
Maximum number of clients is restricted to 75.
Each process has 25 threads.
Maximum number of processes that could be created is 75/25 = 3.
Our process size is ~220 MB (very very fat, I know!), so that means we only need ~660 MB in the worst case.
crazysj
  • 405
  • 3
  • 8
0

We found that adjusting mod_wsgi listen-backlog and increasing net.core.somaxconn (at least on Ubuntu) seems to eliminate the listener backlog limit was exceeded issues. Of course, this highly depends on level of traffic and users.

tomkralidis
  • 101
  • 2