Quantcast

Re: The memory maybe leak in samba 4.3.11

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The memory maybe leak in samba 4.3.11

Samba - General mailing list
 > Is this an exist problem?
Yes

Fixed https://wiki.samba.org/index.php/Samba_4.3_Features_added/changed 
In 4.3.13

Greetz,

Louis


> -----Oorspronkelijk bericht-----
> Van: samba-technical
> [mailto:[hidden email]] Namens
> Zhangxiaoxu via samba-technical
> Verzonden: donderdag 4 mei 2017 14:42
> Aan: '[hidden email]';
> '[hidden email]'
> Onderwerp: The memory maybe leak in samba 4.3.11
>
> Hi,
>
> SCENE:
> Client A and Client B write data to an share.
> Client B open the share with windows explorer.
>
> Problem:
> The RES of smbd grows quickly.
>      $ top
> PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM    
> TIME+ COMMAND        CODE    DATA
> 2913029 nobody    20   0 1664536 1.204g  16608 D   0.0  1.3  
> 5:09.21 smbd            64        1318580
>
> Process 2913029 is the connection of client B.
> The DATA also grows quickly.
>
> Use smbcontrol, we found smbd process not talloc so much memory.
> $ smbcontrol 2913029 pool-usage
> full talloc report on 'null_context' (total  92353 bytes in
> 1274 blocks)
>
>   From logs, we found there a lot of 0x310(maybe
> MSG_PVFS_NOTIFY) message from the ctdb.
>
> Environment:
> Ubuntu 14.04
> Samba 4.3.11
> Windows 7 Client
>
> Configuration:
> clustering = yes
>     ctdbd socket = /var/run/ctdb/ctdbd.socket
>    max protocol = SMB3
>    large readwrite = yes
>    idmap config *:range = 1000000-1999999
>    log level = 2
>    use sendfile = yes
>    store dos attributes = yes
>    acl_xattr:ignore system acls = yes
>    aio read size = 1024
>    deadtime = 10
>
> Is this an exist problem?
> Could you give us some suggestion about how to find the root
> cause about the problem.
>
> Br,
> Zhang Xiaoxu.
> --------------------------------------------------------------
> --------------------------------------------------------------
> ---------
> ??????????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????
> ?????????
> This e-mail and its attachments contain confidential
> information from 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!
>


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: The memory maybe leak in samba 4.3.11

Samba - General mailing list
Oeps, sorry wrong one.

There where multiple fixes.

https://wiki.samba.org/index.php/Samba_4.4_Features_added/changed 
BUG #12377: vfs_glusterfs: Fix a memory leak in connect path.

https://wiki.samba.org/index.php/Samba_4.5_Features_added/changed
BUG #12485: ctdbd_conn: Fix a resource leak.

https://wiki.samba.org/index.php/Samba_4.6_Features_added/changed
## BUG #12624: lib/pthreadpool: Fix a memory leak.


Greetz,

Louis

> -----Oorspronkelijk bericht-----
> Van: samba-technical
> [mailto:[hidden email]] Namens
> Zhangxiaoxu via samba-technical
> Verzonden: donderdag 4 mei 2017 14:42
> Aan: '[hidden email]';
> '[hidden email]'
> Onderwerp: The memory maybe leak in samba 4.3.11
>
> Hi,
>
> SCENE:
> Client A and Client B write data to an share.
> Client B open the share with windows explorer.
>
> Problem:
> The RES of smbd grows quickly.
>      $ top
> PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM    
> TIME+ COMMAND        CODE    DATA
> 2913029 nobody    20   0 1664536 1.204g  16608 D   0.0  1.3  
> 5:09.21 smbd            64        1318580
>
> Process 2913029 is the connection of client B.
> The DATA also grows quickly.
>
> Use smbcontrol, we found smbd process not talloc so much memory.
> $ smbcontrol 2913029 pool-usage
> full talloc report on 'null_context' (total  92353 bytes in
> 1274 blocks)
>
>   From logs, we found there a lot of 0x310(maybe
> MSG_PVFS_NOTIFY) message from the ctdb.
>
> Environment:
> Ubuntu 14.04
> Samba 4.3.11
> Windows 7 Client
>
> Configuration:
> clustering = yes
>     ctdbd socket = /var/run/ctdb/ctdbd.socket
>    max protocol = SMB3
>    large readwrite = yes
>    idmap config *:range = 1000000-1999999
>    log level = 2
>    use sendfile = yes
>    store dos attributes = yes
>    acl_xattr:ignore system acls = yes
>    aio read size = 1024
>    deadtime = 10
>
> Is this an exist problem?
> Could you give us some suggestion about how to find the root
> cause about the problem.
>
> Br,
> Zhang Xiaoxu.
> --------------------------------------------------------------
> --------------------------------------------------------------
> ---------
> ??????????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????????
> ??????????????????????????????????????????????????????????
> ?????????
> This e-mail and its attachments contain confidential
> information from 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!
>


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 答复: The memory maybe leak in samba 4.3.11

