Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 runserver), i.e. I can see the request URL in the output of top.

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.

share|improve this question

Use gdb to work out why it crashes. See:

If that doesn't help you to work out problem yourself, then suggest you post all the details to the mod_wsgi mailing list as this site doesn't work well when needing to iteratively debug a problem.

Also try forcing use of main Python interpreter using:

WSGIApplicationGroup %{GLOBAL}

It may be the case that setproctitle module doesn't work properly in sub interpreters, although I can't see why it wouldn't as it should just be a wrapper for a single function and should be pretty simple.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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