I want to use the python setproctitle module to update the process name of a python WSGI worker process when it starts working on a request. (This is to try to track down what URLs are using all the CPU). I have written a simple Django middleware class that will call
setproctitle.setproctitle(request.path). This works fine in the django debug server (i.e.
python manage.py runserver), i.e. I can see the request URL in the output of
However when I try to run the same code using apache & mod_wsgi the wsgi process segfaults when it loads the middleware python file. It segfaults at the
import setproctitle line. (print statements before that line are executed, but not after).
Is it possible to get setproctitle working with wsgi?
The server is Ubuntu Linux, using apache, mod_wsgi, and django.