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

Clear transaction context in top level transaction #3730

Merged
merged 2 commits into from
Dec 4, 2017

Conversation

jason-bragg
Copy link
Contributor

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.

@sergeybykov sergeybykov added this to the 2.0.0 milestone Dec 1, 2017
}
else if (TransactionContext.GetTransactionInfo() != null)
catch (Exception) { }
Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Member

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?

Copy link
Contributor Author

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();
Copy link
Member

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

Copy link
Member

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)

@xiazen xiazen merged commit 5c4e328 into dotnet:master Dec 4, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants