Can't upload large file over SFTP (SshOperationTimeoutException)
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- csharp
- 領域
- networking
調査の方向性
まず、SftpClient.InternalUploadFile、SftpSession.RequestWrite、Channel.SendData、Session.WaitOnHandle を通るスタックトレースの経路を確認します。報告された所要時間に近い、大容量の SFTP アップロードを再現し、セッションタイムアウトが発生する理由を特定します。転送がタイムアウトせずに完了し、その動作が適切な回帰テストでカバーされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C#
- スター
- 4.4k
- フォーク
- 993
- 平均マージ
- 9日 21時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sshnet/SSH.NET のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
dotnet/AspNetCore.Docs#37699 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SubtitleEdit/subtitleedit#15108 · コメント 1 件 ·
-
area/docs-content Bug pulumi/docs
難易度 1/5 1〜3時間 初心者へのやさしさ 94/100
-
agentic-workflows untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100