-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Clear transaction context in top level transaction #3730
Clear transaction context in top level transaction #3730
Conversation
… from being passed back to the caller.
} | ||
else if (TransactionContext.GetTransactionInfo() != null) | ||
catch (Exception) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand why we are ignoring exception here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is not important, should we at least log it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squeshed because we're already in error handling logic and there is nothing that can be done, but yeah, probably best not to squash these. Fixed
@@ -411,6 +411,7 @@ public void SniffIncomingMessage(Message message) | |||
|
|||
if (message.Direction != Message.Directions.OneWay) | |||
{ | |||
TransactionContext.Clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be cleared regardless of the direction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but it probably doesn't matter. What's critical here is whether the context is still set when building the response message. For calls that created the context, or when exceptions are thrown, the transaction context should be cleared prior to building a response.
@@ -430,6 +431,7 @@ public void SniffIncomingMessage(Message message) | |||
|
|||
if (message.Direction != Message.Directions.OneWay) | |||
{ | |||
TransactionContext.Clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here... at first thought at least seems that it should clear before returning, regardless of direction... I might be wrong, as I didn't follow it very thoroughly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, nevermind, I see now that this whole block is wrapped with a try/finally where you clear in the finally statement
In reply to: 154475381 [](ancestors = 154475381)
Clear transaction context in top level transaction to prevent context from being passed back to the caller.
Context returned to the caller created a dependency on the transaction assembly for Orleans clients. That assembly should be silo only.