-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled exception in FtpWebRequest.CreateConnectionAsync crashes process #56376
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescriptionWhen System.Net.FtpWebRequest.CreateConnectionAsync throws an exception in creating a TcpClient the exception is unhandled, because it happens on a thread-pool thread, so this crashes the whole process. This happens when the open file handle limit is reached (and possibly in other scenarios). Console EXE code to reproduce:
Project file:
Run the above with
Run the command above (
Expected result: exception is handled, i.e.
Configuration
Other informationI believe the problem is that
|
Triage: Easier to fix than to triage and punt :) |
Wow, a fix in less than a day! Thanks very much, @stephentoub . Will this be in 6.0.0-preview.8 ? |
Yes, it will be in Preview8 (aka RC1) |
Description
When System.Net.FtpWebRequest.CreateConnectionAsync throws an exception in creating a TcpClient the exception is unhandled, because it happens on a thread-pool thread, so this crashes the whole process. This happens when the open file handle limit is reached (and possibly in other scenarios).
Console EXE code to reproduce:
Project file:
Run the above with
dotnet run
and it should output:Run the command above (
prlimit --nofile=10:10 --pid 58520
or alternativelyprlimit --nofile=10:10 --pid $(pgrep -f FtpWebRequestCrash)
) in another terminal, then press Enter in the running program and it crashes with an unhandled exception:Expected result: exception is handled, i.e.
Configuration
Other information
I believe the problem is that
FtpWebRequest.CreateConnectionAsync()
runsnew TcpClient()
outside of its try/catch. The entire method body should probably be inside a try/catch. Please handle AsyncRequestCallback throwing, too.The text was updated successfully, but these errors were encountered: