Apache mpm worker + wsgi Python/Django workers stuck

You MPM settings are a bit broken for various reasons for a start. Suggest you watch my talk from PyCon at:

  • http://lanyrd.com/2013/pycon/scdyzk/#link-qhyk

As to your server hanging, you likely have a third party extension module being used which isn't safe to use from a sub interpreter. You need to force your application to run in the main interpreter. See:

  • http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API

For working out where processes are hanging also see means of getting stack traces as described in:

  • http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB
  • http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Extracting_Python_Stack_Traces

If it is a deadlock as expect and don't want to just try using the main interpreter, likely will need to use gdb to get stack traces of where it is stuck.

The Python stack traces approach will work if the problem is that your code is blocking on calls to external services. You can also perhaps get an idea of that by looking at open file descriptors using lsof or ofiles.