<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:53:29 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-625] Potential issues with OptimisticLockFailedException</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-625</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;An OptimisticLockFailedException can be thrown if changes conflict with another concurrent transaction or when putting a node whose parents don&apos;t exist yet. For the former case, for the transaction that failed, the client can retry with high probability that it will succeed. For the latter case, the same retry will not succeed.&lt;/p&gt;

&lt;p&gt;We should ensure, as much as possible, that an OptimisticLockFailedException is  thrown for a transient condition where a retry can be attempted and has a possibility of succeeding. It seems this isn&apos;t the case, as evidenced by this trace from the controller-dev mailing list on Jul 8th (titled &quot;Lots of error trying to run ODL at the moment...&quot;): &lt;/p&gt;

&lt;p&gt;2014-07-08 14:46:36.990 PDT &lt;span class=&quot;error&quot;&gt;&amp;#91;pool-8-thread-1&amp;#93;&lt;/span&gt; WARN  o.o.c.m.s.d.b.i.DOMDataCommitCoordinatorImpl - Tx: DOM-13 Error during phase CAN_COMMIT, starting Abort&lt;br/&gt;
org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException: Optimistic lock failed.&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore$ThreePhaseCommitImpl$1.call(InMemoryDOMDataStore.java:321) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore$ThreePhaseCommitImpl$1.call(InMemoryDOMDataStore.java:311) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) &lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.7.0_55&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:293) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:61) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore$ThreePhaseCommitImpl.canCommit(InMemoryDOMDataStore.java:311) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitCoordinatorImpl$CommitCoordinationTask.canCommitAll(DOMDataCommitCoordinatorImpl.java:345) &lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitCoordinatorImpl$CommitCoordinationTask.canCommitBlocking(DOMDataCommitCoordinatorImpl.java:187) &lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitCoordinatorImpl$CommitCoordinationTask.call(DOMDataCommitCoordinatorImpl.java:164) &lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.controller.md.sal.dom.broker.impl.DOMDataCommitCoordinatorImpl$CommitCoordinationTask.call(DOMDataCommitCoordinatorImpl.java:144) &lt;span class=&quot;error&quot;&gt;&amp;#91;bundlefile:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) &lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.7.0_55&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) &lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.7.0_55&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) &lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.7.0_55&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at java.lang.Thread.run(Thread.java:744) &lt;span class=&quot;error&quot;&gt;&amp;#91;na:1.7.0_55&amp;#93;&lt;/span&gt;&lt;br/&gt;
Caused by: org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException: Node was deleted by other transaction.&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaAwareApplyOperation.checkConflicting(SchemaAwareApplyOperation.java:80) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;na:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.tree.NormalizedNodeContainerModificationStrategy.checkSubtreeModificationApplicable(NormalizedNodeContainerModificationStrategy.java:167) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;na:na&amp;#93;&lt;/span&gt;&lt;br/&gt;
	at org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaAwareApplyOperation.checkApplicable(SchemaAwareApplyOperation.java:131) ~&lt;span class=&quot;error&quot;&gt;&amp;#91;na:na&amp;#93;&lt;/span&gt;&lt;/p&gt;


&lt;p&gt;The underlying ex indicates &quot;Node was deleted by other transaction&quot; which seems to indicate that further retries wouldn&apos;t succeed.&lt;/p&gt;

&lt;p&gt;If it&apos;s a case where a retry of the same changes definitely would not succeed, another type of TransactionCommitFailedException should be thrown to prevent callers from retrying. &lt;/p&gt;

&lt;p&gt;Also, the javadocs for commit state that for an OptimisticLockFailedException, &quot;it is the responsibility of the caller to create a new transaction and submit the same modification again in order to update data tree.&quot;. It is likely that clients will simply call into the same method recursively to retry. We should add to the docs a warning about limiting the number of retries so it doesn&apos;t loop for ever if it&apos;s a case where a retry will never succeed. Clients should probably stop after 2 tries. Adding an example would also help, eg:&lt;/p&gt;

&lt;p&gt;   private void doWrite( final int tries ) {&lt;br/&gt;
        WriteTransaction writeTx = dataBroker.newWriteTransaction();&lt;/p&gt;

&lt;p&gt;        DataObject data = ...&lt;br/&gt;
        writeTx.put(LogicalDatastoreType.OPERATIONAL, PATH, data);&lt;/p&gt;

&lt;p&gt;        Futures.addCallback(writeTx.commit(), &lt;br/&gt;
            new FutureCallback&amp;lt;RpcResult&amp;lt;TransactionStatus&amp;gt;&amp;gt;() {&lt;br/&gt;
              @Override&lt;br/&gt;
              public void onSuccess(RpcResult&amp;lt;TransactionStatus&amp;gt; result) {&lt;br/&gt;
              }&lt;/p&gt;

&lt;p&gt;              @Override&lt;br/&gt;
              public void onFailure(Throwable t) {&lt;br/&gt;
                  if(t instanceof OptimisticLockFailedException) {&lt;br/&gt;
                      if( --tries &amp;gt; 0 ) &lt;/p&gt;
{
                          // do retry
                          doWrite( tries );
                      }
&lt;p&gt; else &lt;/p&gt;
{
                          // out of retries
                      }
&lt;p&gt;                   }&lt;/p&gt;

&lt;p&gt;              }&lt;br/&gt;
        });&lt;/p&gt;

&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    ...&lt;br/&gt;
    doWrite( 2 );&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="25179">CONTROLLER-625</key>
            <summary>Potential issues with OptimisticLockFailedException</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="tony.tkacik@gmail.com">Tony Tkacik</assignee>
                                    <reporter username="tpantelis">Tom Pantelis</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Jul 2014 18:27:46 +0000</created>
                <updated>Thu, 24 Jul 2014 09:16:40 +0000</updated>
                            <resolved>Thu, 24 Jul 2014 09:16:40 +0000</resolved>
                                    <version>Helium</version>
                                                    <component>mdsal</component>
                        <due>Mon, 21 Jul 2014 00:00:00 +0000</due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="48703" author="tpantelis" created="Tue, 15 Jul 2014 00:15:36 +0000"  >&lt;p&gt;I added the javadoc changes and example with &lt;a href=&quot;https://jira.opendaylight.org/browse/CONTROLLER-624&quot; title=&quot;Usability enhancement to WriteTransaction commit method&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CONTROLLER-624&quot;&gt;&lt;del&gt;CONTROLLER-624&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="48704" author="tony.tkacik@gmail.com" created="Wed, 16 Jul 2014 11:57:13 +0000"  >&lt;p&gt;remote:   &lt;a href=&quot;https://git.opendaylight.org/gerrit/9058&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/9058&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>1363</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=1363]]></customfieldvalue>

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

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

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