2

I have a wsgi application configured as follows:

WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess myapp user=myuser threads=10 maximum-requests=10000
WSGIScriptAlias / /usr/local/myapp/wsgi.py
WSGIProcessGroup myapp

I expected to see running processes for my app... but with ps aux or pstree I see no child processes:

init─┬─apache2─┬─apache2
     │         ├─2*[apache2───26*[{apache2}]]
     │         ├─apache2───14*[{apache2}]
     │         ├─apache2───12*[{apache2}]
     │         └─apache2───16*[{apache2}]

Is my wsgi executing in daemon mode? How can I inspect the health of my python process?

I'm trying to debug my wsgi python application which hangs (sometimes with a memory fault) when a lot of connections are requested at the same time (say: 30 consecutive ajax requests from a single web page).

Emanuele Paolini
  • 9,912
  • 3
  • 38
  • 64

1 Answers1

2

For the sake of completeness I am expanding on the comment by Mikko Ohtamaa.

The mod_wsgi process name indeed takes the name of the parent process, something like eg. /usr/sbin/apache2 -k start depending on distros etc.

Using the display-name option allows us to set a different process name:

Defines a different name to show for the daemon process when using the ps command to list processes. If the value is %{GROUP} then the name will be (wsgi:group) where group is replaced with the name of the daemon process group.

Note that only as many characters of the supplied value can be displayed as were originally taken up by argv0 of the executing process. Anything in excess of this will be truncated.

This feature may not work as described on all platforms. Typically it also requires a ps program with BSD heritage. Thus on some versions of Solaris UNIX the /usr/bin/ps program doesn’t work, but /usr/ucb/ps does. Other programs which can display this value include htop.

Reference.

Example:

WSGIDaemonProcess myapp user=myuser threads=10 maximum-requests=10000 display-name=django-myapp
WSGIScriptAlias / /usr/local/myapp/wsgi.py
WSGIProcessGroup myapp

Then:

ps aux | grep django-myapp
Community
  • 1
  • 1
Wtower
  • 18,848
  • 11
  • 103
  • 80