<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="en-FR" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hello!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am looking for about 5GB of used binary memory that is missing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I can see the memory used when looking at memory allocators:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal">{{binary_alloc,0},<o:p></o:p></p>
<p class="MsoNormal"> [{mbcs,<o:p></o:p></p>
<p class="MsoNormal"> [{blocks,18542198,18542199,18542199},<o:p></o:p></p>
<p class="MsoNormal"> {blocks_size,5372314496,5372316832,5372370512},<o:p></o:p></p>
<p class="MsoNormal"> {foreign_blocks,[]},<o:p></o:p></p>
<p class="MsoNormal"> {raw_blocks,<o:p></o:p></p>
<p class="MsoNormal"> [{binary_alloc,<o:p></o:p></p>
<p class="MsoNormal"> [{count,18542198,18542199,18542199},<o:p></o:p></p>
<p class="MsoNormal"> {size,5372314496,5372316832,5372370512}]}]},<o:p></o:p></p>
<p class="MsoNormal"> {carriers,5581,5581,5581},<o:p></o:p></p>
<p class="MsoNormal"> {sys_alloc_carriers,5581},<o:p></o:p></p>
<p class="MsoNormal"> {carriers_size,5851119616,5851119616,5851119616},<o:p></o:p></p>
<p class="MsoNormal"> {sys_alloc_carriers_size,5851119616}]},<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">The allocators do not appear to be fragmented:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">recon_alloc:fragmentation(current). <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">[{{binary_alloc,0},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> [{sbcs_usage,1.0},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {mbcs_usage,0.9182027835598129},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {sbcs_block_size,0},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {sbcs_carriers_size,0},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {mbcs_block_size,5395621648},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {mbcs_carriers_size,5876285440}]},<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">recon_alloc:memory(usage). <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">0.9071327019562182<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">So I would expect this memory to be used by something in the system.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have looked at processes (memory, old/new heaps): nothing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">recon:bin_leak(40): nothing? The processes found don’t hold much memory.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">[{<11296.961.0>,-1064,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> [rabbit_web_dispatch_registry,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {current_function,{gen_server,loop,7}},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {initial_call,{proc_lib,init_p,5}}]},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<11296.894.0>,-557,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> [rabbit_core_metrics_gc,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {current_function,{gen_server,loop,7}},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {initial_call,{proc_lib,init_p,5}}]},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">recon:proc_count(binary_memory, 40): nothing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">[{<11296.986.0>,615780,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> [{current_function,{gen_server,loop,7}},{initial_call,{proc_lib,init_p,5}}]},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<11296.1089.0>,130680,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> [{current_function,{gen_server,loop,7}},{initial_call,{proc_lib,init_p,5}}]},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<11296.6432.32>,127254,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> [{current_function,{gen_server2,process_next_msg,1}},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> {initial_call,{proc_lib,init_p,5}}]},<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<11296.1179.32>,87609,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Ports all seem to use the same amount of memory.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">Ets/Mnesia tables: nothing. There aren’t that many and they’re all below 12MB.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Persistent terms: nothing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">persistent_term:info(). <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">#{count => 56,memory => 27536}<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">We do not use atomics to store binaries.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Am I missing something? Any tips to figure out what is going on?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This happens with two RabbitMQ customers using Windows<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">(2012 and 2016) with a recent RabbitMQ version.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This only started happening after moving to a newer RabbitMQ version<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">and seems unrelated to the OTP version. But it might be a bug triggered<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">by a new behavior in RabbitMQ. I would be happy to put the blame on<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">RabbitMQ but I cannot find where this leaking binary memory is used.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I can share crash dumps with OTP team from a test environment that<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">shows the same symptoms, but leaks less memory because the nodes<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">are not used as much (so the numbers differ but there’s still memory<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">not accounted for).<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The problem happens both on mostly idle and busy nodes, with busy<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">nodes losing track of memory quicker.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I will try to reproduce this on a local environment as time allows.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="mso-fareast-language:EN-GB">-- <o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US">Loïc Hoguin</span><o:p></o:p></p>
</div>
</body>
</html>