Gateway Timeout - Ubuntu16.04 + Python3 + Django + Apache + mod_wsgi

1161 views
Skip to first unread message

Thomas

unread,
Feb 4, 2018, 2:30:12 PM2/4/18
to modwsgi
Hi there,

I'm hoping someone can help me out here :-)

Problem description:
- When setting the Django settings option "DEBUG = False" (typically used to switch to production settings) I get a "Gateway Timeout" from Apache. When "DEBUG = True" everything works just fine!
- Apache error: mod_wsgi Timeout when reading response headers from daemon process.

Setup:
- I have a vanilla install of Ubuntu16.04 with Apache 2.4. As per the "mod_wsgi" documentation I am making use of the virtual environment to load up the "mod_wsgi" environment into Apache.
- I have a Python virtual environment running where all of my required Python libraries / modules are located (including "mod_wsgi"). All Python libraries / modules are at the latest stable versions.
- I have only used the default package managers i.e.: apt and pipenv respectively on this clean install.
- The Apache user / group "www-data" is the owner of the default "/var/www/" directory.

Apache virtual host configuration:
"""
<VirtualHost *:80>
    ServerName www.blah.com
    ServerAlias blah.com
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule . https://www.blah.com%{REQUEST_URI} [L,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName www.blah.com
    ServerAlias blah.com

    SSLEngine on
    SSLCertificateFile /var/www/.ssl/blah.com.pem
    SSLCertificateKeyFile /var/www/.ssl/blah.com.key

    LogLevel info
    ErrorLog /var/www/logs/error-blah.log
    CustomLog /var/www/logs/access-blah.log combined

    DocumentRoot /var/www/blah.com

    Alias /static /var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/contrib/admin/static/

    <Directory /var/www/blah.com>
        Require all granted
    </Directory>

    WSGIDaemonProcess blah processes=5 inactivity-timeout=300 display-name=%{GROUP} python-home=/var/www/.virtualenvs/www-elNfpBxP/ python-path=/var/www/blah.com/
    WSGIProcessGroup blah
    WSGIApplicationGroup %{GLOBAL}
    WSGIScriptAlias / /var/www/blah.com/etc/wsgi/production_platform.py process-group=blah application-group=%{GLOBAL}
    WSGIPassAuthorization On
</VirtualHost>

LoadModule wsgi_module /var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so
WSGIRestrictEmbedded On
WSGILazyInitialization On
"""

Apache configuration output:
"""
$ apachectl -V

Server version: Apache/2.4.18 (Ubuntu)
Server built:   2017-09-18T15:09:02
Server's Module Magic Number: 20120211:52
Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

$ apachectl -M

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_event_module (shared)
 negotiation_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 wsgi_module (shared)

$ ~/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/mod_wsgi/server$ ldd mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so

linux-vdso.so.1 =>  (0x00007fffa35db000)
libpython3.5m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 (0x00007fd6159e1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd6157c4000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd6153fa000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fd6151d1000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd614fb7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd614db3000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fd614bb0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd6148a7000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd6162a3000)
"""

Any ideas as to how I can isolate the what is causing the problem or point me in the right direction before I go down the proverbial rabbit hole?

Thanks in advance.
Thomas

Graham Dumpleton

unread,
Feb 4, 2018, 6:02:57 PM2/4/18
to mod...@googlegroups.com
I would suggest trying to use:


to get more information out about what the WSGI application does respond with and where it may be getting stuck.

Further comments below.

On 5 Feb 2018, at 4:43 am, Thomas <ktlo...@gmail.com> wrote:

Hi there,

I'm hoping someone can help me out here :-)

Problem description:
- When setting the Django settings option "DEBUG = False" (typically used to switch to production settings) I get a "Gateway Timeout" from Apache. When "DEBUG = True" everything works just fine!
- Apache error: mod_wsgi Timeout when reading response headers from daemon process.

After how long waiting?


Setup:
- I have a vanilla install of Ubuntu16.04 with Apache 2.4. As per the "mod_wsgi" documentation I am making use of the virtual environment to load up the "mod_wsgi" environment into Apache.
- I have a Python virtual environment running where all of my required Python libraries / modules are located (including "mod_wsgi"). All Python libraries / modules are at the latest stable versions.
- I have only used the default package managers i.e.: apt and pipenv respectively on this clean install.
- The Apache user / group "www-data" is the owner of the default "/var/www/" directory.

