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?

2
  • Can you switch to nginx? Jun 15, 2019 at 3:09
  • Yes, I could switch to nginx, but I would like to know how to fix it Jun 15, 2019 at 18:46

1 Answer 1

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.

4
  • Thank you fo the answer Paul, how did you find that those third-party packages where causing issues? Jan 26, 2021 at 1: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. Jan 28, 2021 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, 2021 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. Feb 23, 2021 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.