Skip to content

Fix SmtpClient handling exceptions as timeouts#288

Merged
davidsh merged 1 commit intodotnet:masterfrom
MihaZupan:smtp-client-timeout
Nov 27, 2019
Merged

Fix SmtpClient handling exceptions as timeouts#288
davidsh merged 1 commit intodotnet:masterfrom
MihaZupan:smtp-client-timeout

Conversation

@MihaZupan
Copy link
Copy Markdown
Member

This is a bug fix.

Only non-async calls on SmtpClient can timeout, but the flag is checked in the async path as well.

As the flag is not reset in the async path, it could already be set and SmtpClient would swallow any real exception and instead throw a timeout.

CC @dotnet/ncl

Only non-async calls on SmtpClient can timeout. As the flag is not reset in the async path, it could already be set and SmtpClient would propagate any exception in the async path as a timeout
@stephentoub
Copy link
Copy Markdown
Member

This is a bug fix.

What issue is this fixing? Can you share the issue number / link?

@MihaZupan
Copy link
Copy Markdown
Member Author

To my knowledge, there isn't an issue opened about this, I just found the issue when reading the code.

Steps to reproduce would look like:

  1. Use synchronous Send that times out
  2. Use any async Send that fails for whatever reason (connection, security ..) - the exception will always be TimedOut (even tho async calls can't time out in SmtpClient)

@davidsh davidsh added this to the 5.0 milestone Nov 26, 2019
@davidsh davidsh merged commit d0974b8 into dotnet:master Nov 27, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants