<meta http-equiv="Content-Type" content="text/html; charset=GB18030"><div><br></div><div style="position: relative;"><div><div data-zone-id="0" data-line-index="0" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;">Hi Erik</div><div data-zone-id="0" data-line-index="1" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="1" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="2" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;">Thanks for your answer, after last time report, I have tried add some logs together with the fragment patch <a href="https://bugs.openjdk.org/browse/JDK-8276055" linkid="jtHOowwrHO" target="_blank" rel="noopener" style="outline: none; text-decoration-line: none; cursor: pointer; color: rgb(51, 112, 255); transition: color 0.3s ease 0s; margin-right: 2px;">https://bugs.openjdk.org/browse/JDK-8276055</a><a href="https://bugs.openjdk.org/browse/JDK-8276055." target="_blank" rel="noopener" style="outline: none; text-decoration-line: none; cursor: pointer; color: rgb(51, 112, 255); transition: color 0.3s ease 0s; margin-right: 2px;">.</a> maybe because of last time I haven't built the jdk17 right, I can't reproduce the problem until now this time(the apps running about 3 days, maybe not enough time), I will keep observing for a while.</div><div data-zone-id="0" data-line-index="3" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="3" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="3" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;">If it happens again, I will add -Xlog:gc+init and -XX:SoftMaxHeapSize to find more information and give the result data for analysis.</div><div data-zone-id="0" data-line-index="4" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;">However, since the time it takes to reproduce the problem maybe a week or more, I will report the observation in 2 weeks to let you know the result.</div><div data-zone-id="0" data-line-index="5" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="5" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="6" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;">Thanks again</div><div data-zone-id="0" data-line-index="6" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="6" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;"><br></div><div data-zone-id="0" data-line-index="7" data-line="true" style="font-family: "lucida Grande", Verdana; margin-top: 4px; margin-bottom: 4px; line-height: 1.6;">Anjian</div></div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b>                                                                                                                        "Erik Osterlund"                                                                                    <erik.osterlund@oracle.com>;</div><div><b>发送时间:</b> 2022年9月27日(星期二) 下午4:15</div><div><b>收件人:</b> "地上的月影"<404450559@qq.com>;<wbr></div><div><b>抄送:</b> "zgc-dev"<zgc-dev@openjdk.org>;<wbr></div><div><b>主题:</b> Re: out of address space</div></div><div><br></div>




Hi Anjian,
<div class=""><br class="">
</div>
<div class="">Thank you for reporting this issue. I have filed a bug for investigating this:</div>
<div class=""><a href="https://bugs.openjdk.org/browse/JDK-8294425" class="">https://bugs.openjdk.org/browse/JDK-8294425</a></div>
<div class=""><br class="">
</div>
<div class="">Based on the reported symptoms, it smells like the virtual address space</div>
<div class="">has gotten fragmented over time, possibly due to large allocations that</div>
<div class="">are too large to move around. We do reserve “a bunch” of extra virtual</div>
<div class="">address space to deal with that, but perhaps something is flawed in that</div>
<div class="">logic, and you have hit some kind of corner case.</div>
<div class=""><br class="">
</div>
<div class="">If you run -Xlog:gc+init, then we can see how much address space was</div>
<div class="">reserved by the GC when the JVM started. This information would be</div>
<div class="">very useful to further reason about what has happened. So if we could</div>
<div class="">get the output of that logging, that would be great.</div>
<div class=""><br class="">
</div>
<div class="">As a workaround for now, if you would like to force ZGC to reserve more</div>
<div class="">virtual address space, you can use the following JVM flags:</div>
<div class=""><br class="">
</div>
<div class="">-Xmx50G -XX:SoftMaxHeapSize=50G -Xmx1T</div>
<div class=""><br class="">
</div>
<div class="">Then ZGC is forced to reserve virtual memory as if the heap could grow</div>
<div class="">to 1T, while in fact, the SoftMaxHeapSize will limit heap growth past 50G</div>
<div class="">unless the GC can’t keep up. This will ensure that the GC has tons of</div>
<div class="">virtual address space at its disposal. If you still run out of virtual address</div>
<div class="">space, then the issue is probably not due to virtual address space fragmentation.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">/Erik</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 21 Sep 2022, at 08:34, 地上的月影 <<a href="mailto:404450559@qq.com" class="">404450559@qq.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Hi everyone</div>
<div class="">    these days when I use zgc with jdk17, after the app run for a few days, I meet a "out of address space" problem, and cpu raise to nearly 100%, looks like there is infinite loop.</div>
<div class=""><br class="">
</div>
<div class=""><span style="background-color: transparent; font-family: inherit; font-size: var(--fs-body1); font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit; white-space: inherit; color: var(--highlight-color);" class="">Out
 of address space </span></div>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); font-family: var(--ff-mono); font-size: var(--fs-body1); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: var(--highlight-bg); border-radius: var(--br-md); color: var(--highlight-color); overflow-wrap: normal; "><code class="language-java hljs" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: var(--fs-body1); vertical-align: baseline; box-sizing: inherit; background-color: transparent; white-space: inherit;">Force to lower max java heap size from 50G(<span class="hljs-number" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);">100</span>%) to 50G(<span class="hljs-number" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);">100</span>%)
