<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:16:12 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>[NETCONF-905] NetconfSessionPromise reconnection failure</title>
                <link>https://jira.opendaylight.org/browse/NETCONF-905</link>
                <project id="10142" key="NETCONF">netconf</project>
                    <description>&lt;p&gt;The fix for &lt;a href=&quot;https://jira.opendaylight.org/browse/NETCONF-827&quot; title=&quot;Mount loop when setting too low connection-timeout&quot; class=&quot;issue-link&quot; data-issue-key=&quot;NETCONF-827&quot;&gt;&lt;del&gt;NETCONF-827&lt;/del&gt;&lt;/a&gt; addressed the race between channel message dispatch &amp;amp; timeout. However, NETCONF session negotiation can still fail putting NetconfSessionPromise in the failed state. Once this happens following reconnection attempts initiated by ReconnectStrategy all fail because of the failed state.&lt;/p&gt;

&lt;p&gt;For example, the following log shows a case where session negotiation fails because NETCONF channel has been closed before hello message is sent:&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;2022-10-13T21:47:49,161 | INFO  | globalWorkerGroup-3-2 | AbstractNetconfSessionNegotiator | 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | Failed to send message &amp;lt;hello xmlns=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&amp;gt;
    &amp;lt;capabilities&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:capability:exi:1.0&amp;lt;/capability&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.1&amp;lt;/capability&amp;gt;
        &amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.0&amp;lt;/capability&amp;gt;
    &amp;lt;/capabilities&amp;gt;
&amp;lt;/hello&amp;gt;
 on channel [id: 0x738232cc]
java.lang.IllegalStateException: Channel closed
	at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandlerWriter.write(AsyncSshHandlerWriter.java:59) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler.write(AsyncSshHandler.java:186) ~[bundleFile:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[bundleFile:4.1.76.Final]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.sendMessage(AbstractNetconfSessionNegotiator.java:340) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.start(AbstractNetconfSessionNegotiator.java:150) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.startNegotiation(AbstractNetconfSessionNegotiator.java:131) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.channelActive(AbstractNetconfSessionNegotiator.java:355) ~[bundleFile:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:230) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.access$200(AbstractChannelHandlerContext.java:61) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext$3.run(AbstractChannelHandlerContext.java:221) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[bundleFile:4.1.76.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[bundleFile:4.1.76.Final]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Once this event happens, NETCONF session cannot be established because the promise cannot be set to &apos;SUCCESS&apos; even if all the negotiation has been completed successfully:&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;2022-10-13T21:48:43,976 | WARN  | globalWorkerGroup-3-2 | AbstractNetconfSessionNegotiator | 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | An exception occurred during negotiation with null on channel [id: 0x738232cc]
java.lang.IllegalStateException: complete already: NetconfSessionPromise@37c85c76(failure: java.lang.IllegalStateException: Channel closed)
	at io.netty.util.concurrent.DefaultPromise.setFailure(DefaultPromise.java:112) ~[bundleFile:4.1.76.Final]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.negotiationFailed(AbstractNetconfSessionNegotiator.java:330) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.channelRead(AbstractNetconfSessionNegotiator.java:370) ~[bundleFile:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:61) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:370) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[bundleFile:4.1.76.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[bundleFile:4.1.76.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[bundleFile:4.1.76.Final]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalStateException: complete already: NetconfSessionPromise@37c85c76(failure: java.lang.IllegalStateException: Channel closed)
	at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:99) ~[bundleFile:4.1.76.Final]
	at org.opendaylight.netconf.nettyutil.NetconfSessionPromise.setSuccess(NetconfSessionPromise.java:88) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.NetconfSessionPromise.setSuccess(NetconfSessionPromise.java:26) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.negotiationSuccessful(AbstractNetconfSessionNegotiator.java:324) ~[bundleFile:?]
	at org.opendaylight.netconf.client.NetconfClientSessionNegotiator.handleMessage(NetconfClientSessionNegotiator.java:88) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.channelRead(AbstractNetconfSessionNegotiator.java:367) ~[bundleFile:?]
	... 20 more
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="36234">NETCONF-905</key>
            <summary>NetconfSessionPromise reconnection failure</summary>
                <type id="10104" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.opendaylight.org/images/icons/priorities/major.svg">Medium</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="sangwookha">Sangwook Ha</reporter>
                        <labels>
                    </labels>
                <created>Thu, 13 Oct 2022 22:18:51 +0000</created>
                <updated>Mon, 31 Oct 2022 07:40:57 +0000</updated>
                            <resolved>Thu, 20 Oct 2022 09:43:24 +0000</resolved>
                                    <version>3.0.6</version>
                    <version>4.0.2</version>
                                    <fixVersion>3.0.7</fixVersion>
                    <fixVersion>4.0.3</fixVersion>
                    <fixVersion>2.0.17</fixVersion>
                                    <component>netconf</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="71549" author="JIRAUSER13318" created="Fri, 14 Oct 2022 06:42:10 +0000"  >&lt;p&gt;So something like this would work: &lt;a href=&quot;https://git.opendaylight.org/gerrit/c/netconf/+/102590&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/c/netconf/+/102590&lt;/a&gt;&lt;br/&gt;
But I&apos;m not sure why session negotiation failure due to timeout requires a special treatment where promise is not failed, so negotiation is retried with the same promise. It seems to be just one of the failure scenarios - since timer does not start until channel becomes active, it does not cover pure reachability issue different from other exceptions.&lt;/p&gt;</comment>
                            <comment id="71550" author="rovarga" created="Fri, 14 Oct 2022 12:39:45 +0000"  >&lt;p&gt;Yeah, but that patch seems to have other issues. Gawking at the stack trace, it seems a tad strange: the channel was closed before channelActive() was invoked?!&lt;/p&gt;

&lt;p&gt;Can you post logs with AsyncSshHandler at debug, please?&lt;/p&gt;

&lt;p&gt;I wonder whether AsyncSshHandler.handleSshChanelOpened() is executing outside the event loop and we end up somehow circling to AsyncSshHandler.safelyDisconnect() before channelActive() is processed...&lt;/p&gt;</comment>
                            <comment id="71551" author="JIRAUSER13318" created="Fri, 14 Oct 2022 22:23:20 +0000"  >&lt;p&gt;Post karaf log at the DEBUG level. The error was triggered when device configuration was reapplied a few times forcing controller to establish new NETCONF connections while interrupting the negotiation process at breakpoints set in AbstractNetconfSessionNegotiator (channelActive, channelRead).&lt;/p&gt;</comment>
                            <comment id="71552" author="JIRAUSER13318" created="Fri, 14 Oct 2022 22:41:10 +0000"  >&lt;p&gt;Looks like the device initiated disconnection probably because of the long idle time before it receives hello back:&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;2022-10-14T21:20:14,016 | DEBUG | globalWorkerGroup-3-5 | AbstractNetconfSessionNegotiator | 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | Starting session negotiation on channel [id: 0x1d4d427c]
2022-10-14T21:20:40,839 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | NettyAwareChannelSubsystem       | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | handleEof(NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]) SSH_MSG_CHANNEL_EOF
2022-10-14T21:20:40,840 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | NettyAwareChannelSubsystem       | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | handleClose(NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]) SSH_MSG_CHANNEL_CLOSE
2022-10-14T21:20:40,840 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | NettyAwareChannelSubsystem       | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | handleClose(NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]) prevent sending EOF
2022-10-14T21:20:40,840 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | NettyAwareChannelSubsystem       | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close(NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]) Closing gracefully
2022-10-14T21:20:40,841 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | Window                           | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | Closing Window[client/local](NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf])
2022-10-14T21:20:40,841 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | Window                           | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | Closing Window[client/remote](NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf])
2022-10-14T21:20:40,842 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | ChannelSession$1                 | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close([NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]] cmd=SSH_MSG_CHANNEL_DATA) Closing gracefully
2022-10-14T21:20:40,842 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | NettyAwareChannelSubsystem       | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | sendEof(NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]) already sent (state=Graceful)
2022-10-14T21:20:40,842 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | ChannelSession$1                 | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close([NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]] cmd=SSH_MSG_CHANNEL_DATA][Graceful] - operationComplete() closed
2022-10-14T21:20:40,842 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | ChannelAsyncInputStream          | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close(ChannelAsyncInputStream[NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]]) Closing gracefully
2022-10-14T21:20:44,837 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | ChannelAsyncInputStream          | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close(ChannelAsyncInputStream[NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]]][Graceful] - operationComplete() closed
2022-10-14T21:20:44,838 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | ChannelAsyncInputStream          | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close(ChannelAsyncInputStream[NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]]) Closing gracefully
2022-10-14T21:20:44,838 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | ChannelAsyncInputStream          | 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | close(ChannelAsyncInputStream[NettyAwareChannelSubsystem[id=0, recipient=43]-NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]]][Graceful] - operationComplete() closed
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="71553" author="rovarga" created="Mon, 17 Oct 2022 09:11:55 +0000"  >&lt;p&gt;Okay so we have some inter-thread handover:&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;2022-10-14T21:19:38,167 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-2 | AsyncSshHandler &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | SSH session authenticated on channel: [id: 0x1d4d427c], server version: SSH-2.0-libssh_0.9.5
[...]
2022-10-14T21:20:14,013 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-5 | NettyAwareChannelSubsystem &#160;&#160;&#160;&#160;&#160;&#160;| 265 - org.opendaylight.netconf.shaded-sshd - 4.0.3.SNAPSHOT | handleData(NettyAwareChannelSubsystem[id=0, recipient=43]- NetconfClientSessionImpl[netconf@/10.100.18.43:830][netconf]) SSH_MSG_CHANNEL_DATA len=6
2022-10-14T21:20:14,016 | DEBUG | globalWorkerGroup-3-5 | AbstractNetconfSessionNegotiator | 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | Starting session negotiation on channel [id: 0x1d4d427c] &lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and then:&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;2022-10-14T21:20:46,512 | DEBUG | sshd-NetconfSshClient[a8b2d7e]-nio2-thread-6 | AsyncSshHandler &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;| 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | SSH session closed on channel: [id: 0x1d4d427c]
[...]
2022-10-14T21:20:51,595 | DEBUG | globalWorkerGroup-3-5 | AbstractNetconfSessionNegotiator | 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | Session negotiation started with hello message &amp;lt;hello xmlns=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&amp;gt;
 &#160;&#160;&#160;&amp;lt;capabilities&amp;gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&amp;lt;capability&amp;gt;urn:ietf:params:netconf:capability:exi:1.0&amp;lt;/capability&amp;gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.1&amp;lt;/capability&amp;gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.0&amp;lt;/capability&amp;gt;
 &#160;&#160;&#160;&amp;lt;/capabilities&amp;gt;
&amp;lt;/hello&amp;gt;
 on channel [id: 0x1d4d427c]
[...]
2022-10-14T21:21:10,178 | INFO &#160;| globalWorkerGroup-3-5 | AbstractNetconfSessionNegotiator | 258 - org.opendaylight.netconf.netty-util - 4.0.3.SNAPSHOT | Failed to send message &amp;lt;hello xmlns=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot;&amp;gt;
 &#160;&#160;&#160;&amp;lt;capabilities&amp;gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&amp;lt;capability&amp;gt;urn:ietf:params:netconf:capability:exi:1.0&amp;lt;/capability&amp;gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.1&amp;lt;/capability&amp;gt;
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&amp;lt;capability&amp;gt;urn:ietf:params:netconf:base:1.0&amp;lt;/capability&amp;gt;
 &#160;&#160;&#160;&amp;lt;/capabilities&amp;gt;
&amp;lt;/hello&amp;gt;
 on channel [id: 0x1d4d427c]
java.lang.IllegalStateException: Channel closed
 &#160;&#160;&#160;&#160;&#160;&#160;&#160;at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandlerWriter.write(AsyncSshHandlerWriter.java:59) ~[bundleFile:?]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;note how we have things executing on sshd-nio2 threads and on globalWorkerGroup threads.&lt;/p&gt;

&lt;p&gt;Also, there is a 30 second delay in negotiation start &#8211; but note also that &quot;Session negotiation started&quot; is triggered after the channel is closed &#8211; pointing towards a problem in state checking. I think we need to handle the case where channelActive is triggered and there is also a channelInactive is staged in the executor,&lt;/p&gt;</comment>
                            <comment id="71554" author="rovarga" created="Mon, 17 Oct 2022 10:22:46 +0000"  >&lt;p&gt;The interesting thing is the delay of &lt;font color=&quot;#000000&quot;&gt;37,579 &lt;/font&gt;seconds between &quot;starting&quot; and &quot;started&quot; messages on the global worker thread. It is during this delay that the session goes down. This seems to indicate that AbstractNetconfSessionNegotiator.start() needs to check whether the channel is still open before embarking on sending the message.&lt;/p&gt;

&lt;p&gt;We also need to figure out how AsyncSshHandler.safelyDisconnect() -&amp;gt; AsyncSshHandlerWriter.close() -&amp;gt; channel.close() is synchronized w.r.t. the the negotiator.&lt;/p&gt;</comment>
                            <comment id="71557" author="rovarga" created="Tue, 18 Oct 2022 13:10:45 +0000"  >&lt;p&gt;Rather than mucking around with lifecycle and trying to synchronize things, the fix is to run the two methods interacting with channel lifecycle on the corresponding executor &#8211; thus providing natural sequencing.&lt;/p&gt;</comment>
                            <comment id="71558" author="JIRAUSER13318" created="Tue, 18 Oct 2022 18:38:11 +0000"  >&lt;p&gt;karaf-netconf-905.log: karaf log for&#160;&lt;a href=&quot;https://git.opendaylight.org/gerrit/c/netconf/+/102740/5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/c/netconf/+/102740/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="71559" author="rovarga" created="Tue, 18 Oct 2022 19:50:54 +0000"  >&lt;p&gt;So here we are catching this transition:&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;java.lang.IllegalStateException: Channel closed
	at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandlerWriter.write(AsyncSshHandlerWriter.java:59) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler.write(AsyncSshHandler.java:186) ~[bundleFile:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[bundleFile:4.1.76.Final]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[bundleFile:4.1.76.Final]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[bundleFile:4.1.76.Final]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.sendMessage(AbstractNetconfSessionNegotiator.java:340) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.start(AbstractNetconfSessionNegotiator.java:150) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.startNegotiation(AbstractNetconfSessionNegotiator.java:131) ~[bundleFile:?]
	at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.channelActive(AbstractNetconfSessionNegotiator.java:355) ~[bundleFile:?]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and also this:&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;java.io.EOFException: Channel is being closed    at org.opendaylight.netconf.shaded.sshd.common.channel.AbstractChannel$2.&amp;lt;init&amp;gt;(AbstractChannel.java:782) ~[bundleFile:?]
    at org.opendaylight.netconf.shaded.sshd.common.channel.AbstractChannel.writePacket(AbstractChannel.java:780) ~[bundleFile:?]
    at org.opendaylight.netconf.shaded.sshd.common.channel.throttle.DefaultChannelStreamWriter.writeData(DefaultChannelStreamWriter.java:46) ~[bundleFile:?]
    at org.opendaylight.netconf.shaded.sshd.common.channel.ChannelAsyncOutputStream.doWriteIfPossible(ChannelAsyncOutputStream.java:209) ~[bundleFile:?]
    at org.opendaylight.netconf.shaded.sshd.common.channel.ChannelAsyncOutputStream.writeBuffer(ChannelAsyncOutputStream.java:106) ~[bundleFile:?]
    at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandlerWriter.writeWithPendingDetection(AsyncSshHandlerWriter.java:95) ~[bundleFile:?]
    at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandlerWriter.write(AsyncSshHandlerWriter.java:78) ~[bundleFile:?]
    at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler.write(AsyncSshHandler.java:125) ~[bundleFile:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[bundleFile:4.1.76.Final]
    at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) ~[bundleFile:4.1.76.Final]
    at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:113) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[bundleFile:4.1.76.Final]
    at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[bundleFile:4.1.76.Final]
    at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.sendMessage(AbstractNetconfSessionNegotiator.java:340) ~[bundleFile:?]
    at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.start(AbstractNetconfSessionNegotiator.java:150) ~[bundleFile:?]
    at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.startNegotiation(AbstractNetconfSessionNegotiator.java:131) ~[bundleFile:?]
    at org.opendaylight.netconf.nettyutil.AbstractNetconfSessionNegotiator.channelActive(AbstractNetconfSessionNegotiator.java:355) ~[bundleFile:?]&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Both of these are a failure to send initial hello message. Since these are in the Netty-&amp;gt;SSHD direction, there simply are SSHD transitions we have not observed yet (as they are running concurrently with Netty) &#8211; a closed or closing channel may be one of those.&lt;/p&gt;

&lt;p&gt;If this ever happens it is equivalent to the session never being established, as the failure occurred when attempting IDLE-&amp;gt;OPEN_WAIT transition and hence the transition becomes IDLE-&amp;gt;FAILED instead.&lt;/p&gt;</comment>
                            <comment id="71560" author="JIRAUSER13318" created="Tue, 18 Oct 2022 21:09:46 +0000"  >&lt;ul&gt;
	&lt;li&gt;karaf-netconf-905-102751-4.log: Karaf log for &lt;a href=&quot;https://git.opendaylight.org/gerrit/c/netconf/+/102751/4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/c/netconf/+/102751/4&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;karaf-netconf-905-102751-4-mod.log: Karaf log after making a change to allow state transition from &lt;tt&gt;IDLE&lt;/tt&gt; to &lt;tt&gt;FAILED&lt;/tt&gt;:&lt;/li&gt;
&lt;/ul&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;--- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java
+++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java
@@ -327,6 +327,9 @@ public abstract class AbstractNetconfSessionNegotiator&amp;lt;S extends AbstractNetconf
         if (state == State.OPEN_WAIT &amp;amp;&amp;amp; newState == State.ESTABLISHED) {
             return true;
         }
+        if (state == State.IDLE &amp;amp;&amp;amp; newState == State.FAILED) {
+            return true;
+        }
         if (state == State.OPEN_WAIT &amp;amp;&amp;amp; newState == State.FAILED) {
             return true;
         }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10300">
                    <name>Issue split</name>
                                                                <inwardlinks description="split from">
                                        <issuelink>
            <issuekey id="34819">NETCONF-827</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="18109" name="karaf-netconf-905-102751-4-mod.log" size="362702" author="sangwookha" created="Tue, 18 Oct 2022 21:06:08 +0000"/>
                            <attachment id="18108" name="karaf-netconf-905-102751-4.log" size="319690" author="sangwookha" created="Tue, 18 Oct 2022 21:06:02 +0000"/>
                            <attachment id="18107" name="karaf-netconf-905.log" size="71188" author="sangwookha" created="Tue, 18 Oct 2022 18:34:59 +0000"/>
                            <attachment id="18106" name="karaf.log" size="434138" author="sangwookha" created="Fri, 14 Oct 2022 22:00:55 +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|i04353:</customfieldvalue>

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