<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:54:38 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-1077] Clustering: Race condition may cause missing routes in RPC BucketStore</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-1077</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;The workflow by which the RpcRegistry adds route identifiers into the BucketStore is as follows:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The RpcRegistry sends the GetLocalBucket message to the BucketStore and waits on the Future.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;BucketStore returns GetLocalBucketReply containing its internal local Bucket instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;On Future complete, the RpcRegistry extracts the Bucket instance from the GetLocalBucketReply.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;RpcRegistry calls getData on the Bucket instance to obtain the RoutingTable. getData returns a copy of its internal RoutingTable.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;RpcRegistry adds the new RouteIdentifiers into its local RoutingTable copy.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;RpcRegistry calls setData on the Bucket with the new RoutingTable instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;RpcRegistry sends an UpdateBucket message with the Bucket instance.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The BucketStore extracts the Bucket instance from the UpdateBucket message and sets its localBucket member.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;The problem is that the BucketStore exposes its internal localBucket, thus allowing it to be modified externally. The manner in which the RpcRegistry modifies the Bucket instance is not thread safe and introcudes a race condition. This can result in missing RouteIdentifiers as in the following scenario:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;A GetLocalBucket Future callback is notified on Thread 1.&lt;/li&gt;
	&lt;li&gt;At the same time, another GetLocalBucket Future callback is notified on Thread 2.&lt;/li&gt;
	&lt;li&gt;Both threads call getData on the returned Bucket instance and get a local copy.&lt;/li&gt;
	&lt;li&gt;Both add their new routes into their local RoutingTable.&lt;/li&gt;
	&lt;li&gt;Thread 1 calls setData on the Bucket instance.&lt;/li&gt;
	&lt;li&gt;Thread 2 calls setData on the Bucket instance.&lt;/li&gt;
	&lt;li&gt;Since they both had their own local RoutingTable this results in Thread 2 overwriting the instance set by Thread 1 and thus Thread 1&apos;s routes are lost.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In addition, neither the &apos;data&apos; member nor &quot;version&quot; member in Bucket are volatile so the writes may not be visible to other threads. Also setData should atomically set &apos;data&apos; and &apos;version&apos; for consistency.&lt;/p&gt;

&lt;p&gt;Propose solution:&lt;/p&gt;

&lt;p&gt;The BucketStore should not expose its internal state and allow it to be mutated externally. We should remove the GetLocalBucket message. Instead of getting the current routing table, modifying a local copy, then writing it back, which is problematic, we should just send an AddToLocalBucket message to the BucketStore and have it update its local Bucket. Similar with remove.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="25631">CONTROLLER-1077</key>
            <summary>Clustering: Race condition may cause missing routes in RPC BucketStore</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                                <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="tpantelis">Tom Pantelis</assignee>
                                    <reporter username="tpantelis">Tom Pantelis</reporter>
                        <labels>
                    </labels>
                <created>Fri, 19 Dec 2014 03:25:55 +0000</created>
                <updated>Fri, 9 Jan 2015 23:12:41 +0000</updated>
                            <resolved>Fri, 9 Jan 2015 23:12:41 +0000</resolved>
                                    <version>Helium</version>
                                                    <component>mdsal</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="49979" author="tpantelis" created="Fri, 19 Dec 2014 03:28:51 +0000"  >&lt;p&gt;I created a unit test that illustrates the bug. It sends N AddOrUpdateRoutes messages and then verifies the routes IDs are all in the BucketStore. The test fails sporadically with a varying # missing &#8211; of course, the higher N, the more often it fails. I even saw it fail once with only 2 (it got 1 out of 2).&lt;/p&gt;</comment>
                            <comment id="49980" author="tpantelis" created="Fri, 19 Dec 2014 14:26:41 +0000"  >&lt;p&gt;Submitted &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/13753/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/13753/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="49981" author="tpantelis" created="Tue, 6 Jan 2015 16:00:02 +0000"  >&lt;p&gt;Manually cherry picked to stable/helium: &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/13938/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/13938/&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </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_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2526</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=2526]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10206" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Issue Type</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10300"><![CDATA[Bug]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10360"><![CDATA[Helium-2]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10202" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Priority</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10312"><![CDATA[High]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02ocf:</customfieldvalue>

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