Out of address space 
Force to lower max java heap size from 50G(<span class="hljs-number" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);">100</span>%) to 50G(<span class="hljs-number" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);">100</span>%)
Out of address space 
Force to lower max java heap size from 50G(<span class="hljs-number" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);">100</span>%) to 50G(<span class="hljs-number" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-namespace);">100</span>%)</code></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); font-family: var(--ff-mono); font-size: var(--fs-body1); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: var(--highlight-bg); border-radius: var(--br-md); color: var(--highlight-color); overflow-wrap: normal; "><code class="language-java hljs" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: var(--fs-body1); vertical-align: baseline; box-sizing: inherit; background-color: transparent; white-space: inherit;"><br class=""></code></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><span style="color: var(--highlight-color); font-family: var(--ff-mono); font-size: var(--fs-body1); background-color: var(--highlight-bg);" class="">after I check the source code, it looks like the problem is in the function ZPageAllocator::alloc_page -> retry loop</span></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><br class=""></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; ">my profile flame graph also shows that the most cpu take func is alloc_page_finalize</pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><br class=""></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><pre class="lang-java s-code-block" style=" overflow-wrap: normal; margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); ">ZPageAllocator::alloc_page_finalize 91.92%</pre><pre class="lang-java s-code-block" style=" overflow-wrap: normal; margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); ">  ZPageAllocator::alloc_page_create 91.92%</pre><pre class="lang-java s-code-block" style=" overflow-wrap: normal; margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); ">    ZVirtualMemoryManager::alloc 90.85%</pre></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; ">      ZMemoryManager::alloc_from_back 89.07%</pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><br class=""></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; ">I have tried to add this fragment patch but it seems not useful</pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><a href="https://bugs.openjdk.org/browse/JDK-8276055" class="">https://bugs.openjdk.org/browse/JDK-8276055</a></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; ">how can I fix this or debug this?</pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><br class=""></pre>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><span style="  ; ; " class="">looking forward to your answers.</span></pre>
<div style="  ; ; " class="">best wishes!</div>
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><i style="  ; ; " class="">-Anjian Wen</i>  </pre>
<br class="">
<pre class="lang-java s-code-block" style=" margin-top: 0px;  padding: var(--su12); border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: var(--lh-md); vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; border-radius: var(--br-md); overflow-wrap: normal; "><span style="color: var(--highlight-color); font-family: var(--ff-mono); font-size: var(--fs-body1); background-color: var(--highlight-bg);" class=""> </span><span style=" color: rgb(220, 220, 170); ; ; ; ; ; " class=""></span></pre>
</div>
</blockquote>
</div>
<br class="">
</div></div>