ObjectDisposedException is thrown instead of TaskCancelledException when FtpClient.ConnectAsync() is called with cancelled token
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- csharp
- 領域
- backend, networking
調査の方向性
The report traces the failure through FtpClient.ConnectAsync and FtpSocketStream.ConnectAsync, with the exception occurring in FtpSocketStream.EnableCancellation. Start by reading those methods and the existing cancellation tests. Reproduce with an already-cancelled CancellationToken and confirm ConnectAsync reports cancellation instead of ObjectDisposedException; the issue does not name a test file.
索引モデルが issue の本文から書いたものです。
説明
FTP OS: N/A
FTP Server: N/A
Computer OS: Windows
FluentFTP Version: 32.3.3
When FtpClient.ConnectAsync() is called with a CancellationToken that has already been cancelled it throws ObjectDisposedException. I was expecting TaskCancelledException.
I discovered this during development while testing the FtpClient's cancellation behavior, but it seems plausible that it could happen in a production app, e.g., if multiple operations are using the same cancellation token and the token happens to be cancelled just before the call to ConnectAsync().
Here's code that reproduces the issue:
private static async Task TestAsync() {
FtpTrace.AddListener(new ConsoleTraceListener());
// This could be cancelled due to multiple operations using the same token, a timeout expiring, etc.
var cancelledToken = new CancellationToken(true);
using (var ftpClient = new FtpClient(new Uri("ftp://127.0.0.1"))) {
await ftpClient.ConnectAsync(cancelledToken);
}
}
Logs :
# ConnectAsync()
Status: Connecting to 127.0.0.1:21
# Dispose()
Status: Disposing FtpClient object...
Status: Disposing FtpSocketStream...
Status: Disposing FtpSocketStream...
Here's the exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at FluentFTP.FtpSocketStream.<EnableCancellation>d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at FluentFTP.FtpSocketStream.<ConnectAsync>d__80.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at FluentFTP.FtpClient.<ConnectAsync>d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at FluentFTP.FtpClient.<ConnectAsync>d__27.MoveNext()
[...non FtpClient stack traces omitted...]
- 主要言語
- C#
- スター
- 3.4k
- フォーク
- 684
- 平均マージ
- 3日 11時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
robinrodricks/FluentFTP のほかの issue
-
enhancement help wanted major
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
robinrodricks/FluentFTP#1889 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
robinrodricks/FluentFTP#1887 ·
-
.NET maintenance response requested
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
robinrodricks/FluentFTP#1886 · コメント 7 件 ·
-
bug fixed Pending next release pureftpd-server workaround
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
robinrodricks/FluentFTP#1878 · コメント 12 件 ·
-
incorrect usage
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
robinrodricks/FluentFTP#1859 · コメント 4 件 ·
robinrodricks/FluentFTP の issue をすべて見る
似ている issue
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dotnet/maui#40788 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
erkamyaman/rust-anything#943 ·
メンテナーはふだん 1 日以内に返信
-
priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SixLabors/ImageSharp.Drawing#438 · コメント 1 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100