<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:28:50 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-2860] Mmap() causing OOM</title>
                <link>https://jira.whamcloud.com/browse/LU-2860</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;When using mmap() on files on a Lustre FS (v2.1.2), the Linux kernel sometimes invokes the out-of-memory killer, even when the system has most of its memory free.  The attached kernel OOM log shows an example of a system that crashed with &amp;gt;20GB memory free and 99% of the 16GB of swap unused.&lt;/p&gt;

&lt;p&gt;It can take several hours before the OOM killer is triggered under normal mmap() usage.  To help with debugging, I&apos;ve found that the following source code can cause an instantaneous OOM condition if run from a directory on a Lustre FS, even though mmap() is not correctly used in the source code.  (The appropriate behavior would be for the kernel to terminate the code, not cause an OOM condition).  This may help identify the problem in the code path which is causing the main OOM issue in production mmap() usage.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;sys/mman.h&amp;gt;
#include &amp;lt;inttypes.h&amp;gt;

&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; main(void) {
  int64_t i, j, size=0, memsize=0;
  FILE *o;
  &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; fd;
  void *mem = NULL, *mmem = NULL;
  o = fopen(&lt;span class=&quot;code-quote&quot;&gt;&quot;test.dat&quot;&lt;/span&gt;, &lt;span class=&quot;code-quote&quot;&gt;&quot;w+&quot;&lt;/span&gt;);
  fd = fileno(o);
  &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; (i=0; i&amp;lt;1e6; i++) {
    size += 100000; &lt;span class=&quot;code-comment&quot;&gt;//Allocates up to 100GB &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; mmap()ed file
&lt;/span&gt;    memsize += 3000; &lt;span class=&quot;code-comment&quot;&gt;//Allocates up to 3GB &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; in-memory usage
&lt;/span&gt;    &lt;span class=&quot;code-comment&quot;&gt;//ftruncate(fd, size);  //&amp;lt;--- &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt; would be the correct usage
&lt;/span&gt;    mmem = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
    mem = realloc(mem, memsize);
    memset(mem, i%256, memsize);
    memset(mmem+size-100000, i%256, 100000);
    munmap(mmem, size);
  }
  &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; 0;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
</description>
                <environment>RHEL Server 6.4, kernel 2.6.32-279.9.1.el6.x86_64, 32GB ECC RAM, 16GB swap, infiniband</environment>
        <key id="17691">LU-2860</key>
            <summary>Mmap() causing OOM</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.whamcloud.com/images/icons/priorities/major.svg">Major</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="pbehroozi">Peter Behroozi</reporter>
                        <labels>
                    </labels>
                <created>Mon, 25 Feb 2013 16:09:23 +0000</created>
                <updated>Mon, 25 Feb 2013 20:51:54 +0000</updated>
                            <resolved>Mon, 25 Feb 2013 20:51:54 +0000</resolved>
                                    <version>Lustre 2.1.2</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="52976" author="pbehroozi" created="Mon, 25 Feb 2013 16:10:41 +0000"  >&lt;p&gt;Source code which will cause an OOM condition.&lt;/p&gt;</comment>
                            <comment id="52988" author="jay" created="Mon, 25 Feb 2013 20:51:39 +0000"  >&lt;p&gt;This program should fail with SIGBUS. The fault handling in 2.1.2 was wrong and please upgrade it to 2.1.4.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="12271" name="oom.txt" size="14417" author="pbehroozi" created="Mon, 25 Feb 2013 16:09:23 +0000"/>
                            <attachment id="12272" name="test_mmap.c" size="701" author="pbehroozi" created="Mon, 25 Feb 2013 16:10:41 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzvjrz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6926</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10021"><![CDATA[2]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>