3

I have a Django 1.11.17 application deployed on Apache 2 and WSGI, Python 2.7.

Apache shows an error "Truncated or oversized response headers received from daemon process"

I have checked the solution given in WSGI : Truncated or oversized response headers received from daemon process

and WSGIApplicationGroup %{GLOBAL} is in the virtual host file. However the error persists.

Django shell works. Django check returns no errors. Django runserver works. Django log shows no errors.

How can I see the exact error that is making WSGI not working?

1 Answers1

4

There is a debugging mode that you can use provided by mod_wsgi. You can find the documentation here:
https://modwsgi.readthedocs.io/en/develop/user-guides/debugging-techniques.html

However, we found that we were using third-party packages such as numpy or psycopg2-binary that were causing issues. In our case, we were using psycopg2-binary which is a big no no for production apps. We removed it and followed their documentation on pip installation and everything worked. We also added WSGIApplicationGroup %{GLOBAL} to our apache2 server settings.

You may find the psycopg documentation at http://initd.org/psycopg/docs/install.html#prerequisites

Hope this helps.

fboaventura
  • 1,125
  • 11
  • 16
Paul Tuckett
  • 156
  • 1
  • Thank you fo the answer Paul, how did you find that those third-party packages where causing issues? – Jose Luis de la Rosa Jan 26 '21 at 01:58
  • Since the project worked outside of the daemon process, I knew it had to do with an installation or configuration issue. After a couple of days tweaking my configuration files with no luck, I spent a week reading through the documentation of all the packages in my requirements.txt and a shiz ton of googling. I found statements about how you should install packages from the source code, because they can cause conflicts with system libraries. With the process of elimination, we identified the packages and reinstalled. – Paul Tuckett Jan 28 '21 at 14:45
  • from the above `psycopg` documentation i can see that v2.7 is having issues, but i am using `psycopg2==2.8.4` `psycopg2-binary==2.8.5`. and getting same error! :( – Susaj S N Feb 12 '21 at 12:15
  • 1
    @SusajSN Have you checked out the debugging tool that mod_wsgi provides? It can give you some more context to your error. It also might not be psycopg2 that is causing the issue. It might be your python tools installed on your server, another pip package, or a settings problem in your apache virtual host file. – Paul Tuckett Feb 23 '21 at 22:29