<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 22, 2019 at 7:18 AM Zhou, Cynthia (NSB - CN/Hangzhou) <<a href="mailto:cynthia.zhou@nokia-sbell.com">cynthia.zhou@nokia-sbell.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="ZH-CN">
<div class="gmail-m_6973850192976756279WordSection1">
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">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, </span></p></div></div></blockquote><div><br></div><div>This is a legitimate leak. Can you post a patch to gerrit?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="ZH-CN"><div class="gmail-m_6973850192976756279WordSection1"><p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">but some otherwhere is still
leaking, I have no clue about the other leak points.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">--- a/rpc/rpc-transport/socket/src/socket.c<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+++ b/rpc/rpc-transport/socket/src/socket.c<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">@@ -1019,7 +1019,16 @@ static void __socket_reset(rpc_transport_t *this) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> memset(&priv->incoming, 0, sizeof(priv->incoming));<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> event_unregister_close(this->ctx->event_pool, priv->sock, priv->idx);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">-<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ if(priv->use_ssl&& priv->ssl_ssl)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ gf_log(this->name, GF_LOG_TRACE,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ "clear and reset for socket(%d), free ssl ",<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ priv->sock);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ SSL_shutdown(priv->ssl_ssl);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ SSL_clear(priv->ssl_ssl);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ SSL_free(priv->ssl_ssl);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ priv->ssl_ssl = NULL;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> priv->sock = -1;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> priv->idx = -1;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> priv->connected = -1;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">@@ -4238,6 +4250,16 @@ void fini(rpc_transport_t *this) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> pthread_mutex_destroy(&priv->out_lock);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> pthread_mutex_destroy(&priv->cond_lock);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> pthread_cond_destroy(&priv->cond);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ if(priv->use_ssl&& priv->ssl_ssl)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ gf_log(this->name, GF_LOG_TRACE,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ "clear and reset for socket(%d), free ssl ",<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ priv->sock);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ SSL_shutdown(priv->ssl_ssl);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ SSL_clear(priv->ssl_ssl);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ SSL_free(priv->ssl_ssl);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ priv->ssl_ssl = NULL;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">+ }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> if (priv->ssl_private_key) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> GF_FREE(priv->ssl_private_key);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"> }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<div>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US"> Zhou, Cynthia (NSB - CN/Hangzhou)
<br>
<b>Sent:</b> Thursday, April 18, 2019 5:31 PM<br>
<b>To:</b> 'Atin Mukherjee' <<a href="mailto:amukherj@redhat.com" target="_blank">amukherj@redhat.com</a>><br>
<b>Cc:</b> 'Raghavendra Gowdappa' <<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>>; '<a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a>' <<a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a>><br>
<b>Subject:</b> RE: [Gluster-devel] glusterfsd memory leak issue found after enable ssl<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">We scan it use memory-leak tool, there are following prints. We doubt some open ssl lib malloc is is not properly freed by glusterfs code.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">er+0x2af [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libglusterfs.so.0.0.1]\n\t\tstart_thread+0xda</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">
[</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US"><a href="http://libpthread-2.27.so" target="_blank">libpthread-2.27.so</a></span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">13580</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 175 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">232904</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 14 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
[15:41:56] Top 10 stacks with outstanding allocations:<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">8792</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 14 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">9408</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 42 allocations from stack<br>
b'CRYPTO_realloc+0x4d [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">9723</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 14 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">10696</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 21 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">11319</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 602 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">11431</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 518 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<br>
</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">11704</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US"> bytes in 371 allocations from stack<br>
b'CRYPTO_malloc+0x58 [</span><u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:blue" lang="EN-US">libcrypto.so.1.0.2p]\n\t\t[unknown</span></u><span style="font-size:10pt;font-family:"Segoe UI",sans-serif;color:rgb(26,26,26)" lang="EN-US">]'<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">cynthia<u></u><u></u></span></p>
<div>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US"> Zhou, Cynthia (NSB - CN/Hangzhou)
<br>
<b>Sent:</b> Thursday, April 18, 2019 5:25 PM<br>
<b>To:</b> 'Atin Mukherjee' <<a href="mailto:amukherj@redhat.com" target="_blank">amukherj@redhat.com</a>><br>
<b>Cc:</b> Raghavendra Gowdappa <<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>>;
<a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a><br>
<b>Subject:</b> RE: [Gluster-devel] glusterfsd memory leak issue found after enable ssl<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">I</span><span style="font-size:10.5pt;font-family:DengXian">’<span lang="EN-US">ve test on glusterfs3.12.15 and glusterfs5.5 all have this issue, after enable tls ssl socket,
when execute gluster v heal <vol-name> info, will trigger glfshel to connect glusterfsd process, and cause glusterfsd process memory leak. Could you please try in your env?
<u></u><u></u></span></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US">cynthia<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:DengXian" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11pt;font-family:"Calibri",sans-serif" lang="EN-US"> Atin Mukherjee <<a href="mailto:amukherj@redhat.com" target="_blank">amukherj@redhat.com</a>>
<br>
<b>Sent:</b> Thursday, April 18, 2019 1:19 PM<br>
<b>To:</b> Zhou, Cynthia (NSB - CN/Hangzhou) <<a href="mailto:cynthia.zhou@nokia-sbell.com" target="_blank">cynthia.zhou@nokia-sbell.com</a>><br>
<b>Cc:</b> Raghavendra Gowdappa <<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>>;
<a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a><br>
<b>Subject:</b> Re: [Gluster-devel] glusterfsd memory leak issue found after enable ssl<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">On Wed, 17 Apr 2019 at 10:53, Zhou, Cynthia (NSB - CN/Hangzhou) <<a href="mailto:cynthia.zhou@nokia-sbell.com" target="_blank">cynthia.zhou@nokia-sbell.com</a>> wrote:<u></u><u></u></span></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">In my recent test, I found that there are very severe glusterfsd memory leak when enable socket ssl option<u></u><u></u></span></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">What gluster version are you testing? Would you be able to continue your investigation and share the root cause? <u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US">-- <u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">- Atin (atinm)<u></u><u></u></span></p>
</div>
</div>
</div>
</blockquote></div></div>