Occasionally, I get an apache process running at 100% CPU. I've tried letting it run it's course, but I've seen it go more than half an hour without giving up. My running hypothesis is there is an infinite loop in some application code somewhere.
I've used mod_status, but the PID doesn't show up there.
I've attached GDB and gotten this backtrace:
#0 0x00895424 in __kernel_vsyscall ()
#1 0x00574cde in poll () from /lib/i686/nosegneg/libc.so.6
#2 0x0012d520 in apr_poll () from /usr/lib/libapr-1.so.0
#3 0x00707902 in ?? () from /etc/httpd/modules/mod_wsgi.so
#4 0x0070e7b1 in ?? () from /etc/httpd/modules/mod_wsgi.so
#5 0x00d1e81a in ap_run_post_config ()
#6 0x00d09812 in main ()
So it looks like it's a mod_wsgi process causing me troubles. Is there a way for me to figure out what request goes with that process?
Alternatively, is there a way for me to attach a python profiler or debugger to see what code is running?
Such debugging techniques are covered in the mod_wsgi documentation.