Home Forums .NET libraries Xceed SFTP/FTP for .NET Attempted to read past the end of the stream.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21506 |

    I am receiveing the following exception using version 5.4 of the SSH library. This is not occuring using version 5.3 and seems to have somehting to do with the channel window size change in version 5.4.
    When can I expect a fix to the 5.4 library?

    here is the error log entry from the FTP server:
     
    OnPacketReceive, Non-negative number required. Parameter name: count: at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) at SSHServerAPI.Transport.Channel.SendSSHPackets(SSH2BufferStream& buffer) at SSHServerAPI.Transport.Channel.SendPacket(SFTPPacket packet) at SSHServerAPI.SFTP.Subsystem.SendStatus(SFTPStatus status, String msg) at SSHServerAPI.SFTP.Subsystem.DispathPacket() at SSHServerAPI.SFTP.Subsystem.ProcessData(SSH2BufferStream packet) at SSHServer

    the two Exceptions on the Client:
    Exception #1:

    Error: SSHPacketIOManager has been disconnected from an exception in the read thread. See the inner exception for details.

    ERROR: Attempted to read past the end of the stream.

    StackTrace:

    Master exception: SSHDisconnectedException: SSHPacketIOManager has been disconnected from an exception in the read thread. See the inner exception for details.
       at Xceed.SSH.Core.SSHPacketIOManager.VerifyConnection()
       at Xceed.SSH.Core.SSHPacketIOManager.SendPacket(SSHPacket packet)
       at Xceed.SSH.Core.SSHPacketIOManager.SendPayload(SSHPacketPayload payload)
       at Xceed.SSH.Protocols.SSHConnectionProtocol.SignalChannelEof(SSHConnectionProtocolChannel channel)
       at Xceed.SSH.Client.SFtpClient.Disconnect()
       at Xceed.SSH.Client.SFtpSession.Dispose(Boolean disposing)
       at Xceed.SSH.Client.SFtpSession.Dispose()
       at Verizon.AT.FTP.SShFTP.UploadFile(String sourcePath, String remoteFileName, Boolean moveSourceFile, Boolean overWrite) in d:\aProjects\C#Projects\Verizon.AT.FTP\SShFTP.cs:line 721
       at Verizon.AT.FTPServers.FTPClientActions.Send(String serverSectionName, String sourceFile, String remoteDir, String remoteFileName, Boolean moveSourceFile, Boolean overWrite) in d:\aProjects\C#Projects\Verizon.AT.FTPServers\FTPClientActions.cs:line 952
       at Verizon.AT.FTPDirectories.FTPDirectoryActions.Send(String name, String sourceDir, String sourceFile, String remotePath, String remoteFile) in d:\aProjects\C#Projects\Verizon.AT.FTPDirectories\FTPDirectoryActions.cs:line 633
    –>Inner exception: EndOfStreamException: Attempted to read past the end of the stream.
       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead, Boolean throwException)
       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead)
       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadPacket(IEnumerator`1 enumerator, Stream stream, Int32& packetLength, SSHPacket& packet, Int32& count)
       at Xceed.SSH.Core.SSHPacketIOManager.ReceivePacket()
       at Xceed.SSH.Core.SSHPacketIOManager.ReadThread()

    Exception #2 from the Xceed.FileSystem.ItemExceptionEventArgs event:

    Error: File Transfer Error was detected.

    Exception Error: An unexpected internal failure occurred in the FileSystem component, or one of its descendants.

    ERROR: SSHPacketIOManager has been disconnected from an exception in the read thread. See the inner exception for details.

    StackTrace:

    Master exception: FileSystemInternalException: An unexpected internal failure occurred in the FileSystem component, or one of its descendants.
     –>Inner exception: SSHDisconnectedException: SSHPacketIOManager has been disconnected from an exception in the read thread. See the inner exception for details.
     at Xceed.SSH.Core.SSHPacketIOManager.VerifyConnection()
     at Xceed.SSH.Core.SSHPacketIOManager.SendPacket(SSHPacket packet)
     at Xceed.SSH.Core.SSHPacketIOManager.SendPayload(SSHPacketPayload payload)
     at Xceed.SSH.Client.SFtpPacketIOManager.SendPayload(SSHPacketPayload payload)
     at Xceed.SSH.SFtp.SFtp.CloseHandle(Byte[] handle)
     at Xceed.SSH.Client.SFtpClient.CloseHandle(Byte[] handle)
     at Xceed.SSH.Client.SFtpWriteStream.Close()
     at Xceed.FileSystem.AbstractFile.DoCopyTo(FileSystemEventsSession session, FileSystemItem destination, Boolean replaceExistingFiles)
     at Xceed.FileSystem.FileSystemItem.ListCopyToCore(FileSystemEventsSession session, ItemPair currentItemPair, Boolean replaceExistingFiles)

     –>Inner exception: EndOfStreamException: Attempted to read past the end of the stream.
     at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead, Boolean throwException)
     at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead)
     at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadPacket(IEnumerator`1 enumerator, Stream stream, Int32& packetLength, SSHPacket& packet, Int32& count)
     at Xceed.SSH.Core.SSHPacketIOManager.ReceivePacket()
     at Xceed.SSH.Core.SSHPacketIOManager.ReadThread()

    Entries from Xceed TraceLog:

    SFtpClient.WriteFile(). Sending ChannelWindowAdjust on 88: 2147183647 bytes added. Remote window now 2147483647 bytes
    SSHPacketIOManager.SendPacket(): SSH_MSG_CHANNEL_WINDOW_ADJUST
    SFtpPacketIOManager sends SSH_FXP_WRITE
    SFtpPacketIOManager.ReceivePayload() waiting for packet types: StatusResponsePayload…
    SSHPacketIOManager.ReceivePayload() waiting for 1 packet type(s): ChannelDataPayload…
    SSHIOManager.ReadThread() is exiting because inputStream.Read() returned 0. End of stream has been signaled.
    –>EndOfStreamException: Attempted to read past the end of the stream.
       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead, Boolean throwException)
       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead)
       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadPacket(IEnumerator`1 enumerator, Stream stream, Int32& packetLength, SSHPacket& packet, Int32& count)
       at Xceed.SSH.Core.SSHPacketIOManager.ReceivePacket()
       at Xceed.SSH.Core.SSHPacketIOManager.ReadThread()

    Applies to Xceed SFTP for .NET. Imported from legacy forums. Posted by bernie (had 1156 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Bernie,

    We are working on fixing this particular issue. There is a bug in our handling of SSH connection protocol data windows.

    The issue should be fixed with the upcoming release of the component in mid-May 2014.

    Applies to Xceed SFTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 835 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Diane,

     

    We just ran into this exact same issue with a customer using the 5.7 libraries.   here’s the stack trace:

    failed to process the ‘Test.txt’ file with a size of 4 bytes and last write timestamp of 12/23/2015 2:13:06 PM from the FTP Server. SSHPacketIOManager has been disconnected from an exception in the read thread. See the inner exception for details. —> Xceed.SSH.Core.SSHDisconnectedException: SSHPacketIOManager has been disconnected from an exception in the read thread. See the inner exception for details. —> System.IO.EndOfStreamException: Attempted to read past the end of the stream.

       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadFull(Stream stream, Byte[] buffer, Int32 offset, Int32 toRead, Boolean throwException)

       at Xceed.SSH.Protocols.SSHTransportLayerProtocol.ReadPacket(IEnumerator`1 enumerator, Stream stream, Int32& packetLength, SSHPacket& packet, Int32& count)

       at Xceed.SSH.Core.SSHPacketIOManager.ReceivePacket()

       at Xceed.SSH.Core.SSHPacketIOManager.ReadThread()

       — End of inner exception stack trace —

       at Xceed.SSH.Core.SSHPacketIOManager.VerifyConnection()

       at Xceed.SSH.Core.SSHPacketIOManager.ReceivePayloadCore(Predicate`1 match, Boolean wait, Boolean trace, Type[] payloadTypes, LinkedListNode`1& packetSelectorNode)

       at Xceed.SSH.Core.SSHPacketIOManager.ReceivePayload(Predicate`1 match, Int32 timeout, Boolean trace, Type[] payloadTypes)

       at Xceed.SSH.Protocols.SSHConnectionProtocol.ReceiveChannelPayload(SSHPacketIOManager packetIOManager, Int32 channelNumber, Type[] payloadTypes)

       at Xceed.SSH.Protocols.SSHConnectionProtocol.OpenInteractiveSessionChannel(Int32 initialLocalWindowSize, Int32 windowAdjustmentThreshold, Int32 windowTargetSize, Int32 maximumLocalPacketSize)

       at Xceed.SSH.Client.SFtpClient.Connect(SSHClient sshClient, Int32 sftpVersion)

       at Xceed.SSH.Client.SFtpSession..ctor(SSHClient sshClient)

     

    this happens when they are trying to read a small 4K file.  When they try to read a larger file, they get this error:

     

    SSHPacketIOManager is in
    the disconnected state. —> Xceed.SSH.Core.SSHDisconnectedException:
    SSHPacketIOManager is in the disconnected state.

       at
    Xceed.SSH.Core.SSHPacketIOManager.VerifyConnection()

       at Xceed.SSH.Core.SSHPacketIOManager.ReceivePayloadCore(Predicate`1
    match, Boolean wait, Boolean trace, Type[] payloadTypes, LinkedListNode`1&
    packetSelectorNode)

       at
    Xceed.SSH.Core.SSHPacketIOManager.ReceivePayload(Predicate`1 match, Int32
    timeout, Boolean trace, Type[] payloadTypes)

       at
    Xceed.SSH.Protocols.SSHConnectionProtocol.ReceiveChannelPayload(SSHPacketIOManager
    packetIOManager, Int32 channelNumber, Type[] payloadTypes)

       at
    Xceed.SSH.Protocols.SSHConnectionProtocol.OpenInteractiveSessionChannel(Int32 initialLocalWindowSize,
    Int32 windowAdjustmentThreshold, Int32 windowTargetSize, Int32
    maximumLocalPacketSize)

       at
    Xceed.SSH.Client.SFtpClient.Connect(SSHClient sshClient, Int32 sftpVersion)

       at
    Xceed.SSH.Client.SFtpSession..ctor(SSHClient sshClient)
     

    How do we solve this? 

    Applies to Xceed SFTP for .NET. Imported from legacy forums. Posted by Martin (had 59 views)

    Xceed Support
    Member
    Post count: 5658

    Do you get the same exceptions using the latest version of the component (5.8) from our website?

    Applies to Xceed SFTP for .NET. Imported from legacy forums. Posted by Jb [Xceed] (had 59 views)

    mdbaumbach
    Participant
    Post count: 1

    It looks like I am hitting the same error under Version 5.8.15520.0. Anyone else seeing it?

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.