Apache virtual host configuration:
"""
<VirtualHost *:80>
    ServerName www.blah.com
    ServerAlias blah.com
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule . https://www.blah.com%{REQUEST_URI} [L,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName www.blah.com
    ServerAlias blah.com

    SSLEngine on
    SSLCertificateFile /var/www/.ssl/blah.com.pem
    SSLCertificateKeyFile /var/www/.ssl/blah.com.key

    LogLevel info
    ErrorLog /var/www/logs/error-blah.log
    CustomLog /var/www/logs/access-blah.log combined

    DocumentRoot /var/www/blah.com

As best security practice, you should not set DocumentRoot to be a parent directory of your source code. If you were to comment out the WSGIScriptAlias, people could download your application code. Leave it out so defaults to server wide document root, or point it at an empty directory.


    Alias /static /var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/contrib/admin/static/

    <Directory /var/www/blah.com>
        Require all granted
    </Directory>

    WSGIDaemonProcess blah processes=5 inactivity-timeout=300 display-name=%{GROUP} python-home=/var/www/.virtualenvs/www-elNfpBxP/ python-path=/var/www/blah.com/

Avoid using inactivity-timeout. Look at using request-timeout instead. See:


including section at end about good overall defaults.

    WSGIProcessGroup blah
    WSGIApplicationGroup %{GLOBAL}

You don't need WSGIProcessGroup and WSGIApplicationGroup since you set those as arguments to WSGIScriptAlias.

    WSGIScriptAlias / /var/www/blah.com/etc/wsgi/production_platform.py process-group=blah application-group=%{GLOBAL}
    WSGIPassAuthorization On
</VirtualHost>

LoadModule wsgi_module /var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so
WSGIRestrictEmbedded On

I presume the LoadModule isn't actually at the end. It should be very first thing Apache sees related to mod_wsgi.

If it isn't, you may have a different mod_wsgi being loaded.

WSGILazyInitialization On

You don't need WSGILazyInitialization as that is the default.

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Thomas

unread,
Feb 5, 2018, 2:50:13 PM2/5/18
to modwsgi
Hi Graham,

Firstly, thank you for responding so quickly and thanks for the great tip (to just read the docs)! The debugging techniques and adjustments you suggested have helped me narrow down the issue further (I think).

So, I am still experiencing the timeout, but I strongly believe that the issue is not with Apache and mod_wsgi; rather the application (Django / my code) communicating with the MySQL database. Remember, this problem only occurs when "DEBUG = False" in my projects' settings file. When I run the project with "DEBUG = True", the next entry in the log files refers to the attempt Django makes to access the database for the first time to update / retrieve the anonymous session.

Updated Apache virtual host configuration:
"""
SetEnvIf X-Forwarded-Proto https HTTPS=1
SetEnvIf X-Forwarded-SSL on HTTPS=1
LoadModule wsgi_module /var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so
WSGIRestrictEmbedded On

<VirtualHost *:80>
    ServerName www.blah.com
    ServerAlias blah.com
    RewriteEngine On
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule . https://www.blah.com%{REQUEST_URI} [L,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName www.blah.com
    ServerAlias blah.com

    SSLEngine on
    SSLCertificateFile /var/www/.ssl/blah.com.pem
    SSLCertificateKeyFile /var/www/.ssl/blah.com.key

    LogLevel debug
    ErrorLog /var/www/logs/error-blah.log
    CustomLog /var/www/logs/access-blah.log combined

    Alias /static /var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/contrib/admin/static/

    <Directory /var/www/blah.com>
        Require all granted
    </Directory>

    WSGIDaemonProcess blah \
        processes=5 \
        display-name=%{GROUP} \
        python-home=/var/www/.virtualenvs/www-elNfpBxP/ \
        python-path=/var/www/blah.com/ \
        lang=en_US.UTF-8 \
        locale=en_US.UTF-8 \
        threads=5 \
        queue-timeout=45 \
        socket-timeout=60 \
        connect-timeout=15 \
        request-timeout=60 \
        inactivity-timeout=0 \
        startup-timeout=15 \
        deadlock-timeout=60 \
        graceful-timeout=15 \
        eviction-timeout=0 \
        restart-interval=0 \
        shutdown-timeout=5
    WSGIScriptAlias / /var/www/blah.com/etc/wsgi/production_platform.py \
        process-group=blah \
        application-group=%{GLOBAL}
