<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:32:09 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>[OPNFLWPLUG-318] ConnectionConductorImpl and HandshakeManagerImpl leak threads on exception paths</title>
                <link>https://jira.opendaylight.org/browse/OPNFLWPLUG-318</link>
                <project id="10155" key="OPNFLWPLUG">OpenFlowPlugin</project>
                    <description>&lt;p&gt;I&apos;m running ODL on the latest stable/helium branches.&lt;/p&gt;

&lt;p&gt;I have a single controller and a single switch.  The OpenFlow connection between the switch and the controller is OF13.  The connection between the switch and controller has been bouncing frequently.&lt;/p&gt;

&lt;p&gt;This AM, I found my switch with 571 OFHandshake threads.  571 threads for a SINGLE connection.&lt;/p&gt;

&lt;p&gt;I checked by switch and controller.  There was one connection between the two, but 571 threads all in a waiting state&lt;/p&gt;

&lt;p&gt;Upon code inspection, I believe I&apos;ve found code paths where ConnectionConductorImpl will leak instances of ThreadPoolLoggingExecutor.  Here&apos;s what I believe is happening:&lt;/p&gt;


&lt;p&gt;1-  The switch initiates an OF connection to the controller&lt;br/&gt;
    This causes the following calls&lt;br/&gt;
     initChannel method of TcpChannelInitializer&lt;br/&gt;
      onSwitchConnected method of org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionHandlerImpl&lt;br/&gt;
        ConnectionConductorFactory.createConductor(...)&lt;br/&gt;
          ConnectionConductor connectionConductor = new ConnectionConductorImpl(connectionAdapter);&lt;br/&gt;
             This CTOR registers itself as the HandshakeListener&lt;br/&gt;
          ...&lt;br/&gt;
          connectionConductor.init();&lt;br/&gt;
             This call creates an instance of ThreadPoolLoggingExecutor to be created&lt;/p&gt;

&lt;p&gt;   If there is an Exception in initChannel, the catch blocks close the channel, but the do not call any methods that will cause the ThreadPoolLoggingExecutor to shutdown&lt;/p&gt;

&lt;p&gt;2-  The newly create thread from ThreadPoolLoggingExecutor calls the shake() method of ConnectionConductorImpl&lt;br/&gt;
    In the ConnectionConductorImpl, the calls to&lt;br/&gt;
        hsPool.shutdown();&lt;br/&gt;
        hsPool.purge();&lt;br/&gt;
    only happen when postHandshakeBasic is called&lt;br/&gt;
       postHandshakeBasic is called by onHandshakeSuccessfull&lt;/p&gt;

&lt;p&gt;   HOWEVER in HandshakeManager.shake() there are code paths where the &apos;onHandshakeSuccessfull&apos; method is never called (the catch block around line 116 of HandshakeManager.  The exception path DOES close the connection, but never shuts down the ThreadPoolLoggingExecutor&lt;/p&gt;

&lt;p&gt;PROPOSAL:&lt;/p&gt;

&lt;p&gt;I believe the HandshakeListener needs a second method:&lt;br/&gt;
    onHandshakeFailure()&lt;br/&gt;
The implementors of this interface can then clean up any resources they&apos;ve allocated.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="27586">OPNFLWPLUG-318</key>
            <summary>ConnectionConductorImpl and HandshakeManagerImpl leak threads on exception paths</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="mbobak@cisco.com">Martin Bobak</assignee>
                                    <reporter username="jimw@a-bb.net">Jim West</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 Nov 2014 16:10:26 +0000</created>
                <updated>Mon, 27 Sep 2021 09:01:22 +0000</updated>
                            <resolved>Wed, 14 Jan 2015 09:20:12 +0000</resolved>
                                                                    <component>General</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="56309" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:33:25 +0000"  >&lt;p&gt;Proposed change:  Add Method to openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeListener.java&lt;/p&gt;

&lt;p&gt;to allow implementers to know when a OF handshake has failed.&lt;/p&gt;</comment>
                            <comment id="56316" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:33:25 +0000"  >&lt;p&gt;Attachment HandshakeListener.java.patch has been added with description: Proposed change:  Add Method to openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeListener.java&lt;/p&gt;</comment>
                            <comment id="56310" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:35:09 +0000"  >&lt;p&gt;When an OF handshake exchange fails because of some exception, tell the handshake listener that it should clean up any resources (threads)&lt;/p&gt;</comment>
                            <comment id="56317" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:35:09 +0000"  >&lt;p&gt;Attachment HandshakeManagerImpl.java.patch has been added with description: Proposed change openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImpl.java&lt;/p&gt;</comment>
                            <comment id="56311" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:36:22 +0000"  >&lt;p&gt;Add a method to shutdown the hsPool on handshake failures.&lt;/p&gt;</comment>
                            <comment id="56318" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:36:22 +0000"  >&lt;p&gt;Attachment ConnectionConductorImpl.java.patch has been added with description: proposed change: openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImpl.java&lt;/p&gt;</comment>
                            <comment id="56312" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:42:47 +0000"  >&lt;p&gt;I&apos;ve created a patch and I&apos;m testing this on my systems.&lt;/p&gt;</comment>
                            <comment id="56313" author="mbobak@cisco.com" created="Thu, 18 Dec 2014 15:44:58 +0000"  >&lt;p&gt;&lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/13739/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/13739/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="56314" author="vishnoianil@gmail.com" created="Tue, 6 Jan 2015 06:04:46 +0000"  >&lt;p&gt;Hi Jim,&lt;/p&gt;

&lt;p&gt;Did you get a chance to test the patch martin pushed?&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
Anil&lt;/p&gt;</comment>
                            <comment id="56315" author="jimw@a-bb.net" created="Wed, 7 Jan 2015 14:30:19 +0000"  >&lt;p&gt;I integrated Martin&apos;s patch with the patch that I had created.  This merged patch appears to be working fine on my test system.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="13931" name="ConnectionConductorImpl.java.patch" size="1523" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:36:22 +0000"/>
                            <attachment id="13929" name="HandshakeListener.java.patch" size="862" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:33:25 +0000"/>
                            <attachment id="13930" name="HandshakeManagerImpl.java.patch" size="1881" author="jimw@a-bb.net" created="Fri, 14 Nov 2014 19:35:09 +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_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2394</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=2394]]></customfieldvalue>

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

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