pthread programming eats up resources (My or FreeBSD's fault?)

David Xu davidxu at freebsd.org
Fri Feb 21 04:57:09 UTC 2014


On 2014/02/21 12:44, Erich Dollansky wrote:
> Hi,
>
> On Thu, 20 Feb 2014 16:06:30 +0800
> David Xu <davidxu at freebsd.org> wrote:
>
>> On 2014/02/20 14:06, Erich Dollansky wrote:
>>
>> I have found the bug, it is in rtld, where malloc_aligned() is
>> misfunctioning, memory can be corrupted by the function.
>>
>> libthr calls _rtld_allocate_tls to allocate tls control block,
>> the function is in rtld, its uses malloc_aligned() which is not
>> working correctly.
>>
> I installed the patch. It is now much, much better but after hours,
> something still seems wrong. Size went above 200MB after 40min of CPU
> time. The number of threads is now above 1200. The machine also has 3
> zombies. The machine was restarted some 4h ago.
>
> Erich
>

Default thread stack size on 32-bit machine is 1M, if you have
1024 threads, the size can be larger than 1G. I checked
maxinum threads kernel allowed is max_threads_per_proc
which is 1500 default. So what you have seen might be normal.
I don't know what is zombie, is it a zombie process?
thread library does not create process.

Regards,
David Xu



More information about the freebsd-hackers mailing list