<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:56:55 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>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[CONTROLLER-1983] Akka artery fails with java.lang.OutOfMemoryError: Direct buffer memory</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-1983</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;It is impossible to run cluster node on VM with less than 6GiB RAM.&lt;/p&gt;

&lt;p&gt;When there is less memory we get:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;2021-06-08T16:12:16,816 | ERROR | opendaylight-cluster-data-akka.actor.default-dispatcher-6 | ActorSystemImpl | 203 - org.opendaylight.controller.repackaged-akka - 4.0.0.SNAPSHOT | Uncaught error from thread [opendaylight-cluster-data-akka.remote.default-remote-dispatcher-7]: Direct buffer memory, shutting down JVM since &apos;akka.jvm-exit-on-fatal-error&apos; is enabled for ActorSystem[opendaylight-cluster-data]
 java.lang.OutOfMemoryError: Direct buffer memory
 at java.nio.Bits.reserveMemory(Bits.java:175) ~[?:?]
 at java.nio.DirectByteBuffer.&amp;lt;init&amp;gt;(DirectByteBuffer.java:118) ~[?:?]
 at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317) ~[?:?]
 at akka.remote.artery.EnvelopeBufferPool.acquire(EnvelopeBufferPool.scala:34) ~[bundleFile:?]
 at akka.remote.artery.Encoder$$anon$1.onPush(Codecs.scala:117) ~[bundleFile:?]
 at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541) ~[bundleFile:?]
 at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:495) ~[bundleFile:?]
 at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:390) ~[bundleFile:?]
 at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625) ~[bundleFile:?]
 at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:502) ~[bundleFile:?]
 at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600) ~[bundleFile:?]
 at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:773) ~[bundleFile:?]
 at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$shortCircuitBatch(ActorGraphInterpreter.scala:762) ~[bundleFile:?]
 at akka.stream.impl.fusing.ActorGraphInterpreter.preStart(ActorGraphInterpreter.scala:753) ~[bundleFile:?]
 at akka.actor.Actor.aroundPreStart(Actor.scala:548) ~[bundleFile:?]
 at akka.actor.Actor.aroundPreStart$(Actor.scala:548) ~[bundleFile:?]
 at akka.stream.impl.fusing.ActorGraphInterpreter.aroundPreStart(ActorGraphInterpreter.scala:691) ~[bundleFile:?]
 at akka.actor.ActorCell.create(ActorCell.scala:641) ~[bundleFile:?]
 at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:513) [bundleFile:?]
 at akka.actor.ActorCell.systemInvoke(ActorCell.scala:535) [bundleFile:?]
 at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:295) [bundleFile:?]
 at akka.dispatch.Mailbox.run(Mailbox.scala:230) [bundleFile:?]
 at akka.dispatch.Mailbox.exec(Mailbox.scala:243) [bundleFile:?]
 at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [?:?]
 at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) [?:?]
 at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) [?:?]
 at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) [?:?]
 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) [?:?]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="34105">CONTROLLER-1983</key>
            <summary>Akka artery fails with java.lang.OutOfMemoryError: Direct buffer memory</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.opendaylight.org/images/icons/priorities/critical.svg">High</priority>
                        <status id="5" iconUrl="https://jira.opendaylight.org/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="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="rovarga">Robert Varga</assignee>
                                    <reporter username="ivanhrasko">Ivan Hrasko</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Wed, 9 Jun 2021 10:23:38 +0000</created>
                <updated>Thu, 21 Apr 2022 14:42:14 +0000</updated>
                            <resolved>Thu, 13 Jan 2022 14:41:34 +0000</resolved>
                                    <version>4.0.0</version>
                                    <fixVersion>5.0.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="69301" author="ivanhrasko" created="Wed, 9 Jun 2021 10:26:39 +0000"  >&lt;p&gt;This problem has occurred after switching to Akka artery and is similar to: &lt;a href=&quot;https://jira.opendaylight.org/browse/CONTROLLER-1575&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.opendaylight.org/browse/CONTROLLER-1575&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="69318" author="ivanhrasko" created="Tue, 22 Jun 2021 14:36:15 +0000"  >&lt;p&gt;I have made a test where I am investigating the size of direct memory used and direct memory allocated.&lt;/p&gt;

