Re: [linux-audio-dev] NPTL jack+ardour: large memlock required (was: Jack and NPTL (again?))

From: Lee Revell <rlrevell@email-addr-hidden-job.com>
Date: Fri Nov 25 2005 - 20:43:36 EET

On Fri, 2005-11-25 at 11:10 +1030, Jonathan Woithe wrote:
> I have since discovered (thanks to strace) that the problem lies in an
> mmap2() call which requests a size of around 8MB. It appears to be
> part of the NPTL pthread_create() function. The error returned by
> mmap2() (EAGAIN) indicates either a locked file or "too much locked
> memory" (according to the manpage). Because this is an anonymous map
> the problem must have been the latter. Increasing the "locked memory"
> limit from 20MB to 40MB made jackd start without having to resort to
> the LD_ASSUME_KERNEL hack.
>

I stumbled across the same problem a few weeks ago working on another
project. This is glibc allocating an 8MB (!) stack for each thread. It
gets the default thread stack size from getrlimit(). With mlockall()
you will go OOM really fast like that.

The real fix is for JACK to set a reasonable thread stack size in
jack_create_thread. You can work around the problem by appending this
line to /etc/security/limits.conf:

* hard stack 512

for a 512KB stack.

As a bonus this will make the footprint of your other threaded apps like
Evolution smaller, though those apps don't care as much as their thread
stacks are pageable.

Lee
Received on Sat Nov 26 00:15:08 2005

This archive was generated by hypermail 2.1.8 : Sat Nov 26 2005 - 00:15:09 EET