djangoapachemod-wsgi

experiencing intermittent apache error AH01630


We have two different django apps running on a server (Centos7), using django manage.py runmodwsgi (python module mod_wsgi). Both apps are running fine, and have been for a few years. The odd thing we are running into is that every 10-12 days or so, we get a 403 Forbidden message in the browser. When checking the mod_wsgi apache error log (/tmp/mod_wsgi-localhost:8080:1999/error_log), there is nothing except the error below, which is triggered whenever the user unsuccessfully tries to access the app.

 AH01630: client denied by server configuration: /tmp/mod_wsgi-localhost:8080:1999/htdocs

After receiving this error, I can see that the htdocs directory that is referenced in the error doesn't exist.

Restarting the web server fixes the issue (and the htdocs directory reappears).

Both apps experience this issue. Sometimes at the same time, sometimes not. Both apps otherwise run fine. We would really like to find a solution to this annoying issue.

Googling this error just gives me advice on the httpd.conf file content, but I have not been able to find any help on this when the issue is intermittent the way I'm describing it here.

I have plotted the date/times of the AH01630 errors, and find that this happens at an oddly regular cadence, really every 10-12 days for both tools.

I'm at a loss of even knowing how to further troubleshoot it. Any ideas are appreciated.


Solution

  • I believe I have found the solution to this myself, by reading the words of the wise Mr Graham Dumpleton, author of mod_wsgi: "if you are going to leave these running permanently, ensure you use --server-root option to specify where to place generated files. Don't use the default under /tmp as some operating systems run cron jobs that remove old files under /tmp, which can screw up things."

    I was running things under /tmp. I am now adding --server-root to my "python manage.py runmodwsgi" command, and will see whether this resolves the issue.