Samba 3.5.8 leaks memory in DEBUG (dbghdrclass)
Volker.Lendecke at SerNet.DE
Thu Dec 1 01:35:57 MST 2011
On Thu, Dec 01, 2011 at 08:20:06AM +0000, Dina_Fine at Dell.com wrote:
> Hello Jeremy
> The leak will not be noticeable for the main samba flow
> You see, we added additional samba processes (forked from
> the parent) which monitors the samba children death and
> will clean the clients state (byte-range locks, oplocks
> and such) in our distributed file system.
> This process will display a message on every dead samba
> child process.
> So the test which caused the below bug to leak a lot of
> memory is to run in loop cifs mount command with a
> non-existing user to a non-existing share (samba creates a
> new samba child processes for each mount attempt)
> But the bug will be noticeable for us not only in the
> above scenario.
> We have diagnostic procedure on our customers clusters.
> The customer can execute diagnostic command from the
> cluster CLI. The diagnostic will set a high debug level on
> samba processes, will take tcpdumps, strace when needed
> and such and then will send all the log files/traces to
> In such a case when samba debug level is high, a *lot* of
> messages are printed to the log and memory leaks very
We added the talloc_stackframe/talloc_tos code as
a protective measure against this very type of memory leak.
It is definitely not recommended to leak memory like debug.c
does, but it does happen as you just found out. So there's
two ways to fix that leak for you: First, go into debug.c
and fix the code there. We can certainly easily provide
patches for you that do this. Alternatively, you might add a
talloc_stackframe/TALLOC_FREE pair to your central event
loop in those processes. This solution would also protect
you against similar memory leaks in different code paths.
With best regards,
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical