On Wed, 2011-05-18 at 00:53 +0200, Rainer Jung wrote:

If you can find pstack, that will be easier. pstack just takes the
process id and writes out the stacks for all threads. My quick search
indicates it pstack should exist for FreeBSD.

There is a port for this but it only support i386 arch, im running amd64.


GDB allows to also get details on the values of variables used, step
through the code etc. You give gdb two arguments, the path to your httpd
binary and the process ID of the CPU consuming process. Once the gdb
prompt is shown, you can enter

thread apply all bt full

which will output thread and variable information for all threads.

pstack and gdb might produce many lines of output, especially for
worker, so you might want to write the result directly to a file, e.g.

pstack PID > /tmp/pstack.txt

And yes, if the problem also occurs for prefork, then that makes
debugging a bit easier.

I'll recompile to prefork and give GDB a go, thanks for the info.