Subject: Re: apache2 hangs with many threads
To: felix zaslavskiy <firstname.lastname@example.org>
From: Bill Studenmund <email@example.com>
Date: 05/29/2003 15:03:18
On 29 May 2003, felix zaslavskiy wrote:
> I am trying to see how apache2 thread model scales with the new kernel
> and scheduler activation.
> I compiled apache with worker module.
> Here is a configuration that worked without much problem
> StartServers 4
> ServerLimit 64
> ThreadPerChild 8
> So intialy 32 thread are created.
> With this configuration the server runs fine.
> Now if i change the settings to something like this
> StartServers 16
> ServerLimtit 64
> ThreadsPerChild 32
> As soon as any request comes to the server it hangs with loop
> If more then one request comes then that is how many processes loop
> In the error log a couple of these messages:
> [crit] listener thread didnt exit
> My initial guess is that the problem can be the stack size.
> I plan to increase it and see if the problem sticks around.
> Also what is the procedure for debuging threaded applications ?
gdb, though gdb in general isn't thread nice.
There are three main commands you'll want to use:
thread ex all - gives one list of what all threads are doing
info threads - gives another list of what threads are doing
thread ## - switch to that thread
The annoying thing is that gdb uses two different thread numbering
schemes, its own and the one libpthread uses. The number "thread ##" needs
is the one info threads gives, not the one from thread ex all. :-(
thread ex all will give you lines like:
0x49ec0000: thread 114 (target_worker092) sleeping on cond var at 0x80a1d04
info threads will give you lines like:
9 Thread 114 (target_worker092) 0x48267f42 in pthread__locked_switch ()
So to actually look at this thread, you want to do "thread 9" where 9 is
the thread number from info threads.
[Switching to thread 9 (Thread 114 (target_worker092))]
#0 0x48267f42 in pthread__locked_switch () from /usr/lib/libpthread.so.0
Hope this helps.