Reason for “Gateway Timeout” (mod_wsgi)

Apache2mod-wsgi

I get "Gateway Timeout"

504: The gateway did not receive a timely response from the upstream server or application.

I use apache with mod_wsgi Version 4.4.8.

In the apache error log I see:

Timeout when reading response headers from daemon process 'md':
    /home/user/mc/src/mc/mc/mc.wsgi

The wsgi config:

WSGIDaemonProcess md user=mc group=users threads=1 processes=4
                     maximum-requests=1000 
                     request-timeout=600 
                     python-home=/localhome/user/mc
WSGIScriptAlias /mc /home/mc/src/mc/mc/mc.wsgi
<Location "/mc/">
    WSGIProcessGroup md
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
</Location>

The timeout happens after 100 seconds.

The timeout according to config is 600 seconds.

I have no clue why this happens. It is repeatable. The error is repeatable. It happens every time for a particular URL.

Step one would be for me: A better error message. Who is responsible for this message "Timeout when reading response headers from daemon process"?

Best Answer

I found the solution myself.

There was Timeout 100 somewhere in the Apache config.