Re: Re: 答复: [Samba] The memory maybe leak in samba 4.3.11

Zhangxiaoxu zhang.xiaoxu at h3c.com
Mon May 15 02:42:01 UTC 2017


> Is the sendmsg error code really EINTR, or is it EAGAIN/EWOULDBLOCK?
EAGAIN (Resource temporarily unavailable), the strace as below.
Then somebody will reconnect to the socket.
Whether the message queue will leak after the reconnect?

> you should investigate why the receiving process can't pick up the messages it should receive
From the message body when sendmsg, I think it is used for 'change notify'.
If we use an more performance CPU, the speed of memory grows up slower than before.
If the large load will cause the problem?

The straces:
sendmsg(6, {msg_name(110)={sa_family=AF_LOCAL, sun_path="/var/lib/samba/private/msg.sock/1525222"}, msg_iov(3)=[{"\0\0\0\0\0\0\0\0", 8}, {"\346E\27\0\0\0\0\0\0\0\0\0\3\0\0\0\230\324)\303\356\245\213\222\7S\r\0\0\0\0\0"..., 52}, {"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\200j\313?\205U\0\0\3\0\0\0win2"..., 53}], msg_controllen=0, msg_flags=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
socket(PF_LOCAL, SOCK_DGRAM, 0)         = 68
fcntl(68, F_GETFD)                      = 0
fcntl(68, F_SETFD, FD_CLOEXEC)          = 0
connect(68, {sa_family=AF_LOCAL, sun_path="/var/lib/samba/private/msg.sock/1525222"}, 110) = 0
pipe([69, 70])                          = 0
futex(0x7f9ae1190040, FUTEX_WAKE_PRIVATE, 2147483647) = 0 rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [FPE USR2 PIPE], 8) = 0

-----邮件原件-----
发件人: Volker Lendecke [mailto:Volker.Lendecke at SerNet.DE]
发送时间: 2017年5月12日 13:54
收件人: zhangxiaoxu 13123 (RD)
抄送: 'samba-technical at lists.samba.org'
主题: Re: Re: 答复: [Samba] The memory maybe leak in samba 4.3.11

On Fri, May 12, 2017 at 01:35:46AM +0000, Zhangxiaoxu wrote:
> Thanks a lot.
>
> > Do you have processes in D state or processes using 100% CPU continuously?
> Yes, if open the folder which is writing by itself and another client
> in windows explorer, the process will always in D state, and the CPU
> is higher.
> I notice that, the client will send `change notify request`, then the
> smbd will receive a lot of message with code 0x310.
> If the client receive the 'change notify response', it will send
> 'query directory request' to server.

That works as designed. That is what file change notify is for. The question is -- what is the process doing that can not receive the messages? Is the sendmsg error code really EINTR, or is it EAGAIN/EWOULDBLOCK? If you strace the sending process, you should find the destination socket in the sendmsg calls, and you should investigate why the receiving process can't pick up the messages it should receive.

> > It might be that some message receiver does not pick up its messages at all.
> Any idea about the case?
>
> How do you think the solution:
> keep the message queue length to 100 or more, and drop the other
> messages in 'queue_msg' function.

It will help with the memory leak, but in a well-working system we should never pile up messages. Something is going wrong in your system that should be investigated. See above.

Volker

--
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
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有新华三技术有限公司的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from New H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!


More information about the samba-technical mailing list