This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: NPTL not properly cleaning up threads on SMP systems?


On 2 June 2012 20:12, Carlos O'Donell <carlos@systemhalted.org> wrote:
>> I haven't observed this issue on single-processor systems
>> (ran the test on a dedicated user with a RLIMIT_NPROC of NB_THREADS + 3 for hours without getting EAGAIN).
>
> This looks like you have a kernel bug.
>
> On an x86-64 (X5560 4 core [8 hts], ~50GB RAM) system running Ubuntu
> 10.04.2 LTS 2.6.32-31-generic kernel I see 1-3 threads active at any
> point.

On a serious note, I see this all the time on my tests runs and it is
in fact a kernel issue. The problem here is that the kernel needs to
signal the joining thread before it exits and the time taken from that
point to actual freeing of task resources seems to be longer than the
time it takes for the process to spawn another thread after joining
and for that thread to return.

A very simple way to eliminate this is to introduce a very small
usleep within the thread function. This eventually needs to be fixed
within the kernel, to try and get the signal as close to the task
reaping point as possible.


-- 
Siddhesh Poyarekar
http://siddhesh.in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]