[Django]-Django Webfaction 'Timeout when reading response headers from daemon process'

43πŸ‘

βœ…

Python C extension modules, like numpy, are known to cause timeouts when used under mod_wsgi. There’s a clear explanation of the problem (direct from the author of mod_wsgi) available at https://serverfault.com/a/514251/109598

If that sounds like it might be the cause of your problem, then the solution is probably simple – add the following to your httpd.conf:

WSGIApplicationGroup %{GLOBAL}

Be sure to restart your Apache instance after making that change.

πŸ‘€Sean F

7πŸ‘

Try increasing Timeout directive in httpd.conf, which defaults to 60 seconds in Apache 2.4. For example:

TimeOut 600
πŸ‘€tuomastik

7πŸ‘

Here is how I was able to find the root cause of my issue.

python manage.py showmigrations

My app could not reach the database server, so it would eventually time out. Running manage.py I could see see the error message on the console.

πŸ‘€Marston

0πŸ‘

In my case (Python 3.6), the mimetypes module caused this problem. I did not further investigate this, but removing a call to mimetypes.guess_type solved the problem. The call was made in the related Django view function.

πŸ‘€Markus

0πŸ‘

I hit the same problem because the home directory of the user under which the wsgi process was running had became unavailable at some point during the server upgrade.

This might help someone.

πŸ‘€phep

0πŸ‘

Thank you to lenhhoxung who in the comments to one of the other solutions mentioned upgrading server capabilities. I had been successfully running a demo site on an AWS EC2 Nano instance for a long time, but for some reason it suddenly started erroring out on one page that has some complex computations. I upgraded it to an AWS EC2 Micro instance, problem solved. I think this is worthy of its own answer here considering this took a good chunk of a day. All credit to lenhhoxung, though! Thanks!

πŸ‘€Scott

Leave a comment