Skip to content
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

Remove ObjectDisposedException as inner exception for connection timeout #1035

Closed
bgrainger opened this issue Sep 17, 2021 · 1 comment
Closed
Milestone

Comments

@bgrainger
Copy link
Member

Connection timeout is implemented by disposing a TcpClient; after this happens, the ObjectDisposedException is preserved as the InnerException for a MySqlException:

throw new MySqlException(MySqlErrorCode.UnableToConnectToHost, "Connect Timeout expired.", ex);

This was done to provide additional diagnostic information.

Despite the clear outer exception message, this routinely gets reported as an ObjectDisposedException, e.g.,:

This may be exacerbated by monitoring tools reporting the inner exception. (This screenshot from Application Insights is a slightly different inner exception but I think I've seen the same problem with it.)

image

The ObjectDisposedException is really just a detail of how timeout is currently implemented and ultimately not germane to the connection timeout; to avoid potential confusion we should throw a MySqlException with no inner exception. (This is potentially a breaking change if anyone had a catch () when block based on the inner exception.)

bgrainger added a commit that referenced this issue Sep 17, 2021
This improves diagnostics by removing potentially-confusing or distracting information.
@bgrainger
Copy link
Member Author

Fixed in 1.3.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant