Can't upload large file over SFTP (SshOperationTimeoutException)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu với đường đi của stack trace qua SftpClient.InternalUploadFile, SftpSession.RequestWrite, Channel.SendData và Session.WaitOnHandle. Tái hiện một lần tải lên SFTP lớn với thời lượng gần với thời lượng được báo cáo và xác định lý do session timeout xảy ra; hoàn thành có nghĩa là quá trình truyền hoàn tất mà không bị timeout và hành vi này được bao phủ bởi một regression test phù hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
For uploading .csv file over SFTP I use SSH.NET (version 2016.0.0).
The file which needs to be send is rather large (~7GB), and in about an hour after the uploading started it throws the exception Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out.
Here is my actual uploading code.
using (SftpClient client = new SftpClient(command.FtpHost, command.UserName, command.Password))
{
client.Connect();
client.ChangeDirectory(command.FtpTargetFolder);
// played a lot with BufferSize property
// tried to use the default value, tried 4*1024 and 8*1024
client.BufferSize = 2 * 1024;
using (FileStream fileStream = new FileStream(command.LocalFilePath, FileMode.Open))
{
client.UploadFile(fileStream, PrepareFileName(command.LocalFilePath));
}
client.Disconnect();
}
But this code works fine with smaller (tried with 1-4GB files) files than my desirable one (~7GB). I thought that it could depends on BufferSize, but playing with this property didn't fix the problem.
Here is the issue's stack trace.
Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Channels.Channel.GetDataLengthThatCanBeSentInMessage(Int32 messageLength)
at Renci.SshNet.Channels.Channel.SendData(Byte[] data, Int32 offset, Int32 size)
at Renci.SshNet.Sftp.SftpSession.SendRequest(SftpRequest request)
at Renci.SshNet.Sftp.SftpSession.RequestWrite(Byte[] handle, UInt64 offset, Byte[] data, Int32 length, AutoResetEvent wait, Action'1 writeCompleted)
at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action'1 uploadCallback)
Also I've noticed that usually uploading throws the error in 1 hour after start and by that time it's uploaded ~80-90% of entire file (because I see not fully uploaded files in my destination SFTP folder).
Does someone has an idea why it's happening?
Btw I've asked StackOverflow question regarding that: http://stackoverflow.com/questions/40158501/cant-upload-large-file-over-sftp
Thanks in advance.
- Ngôn ngữ chính
- C#
- Star
- 4.4k
- Fork
- 993
- Merge trung bình
- 9 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sshnet/SSH.NET
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
Using SshClient on Linux under Wine throws System.Security.Cryptography.CryptographicException Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Tất cả issue của sshnet/SSH.NET
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
azurenoops/spin_agent#975 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SubtitleEdit/subtitleedit#15108 · 1 bình luận ·