Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Milind Changire
According to BIO_new_socket() man page ... *If the close flag is set then the socket is shut down and closed when the BIO is freed.* For Gluster to have more control over the socket shutdown, the BIO_NOCLOSE flag is set. Otherwise, SSL takes control of socket shutdown whenever BIO is freed. _

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Zhou, Cynthia (NSB - CN/Hangzhou)
Ok ,another question, why priv->ssl_sbio = BIO_new_socket(priv->sock, BIO_NOCLOSE); use NOCLOSE mode instead of BIO_CLOSE? cynthia From: Milind Changire Sent: Monday, April 22, 2019 2:21 PM To: Zhou, Cynthia (NSB - CN/Hangzhou) Cc: Atin Mukherjee ; gluster-devel@gluster.org Subject: Re: [Glust

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Milind Changire
Looks like using BIO_free() is not right. Here's what the SSL_set_bio() man page says ... SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except that it connects both the rbio and the wbio at the same time, and *transfers the ownership of rbio and wbio to ssl* according to the foll

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Zhou, Cynthia (NSB - CN/Hangzhou)
I do some google. Seems it is not needed to call BIO_free, SSL_free will free bio. https://groups.google.com/forum/#!topic/mailing.openssl.users/8i9cRQGlfDM From: Milind Changire Sent: Monday, April 22, 2019 1:35 PM To: Zhou, Cynthia (NSB - CN/Hangzhou) Cc: Atin Mukherjee ; gluster-devel@gluste

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Zhou, Cynthia (NSB - CN/Hangzhou)
I tried to print priv->ssl_sbio after SSL_free() find this pointer is not null, so I add free ssl_sbio with BIO_free, however this cause glusterfd coredump (gdb) bt #0 0x7f3047867f9b in raise () from /lib64/libc.so.6 #1 0x7f3047869351 in abort () from /lib64/libc.so.6 #2 0x7f30478aa

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Milind Changire
This probably went unnoticed until now. On Mon, Apr 22, 2019 at 10:45 AM Zhou, Cynthia (NSB - CN/Hangzhou) < cynthia.z...@nokia-sbell.com> wrote: > Why there is no bio_free called in ssl_teardown_connection then? > > > > cynthia > > > > *From:* Milind Changire > *Sent:* Monday, April 22, 2019

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Zhou, Cynthia (NSB - CN/Hangzhou)
Hi, Thanks for your quick responding! My test env is without patch 22334, so priv->ssl_ctx is shared one. In socket_reset there is no need to free it. but if with patch 22334, it is absolutely needed to free priv->ssl_ctx as well. Following is the log captured from glusterfsd side while connectio

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Zhou, Cynthia (NSB - CN/Hangzhou)
Ok, I will post it later. cynthia From: Raghavendra Gowdappa Sent: Monday, April 22, 2019 10:09 AM To: Zhou, Cynthia (NSB - CN/Hangzhou) Cc: Atin Mukherjee ; gluster-devel@gluster.org Subject: Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl On Mon, Apr 22, 2019 at 7:1

Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl

2019-04-21 Thread Zhou, Cynthia (NSB - CN/Hangzhou)
Hi, From my code study it seems priv->ssl_ssl is not properly released, I made a patch and the glusterfsd memory leak is alleviated with my patch, but some otherwhere is still leaking, I have no clue about the other leak points. --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transpor