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:
>
> This looks like you have a kernel bug.
>

I was tinkering with the kernel code a bit to see if I can delay the
futex_wake any further and this looks like a fairly tricky problem.

The wake involves writing to an address within the process mm, so the
latest point at which it can be safely done is just before releasing
the mm. Any later than that and we run the risk of writing to an
invalid memory location since it is possible that nobody was waiting
for us by the time we tried to do the wake.

There's a bunch of stuff that happens after that, before the task is
actually reaped (and hence no longer figures in the rlimit) and so
even if the thread calling pthread_join thinks that the other thread
has exited (due to getting futex_wake'd), the resources of that thread
haven't completely been freed yet and hence add up in rlimit and in
/proc/PID/status.


-- 
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]