Samba - General mailing list
On Tue, May 09, 2017 at 02:59:51AM +0000, Zhangxiaoxu via samba-technical wrote:

> Hi,
> Thanks a lot.
>
> Use the valgrind, we found the stack of the malloc as below, so, maybe it is not memory leak.
>     ==2796353== 36,334,440 bytes in 100,929 blocks are still reachable in loss record 774 of 774
>     ==2796353==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>     ==2796353==    by 0x953B88F: ??? (in /usr/lib/x86_64-linux-gnu/samba/libmessages-dgm.so.0)
>     ==2796353==    by 0x953BCA0: ??? (in /usr/lib/x86_64-linux-gnu/samba/libmessages-dgm.so.0)
>     ==2796353==    by 0x953C342: unix_msg_send (in /usr/lib/x86_64-linux-gnu/samba/libmessages-dgm.so.0)
>     ==2796353==    by 0x953E3B6: messaging_dgm_send (in /usr/lib/x86_64-linux-gnu/samba/libmessages-dgm.so.0)
>     ==2796353==    by 0x71732FF: messaging_send_iov_from (in /usr/lib/x86_64-linux-gnu/libsmbconf.so.0)
>     ==2796353==    by 0x716E1BA: ??? (in /usr/lib/x86_64-linux-gnu/libsmbconf.so.0)
>     ==2796353==    by 0x716E869: ??? (in /usr/lib/x86_64-linux-gnu/libsmbconf.so.0)
>     ==2796353==    by 0x716EA91: ??? (in /usr/lib/x86_64-linux-gnu/libsmbconf.so.0)
>     ==2796353==    by 0x7171207: ctdbd_migrate (in /usr/lib/x86_64-linux-gnu/libsmbconf.so.0)
>     ==2796353==    by 0x716BD6E: ??? (in /usr/lib/x86_64-linux-gnu/libsmbconf.so.0)
>         ==2796353==    by 0xAE6692F: ??? (in /usr/lib/x86_64-linux-gnu/samba/libdbwrap.so.0)
>
> Ifound the sendmsg is always failed because erron=EINTR, but smbd also need to malloc for the new msgs, so the res of the smbd grows up quickly.
>
> I add some code in unix_dgram_send_job, just send 10 times if sendmsg faild with EINTR, the res will not grows up anymore.
> Another, keep the max queue length to 100 also work well.
>
> I don’t know whether it is suitable for the process, also, I want to know why sendmsg return EINTR.

EINTR always means a signal was received and interrupted the send.

You're using 4.3.x yes ? In that branch:

static void unix_dgram_send_job(void *private_data)
{
        struct unix_dgram_msg *dmsg = private_data;

        do {
                struct msghdr_buf *hdr = unix_dgram_msghdr(dmsg);
                struct msghdr *msg = msghdr_buf_msghdr(hdr);
                dmsg->sent = sendmsg(dmsg->sock, msg, 0);
        } while ((dmsg->sent == -1) && (errno == EINTR));

        if (dmsg->sent == -1) {
                dmsg->sys_errno = errno;
        }
}

we already loop on EINTR. What exact version are you using and
what code did you add ?

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Loading...