&lt;p&gt;Test preparation:&lt;br/&gt;
 &lt;b&gt;1. run 3 ODL nodes on the VMs.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;VMs configuration: 2048MB RAM, 2 CPUs&lt;br/&gt;
 JAVA_OPTS=-XX:MaxDirectMemorySize=1024m&lt;/p&gt;

&lt;p&gt;Statistic at time of ODL deployment (after Karaf starts):&lt;br/&gt;
 Java Heap size: approx 66MB&lt;br/&gt;
 Metaspace size: approx. 62MB&lt;br/&gt;
 Direct buffer usage (non Heap): approx. 90MB&lt;/p&gt;

&lt;p&gt;This step is without problems.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;2. Install clustering features (odl-netconf-clustered-topology odl-restconf-nb-rfc8040 odl-restconf-nb-bierman02).&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;During this step OOM error appears and cluster is not operable.&lt;/p&gt;

&lt;p&gt;Statistics at time of the crash:&lt;br/&gt;
 Java Heap size: approx. 199MB&lt;br/&gt;
 Metaspace size: approx. 135MB&lt;br/&gt;
 Direct buffer usage (non Heap): approx. 175MB&#160;&lt;/p&gt;

&lt;p&gt;In debugger we can see (&lt;a href=&quot;https://github.com/openjdk/jdk/commit/24c70fcf8845b447362aa1da9e672ca896c181c3):&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/openjdk/jdk/commit/24c70fcf8845b447362aa1da9e672ca896c181c3&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;2021-06-22T16:20:44.274684+02:00[Europe/Bratislava] :Cannot reserve 419430400 bytes of direct buffer memory (allocated: 839028241, limit: 1073741824)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In jconsole we can see the non-heap usage is less than 200MB. See picture Screenshot_2021-06-22_16-22-46.png.&#160;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The result:&lt;/b&gt;&lt;br/&gt;
 The consumption of direct memory is much less than the amout of memory that application is trying to allocate&lt;br/&gt;
 (approx. 175MB really used compared to more than 1024MB trying to allocate).&lt;/p&gt;

&lt;p&gt;I think that the application in fact needs less memory than artery is trying to allocate and this is casused&lt;br/&gt;
 by wrong configuration of AKKA artery (&lt;a href=&quot;https://github.com/opendaylight/controller/commit/229c55fbdc5907129c9c35b3e98963b5fa2528f0#diff-5a2d9e6a9a1f74a3fa92b683a519f987d8a6d5d200846028eeb98a5c56e5c2beR109&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/controller/commit/229c55fbdc5907129c9c35b3e98963b5fa2528f0#diff-5a2d9e6a9a1f74a3fa92b683a519f987d8a6d5d200846028eeb98a5c56e5c2beR109&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The frame size is set too much high.&lt;/p&gt;

&lt;p&gt;Akka is trying to allocate the full size of the buffer - 400 MB regardless of the actual needs.&lt;/p&gt;

&lt;p&gt;We should use lower frame size for most common traffic and large frame size for actors with traffic with very large data.&lt;/p&gt;</comment>
                            <comment id="69319" author="ivanhrasko" created="Wed, 23 Jun 2021 07:44:22 +0000"  >&lt;p&gt;IMO: We should decrease maximum-frame-size and use maximum-large-frame-size.&lt;br/&gt;
 The another possibility is to decrease the number of buffers because now our direct&lt;br/&gt;
 memory demand is 128 * 400MB.&lt;br/&gt;
 See: &lt;a href=&quot;https://github.com/akka/akka/issues/22133&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/akka/akka/issues/22133&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When increasing maximum-large-frame-size we have to be aware of:&lt;br/&gt;
 &lt;a href=&quot;https://github.com/akka/akka/issues/22257&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/akka/akka/issues/22257&lt;/a&gt;.&lt;br/&gt;
 We have to increase aeron.term.buffer.length (by default 16MB) and set large-message-destinations.&lt;br/&gt;
 See: &lt;a href=&quot;https://github.com/real-logic/Aeron/wiki/Configuration-Options&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/real-logic/Aeron/wiki/Configuration-Options&lt;/a&gt;&lt;br/&gt;
 and &lt;a href=&quot;https://stackoverflow.com/questions/32243664/what-is-the-largest-message-aeron-can-process&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/32243664/what-is-the-largest-message-aeron-can-process&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See also: &lt;a href=&quot;https://doc.akka.io/docs/akka/current/general/configuration-reference.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://doc.akka.io/docs/akka/current/general/configuration-reference.html&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="69320" author="ivanhrasko" created="Wed, 23 Jun 2021 07:45:00 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.opendaylight.org/secure/ViewProfile.jspa?name=rovarga&quot; class=&quot;user-hover&quot; rel=&quot;rovarga&quot;&gt;rovarga&lt;/a&gt; Do we know destinations (actors) that require to use large frames?&#160;&lt;/p&gt;</comment>
                            <comment id="69321" author="ivanhrasko" created="Wed, 23 Jun 2021 07:45:18 +0000"  >&lt;p&gt;Maybe the best would be to use streams: &lt;a href=&quot;https://doc.akka.io/docs/akka/2.6.15/stream/stream-io.html?language=java&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://doc.akka.io/docs/akka/2.6.15/stream/stream-io.html?language=java&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="69401" author="rovarga" created="Mon, 12 Jul 2021 12:31:44 +0000"  >&lt;p&gt;Hmm, so these can be any of the AbstractRaftActor subclasses, as well as DataTreeChange actors. Probably others &#8211; essentially any actor which sends or receives any message containing a NormalizedNode.&lt;/p&gt;</comment>
                            <comment id="69402" author="rovarga" created="Mon, 12 Jul 2021 12:43:30 +0000"  >&lt;p&gt;Actually what we&apos;d like to leverage &lt;a href=&quot;https://doc.akka.io/docs/akka/current/typed/reliable-delivery.html#chunk-large-messages&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://doc.akka.io/docs/akka/current/typed/reliable-delivery.html#chunk-large-messages&lt;/a&gt; &#8211; but that requires switching to Akka Typed, which is a rather large undertaking.&lt;/p&gt;

&lt;p&gt;Another option is that we ditch akka persistence (which seems very likely, as it is a very bad fit). Based on what that&apos;s going to do to messaging patterns and replication capabilities, we may end up with something completely different &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.opendaylight.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="69403" author="rovarga" created="Mon, 12 Jul 2021 15:59:03 +0000"  >&lt;p&gt;And yet another option (for a FE/BE) is switching to tell-based protocol, but that requires addressing &lt;a href=&quot;https://jira.opendaylight.org/browse/CONTROLLER-1991&quot; title=&quot;Tell-based protocol can leak transaction IDs on the backend&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CONTROLLER-1991&quot;&gt;&lt;del&gt;CONTROLLER-1896&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="69415" author="rovarga" created="Tue, 13 Jul 2021 20:48:18 +0000"  >&lt;p&gt;So the problem here is actually &lt;a href=&quot;https://doc.akka.io/docs/akka/current/serialization.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://doc.akka.io/docs/akka/current/serialization.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That API requires us to serialize every message into a byte[], and I think Akka will not fragment that byte[] into Aeron, i.e. it will always send it verbatim.&lt;/p&gt;

&lt;p&gt;So here is where we really would like to interface Aeron directly with a Shard&apos;s journal &#8211; this makes utter sense, as we have immutable DTOs on input (NormalizedNode and such) and can serialize into any DataOutput, I think. We therefore can transparently fragment each message as we are serializing it &#8211; and it is just a matter having the proper integration surface.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.opendaylight.org/secure/ViewProfile.jspa?name=tcere&quot; class=&quot;user-hover&quot; rel=&quot;tcere&quot;&gt;tcere&lt;/a&gt; this is the Aeron part we talked about today. We actually have the tools needed to do automatic fragmentation (&lt;a href=&quot;https://github.com/opendaylight/controller/blob/master/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/io/ChunkedOutputStream.java#L62)&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/opendaylight/controller/blob/master/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/io/ChunkedOutputStream.java#L62)&lt;/a&gt; and obviously defrag as well&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10300">
                    <name>Issue split</name>
                                            <outwardlinks description="split to">
                                        <issuelink>
            <issuekey id="34210">CONTROLLER-1987</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="31708">CONTROLLER-1991</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="35601">CONTROLLER-2040</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="16301" name="Screenshot_2021-06-22_16-22-46.png" size="94159" author="ivanhrasko" created="Tue, 22 Jun 2021 14:32:19 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i03ybr:</customfieldvalue>

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