Repository navigation
Stop swallowing exceptions in reader Dispose - #4677
Merged
Merged
Conversation
And a fix to multiple exception handling with error barriers. Closes npgsql#4377
roji
force-pushed
the
DisposeExceptions
branch
from
September 25, 2022 18:21
275f8df to
25d7b5c
Compare
roji
commented
Sep 25, 2022
| _commandLogger.LogError(e, "Exception caught while disposing a reader", Connector.Id); | ||
| if (e is not PostgresException) | ||
| // In the case of a PostgresException (or multiple ones, if we have error barriers), the reader's state has already been set | ||
| // to Disposed in Close above; otherwise, we need to set it here. |
Member
Author
There was a problem hiding this comment.
@vonzshik I see you added the condition to only set State to Disposed if the exceptions is not a PostgresException. I don't remember the context for that issue, but would it be problematic if we just always set it (either for any exception, or just in the finally)?
Contributor
There was a problem hiding this comment.
One potential issue here is multiplexing: after a reader is disposed, we return it to the connection, but it happens before we set the Disposed state here.
Member
Author
There was a problem hiding this comment.
Thanks, I remember now. Updated the comment to make this clear.
Contributor
There was a problem hiding this comment.
Well, there is also CommandBehavior.CloseConnection, but the idea is the same.
roji
force-pushed
the
DisposeExceptions
branch
from
September 25, 2022 19:11
3c15b1b to
50305db
Compare
vonzshik
approved these changes
Sep 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
And a fix to multiple exception handling with error barriers.
Closes #4377