<p>When transferring files with SCP from a device running dropbear 0.53.1 I noticed connection aborts on the PC runninng SSH.NET with error messages from dropbear.</p>
<p> </p>
<p>On the PC I get "An established connection was aborted by the software in your host machine." while dropbear on the device logs "authpriv.info dropbear[4775]: Exit (system): Close for unknown channel 0"</p>
<p>(Dropbear terminates the whole connection in an unclean way when it detects this error.)</p>
<p> </p>
<p>The problem depends on timing because it seems to disappear when I run dropbear with system call trace or (lots of) debug output.</p>
<p> </p>
<p>With debudding on the PC we found out that SSH.NET sometimes sends SSH_MSG_CHANNEL_CLOSE twice.</p>
<p> </p>
<p>SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #2'.</p>
<p>SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #0'.</p>
<p>SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #0'.</p>
<p>Eine Ausnahme (erste Chance) des Typs "Renci.SshNet.Common.SshConnectionException" ist in Renci.SshNet.dll aufgetreten.</p>
<p>15:29:31.3242:scp_ErrorOccurred: An established connection was aborted by the software in your host machine.</p>
<p> </p>
<p>In Channel.cs there is a call to</p>
<p>this.SendMessage(new ChannelCloseMessage(this.RemoteChannelNumber));</p>
<p>both in Close() and in OnClose()</p>
<p> </p>
<p>In the problematic case Close() is called first, then OnClose(). </p>
<p> </p>
<p>We were able to fix the problem by preventing the Channel object from sending the message twice. We modify a variable when sending ChannelCloseMessage for the first time and skip the second call if the variable does not have its initial value.</p>
<p> </p>
<p> </p>
<p>Bodo</p>
Comments: ** Comment from web user: olegkap **
<p> </p>
<p>On the PC I get "An established connection was aborted by the software in your host machine." while dropbear on the device logs "authpriv.info dropbear[4775]: Exit (system): Close for unknown channel 0"</p>
<p>(Dropbear terminates the whole connection in an unclean way when it detects this error.)</p>
<p> </p>
<p>The problem depends on timing because it seems to disappear when I run dropbear with system call trace or (lots of) debug output.</p>
<p> </p>
<p>With debudding on the PC we found out that SSH.NET sometimes sends SSH_MSG_CHANNEL_CLOSE twice.</p>
<p> </p>
<p>SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #2'.</p>
<p>SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #0'.</p>
<p>SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #0'.</p>
<p>Eine Ausnahme (erste Chance) des Typs "Renci.SshNet.Common.SshConnectionException" ist in Renci.SshNet.dll aufgetreten.</p>
<p>15:29:31.3242:scp_ErrorOccurred: An established connection was aborted by the software in your host machine.</p>
<p> </p>
<p>In Channel.cs there is a call to</p>
<p>this.SendMessage(new ChannelCloseMessage(this.RemoteChannelNumber));</p>
<p>both in Close() and in OnClose()</p>
<p> </p>
<p>In the problematic case Close() is called first, then OnClose(). </p>
<p> </p>
<p>We were able to fix the problem by preventing the Channel object from sending the message twice. We modify a variable when sending ChannelCloseMessage for the first time and skip the second call if the variable does not have its initial value.</p>
<p> </p>
<p> </p>
<p>Bodo</p>
Comments: ** Comment from web user: olegkap **
Hi,
Can you try latest version? I believe I fixed some racing condition for similar case so I hope it will fix this issue for you too.
Thanks,
Oleg