</VirtualHost>
"""

Apache error log:
"""
[Mon Feb 05 21:11:52.378725 2018] [wsgi:info] [pid 31535:tid 140409583761152] mod_wsgi (pid=31535): Exiting process 'blah'.
[Mon Feb 05 21:11:52.404508 2018] [wsgi:info] [pid 31550:tid 140409652811520] mod_wsgi (pid=31550): Daemon process request time limit exceeded, stopping process 'blah'.
[Mon Feb 05 21:11:52.404559 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): Shutdown requested 'blah'.
[Mon Feb 05 21:11:52.404619 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): Dumping stack trace for active Python threads.
[Mon Feb 05 21:11:52.404624 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): Thread 140409636026112 executing file "/usr/lib/python3.5/socket.py", line 677, in create_connection  <-- trying to send me the error email or connect to DB?
[Mon Feb 05 21:11:52.404628 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/smtplib.py", line 300, in _get_socket,
[Mon Feb 05 21:11:52.404631 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/smtplib.py", line 308, in connect,
[Mon Feb 05 21:11:52.404633 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/smtplib.py", line 226, in __init__,
[Mon Feb 05 21:11:52.404636 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/mail/backends/smtp.py", line 42, in open,
[Mon Feb 05 21:11:52.404639 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/mail/backends/smtp.py", line 95, in send_messages,
[Mon Feb 05 21:11:52.404641 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/mail/message.py", line 288, in send,
[Mon Feb 05 21:11:52.404644 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/mail/__init__.py", line 89, in mail_admins,
[Mon Feb 05 21:11:52.404646 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/log.py", line 121, in send_mail,
[Mon Feb 05 21:11:52.404649 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/log.py", line 88, in emit,
[Mon Feb 05 21:11:52.404652 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/logging/__init__.py", line 842, in handle,
[Mon Feb 05 21:11:52.404655 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/logging/__init__.py", line 1471, in callHandlers,
[Mon Feb 05 21:11:52.404657 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/logging/__init__.py", line 1417, in handle,
[Mon Feb 05 21:11:52.404660 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/logging/__init__.py", line 1392, in _log,
[Mon Feb 05 21:11:52.404663 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/usr/lib/python3.5/logging/__init__.py", line 1298, in error,
[Mon Feb 05 21:11:52.404665 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 107, in handle_uncaught_exception,
[Mon Feb 05 21:11:52.404674 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 42, in response_for_exception,
[Mon Feb 05 21:11:52.404677 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404680 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/blah.com/core/middleware.py", line 55, in __call__,
[Mon Feb 05 21:11:52.404682 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404684 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/blah.com/core/middleware.py", line 20, in __call__,
[Mon Feb 05 21:11:52.404686 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404689 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404691 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404693 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404695 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404697 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404700 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404702 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404704 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404706 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404708 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404710 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404715 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404717 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404719 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404721 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404723 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404726 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/utils/deprecation.py", line 90, in __call__,
[Mon Feb 05 21:11:52.404728 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/exception.py", line 32, in inner,
[Mon Feb 05 21:11:52.404730 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/base.py", line 76, in get_response,
[Mon Feb 05 21:11:52.404733 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/.virtualenvs/www-elNfpBxP/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 142, in __call__,
[Mon Feb 05 21:11:52.404735 2018] [wsgi:info] [pid 31550:tid 140409849104256] mod_wsgi (pid=31550): called from file "/var/www/blah.com/etc/wsgi/production_platform.py", line 19, in __call__.
[Mon Feb 05 21:11:52.404750 2018] [wsgi:debug] [pid 31550:tid 140409610848000] src/server/mod_wsgi.c(8892): mod_wsgi (pid=31550): Exiting thread 3 in daemon process 'blah'.
[Mon Feb 05 21:11:52.404759 2018] [wsgi:debug] [pid 31550:tid 140409619240704] src/server/mod_wsgi.c(8892): mod_wsgi (pid=31550): Exiting thread 2 in daemon process 'blah'.
[Mon Feb 05 21:11:52.404767 2018] [wsgi:debug] [pid 31550:tid 140409627633408] src/server/mod_wsgi.c(8892): mod_wsgi (pid=31550): Exiting thread 1 in daemon process 'blah'.
"""

"""
[Mon Feb 05 21:31:57.220110 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] ('REQUEST',
[Mon Feb 05 21:31:57.220141 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.220738 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] {'CONTEXT_DOCUMENT_ROOT': '/var/www/html',
[Mon Feb 05 21:31:57.220750 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.220765 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'CONTEXT_PREFIX': '',
[Mon Feb 05 21:31:57.220769 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.220782 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'DOCUMENT_ROOT': '/var/www/html',
[Mon Feb 05 21:31:57.220786 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.220798 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'GATEWAY_INTERFACE': 'CGI/1.1',
[Mon Feb 05 21:31:57.220802 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221033 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
[Mon Feb 05 21:31:57.221040 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221056 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
[Mon Feb 05 21:31:57.221060 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221073 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
[Mon Feb 05 21:31:57.221076 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221089 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_CONNECTION': 'keep-alive',
[Mon Feb 05 21:31:57.221092 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221105 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_COOKIE': 'sessionid=77p7khnd72w5qftowgn6kyga7s5zskkr',
[Mon Feb 05 21:31:57.221109 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221121 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_DNT': '1',
[Mon Feb 05 21:31:57.221124 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221137 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_HOST': 'www.blah.com',
[Mon Feb 05 21:31:57.221140 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221152 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
[Mon Feb 05 21:31:57.221156 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221199 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) '
[Mon Feb 05 21:31:57.221203 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221210 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'Gecko/20100101 Firefox/58.0',
[Mon Feb 05 21:31:57.221214 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221226 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'PATH_INFO': '/',
[Mon Feb 05 21:31:57.221229 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221255 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'PATH_TRANSLATED': '/var/www/blah.com/etc/wsgi/production_platform.py/',
[Mon Feb 05 21:31:57.221260 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221272 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'QUERY_STRING': '',
[Mon Feb 05 21:31:57.221276 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221287 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'REMOTE_ADDR': '197.101.86.105',
[Mon Feb 05 21:31:57.221291 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221302 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'REMOTE_PORT': '53208',
[Mon Feb 05 21:31:57.221306 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221318 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'REQUEST_METHOD': 'GET',
[Mon Feb 05 21:31:57.221327 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221339 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'REQUEST_SCHEME': 'https',
[Mon Feb 05 21:31:57.221343 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221355 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'REQUEST_URI': '/',
[Mon Feb 05 21:31:57.221358 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221384 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SCRIPT_FILENAME': '/var/www/blah.com/etc/wsgi/production_platform.py',
[Mon Feb 05 21:31:57.221388 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221401 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SCRIPT_NAME': '',
[Mon Feb 05 21:31:57.221404 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221416 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_ADDR': '172.31.24.122',
[Mon Feb 05 21:31:57.221420 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221432 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_ADMIN': '[no address given]',
[Mon Feb 05 21:31:57.221435 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221447 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_NAME': 'www.blah.com',
[Mon Feb 05 21:31:57.221451 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221462 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_PORT': '443',
[Mon Feb 05 21:31:57.221466 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221478 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_PROTOCOL': 'HTTP/1.1',
[Mon Feb 05 21:31:57.221481 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221517 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_SIGNATURE': '<address>Apache/2.4.18 (Ubuntu) Server at '
[Mon Feb 05 21:31:57.221522 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221528 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'www.blah.com Port 443</address>\\n',
[Mon Feb 05 21:31:57.221532 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221545 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'SERVER_SOFTWARE': 'Apache/2.4.18 (Ubuntu)',
[Mon Feb 05 21:31:57.221548 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221571 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'apache.version': (2, 4, 18),
[Mon Feb 05 21:31:57.221575 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221587 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.application_group': '',
[Mon Feb 05 21:31:57.221590 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221602 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.callable_object': 'application',
[Mon Feb 05 21:31:57.221606 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221622 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.connection_id': '9DyAHcQTWbc',
[Mon Feb 05 21:31:57.221626 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221638 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.daemon_connects': '1',
[Mon Feb 05 21:31:57.221641 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221653 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.daemon_restarts': '0',
[Mon Feb 05 21:31:57.221657 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221669 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.daemon_start': '1517859117219327',
[Mon Feb 05 21:31:57.221673 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221684 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.enable_sendfile': '0',
[Mon Feb 05 21:31:57.221688 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221699 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.handler_script': '',
[Mon Feb 05 21:31:57.221703 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221714 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.ignore_activity': '0',
[Mon Feb 05 21:31:57.221718 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221730 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.listener_host': '',
[Mon Feb 05 21:31:57.221733 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221744 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.listener_port': '80',
[Mon Feb 05 21:31:57.221748 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221760 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.path_info': '/',
[Mon Feb 05 21:31:57.221763 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221775 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.process_group': 'blah',
[Mon Feb 05 21:31:57.221779 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221791 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.queue_start': '1517859117219174',
[Mon Feb 05 21:31:57.221794 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221806 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.request_handler': 'wsgi-script',
[Mon Feb 05 21:31:57.221810 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221821 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.request_id': 'sjyAHcQTWbc',
[Mon Feb 05 21:31:57.221825 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221837 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.request_start': '1517859117218994',
[Mon Feb 05 21:31:57.221841 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221852 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.script_name': '',
[Mon Feb 05 21:31:57.221856 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221872 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.script_reloading': '1',
[Mon Feb 05 21:31:57.221875 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221888 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.script_start': '1517859117219466',
[Mon Feb 05 21:31:57.221891 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221902 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.thread_id': 1,
[Mon Feb 05 21:31:57.221906 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221917 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.thread_requests': 0,
[Mon Feb 05 21:31:57.221921 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221933 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.total_requests': 0,
[Mon Feb 05 21:31:57.221936 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221956 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'mod_wsgi.version': (4, 5, 24),
[Mon Feb 05 21:31:57.221960 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.221980 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.errors': <_io.TextIOWrapper name='<wsgi.errors>' encoding='utf-8'>,
[Mon Feb 05 21:31:57.221984 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222000 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.file_wrapper': <class 'mod_wsgi.FileWrapper'>,
[Mon Feb 05 21:31:57.222004 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222020 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.input': <mod_wsgi.Input object at 0x7fb3ab8a3e30>,
[Mon Feb 05 21:31:57.222024 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222037 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.input_terminated': True,
[Mon Feb 05 21:31:57.222040 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222052 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.multiprocess': True,
[Mon Feb 05 21:31:57.222056 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222067 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.multithread': True,
[Mon Feb 05 21:31:57.222071 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222082 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.run_once': False,
[Mon Feb 05 21:31:57.222086 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222125 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.url_scheme': 'http',
[Mon Feb 05 21:31:57.222129 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208]
[Mon Feb 05 21:31:57.222155 2018] [wsgi:error] [pid 31562:tid 140409636026112] [remote 197.101.86.105:53208] 'wsgi.version': (1, 0)})
[Mon Feb 05 19:32:57.279425 2018] [wsgi:error] [pid 31329:tid 140409611196160] [client 197.101.86.105:53208] Timeout when reading response headers from daemon process 'blah': /var/www/blah.com/etc/wsgi/production_platform.py
"""

Any ideas?

Once again thanks in advance - you're a rock star!

Cheers,
Thomas

Graham Dumpleton

unread,
Feb 5, 2018, 5:45:45 PM2/5/18
to mod...@googlegroups.com
You started using request-timeout, good. When using that option you get the track trace automatically when process shutdown due to it.

My vague recollection is that sending emails out for errors may be disabled when using DEBUG=False, or maybe you don't enable it for that. How is your logging settings setup and are the SMTP host information and access details what you believe is correct. It sort of looks like you are using SMTP host details where the host isn't reachable from where your application is running due to a firewall or something. If you get on the host where the server is running, can you ping the SMTP host and traceroute to the host on the SMTP port.

Graham

Thomas

unread,
Feb 6, 2018, 7:41:10 AM2/6/18
to modwsgi
Hi Graham,

Thanks again for all of the guidance and fantastic work on "mod_wsgi" and Apache and pretty much all things in this area!

You will be pleased to know that I have resolved the issue (thanks to all of the debugging etc.). Basically, I was being a noob :-|

There was a syntax error in one of my python modules (changing over from 2 to 3) which caused Django (not mentioned in their fantastic documentation) to throw an exception and stop the request - hence the timeout.

Oh well, we live and we learn.

Have a great day.

Cheers,
Thomas

Graham Dumpleton

unread,
Feb 6, 2018, 5:43:41 PM2/6/18
to mod...@googlegroups.com
Can you elaborate more? I don't understand how the exception could stop the request but not result in it returning. If it returned, even if not all data had been sent, that should have resulted in the proxy connection for the daemon process being closed and the Apache child worker doing the proxying, should have seen that and not just waited.

Graham

Thomas

unread,
Feb 27, 2018, 5:51:04 AM2/27/18
to modwsgi
Hi Graham,

Apologies for the late response. Here is a quick explanation for you;
  • Apache / mod_wsgi were routing or sending the request to our backend code - which had a middleware function that "injected" analytics code into our response context (html template response).
  • The problem was that this code was never executing (because of a typo / syntax error as mentioned previously). Normally, when there is a server request error (500) Django fires off one of those handy emails with the stack trace of the problem (similar to what would be seen in the browser window when the setting DEBUG = True).
  • And here's the kicker - we had not setup the email configuration yet, hence we were never receiving and trace of the problem, only the eventual timeout from Apache / mod_wsgi while waiting for something to come back from our backend. Lessons learnt!
So the only way at the time to figure this one out was to debug the requests / responses and that level as you suggested (and which we did), which gave us that AHA moment!

Thanks again and I hope that helps you understand the problem that we were experiencing better.

Cheers!
...

Graham Dumpleton

unread,
Feb 27, 2018, 5:14:37 PM2/27/18
to mod...@googlegroups.com
Okay, sounds like you solved it. Thanks for letting me know.

Graham
Reply all
Reply to author
Forward
0 new messages