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
InMemory saga persister creates duplicate saga instances #4182
Conversation
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.
Just a few nitpicks
} | ||
} | ||
|
||
[Serializable] |
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.
Nitpick: We don't need the [Serializable]
public string SomeId { get; set; } | ||
} | ||
|
||
[Serializable] |
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.
Nitpick: We don't need the [Serializable]
public string SomeId { get; set; } | ||
} | ||
|
||
[Serializable] |
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.
Nitpick: We don't need the [Serializable]
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.
Remember this is v5. It uses it consistently
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.
Not a 100% https://github.com/Particular/NServiceBus/blob/master/src/NServiceBus.AcceptanceTests/Audit/When_a_replymessage_is_audited.cs#L112 and there's probably more. But as I said nitpick, I'll make sure we remove them for v6.1
@Particular/nservicebus-maintainers please review. In order to keep it consistent with v5 behavior I'm calling |
V6 won't let you change the correlation property. I'd say we leave as is for v5? |
where | ||
(s.Value.SagaEntity.GetType() == saga.GetType() && (s.Key != saga.Id)) | ||
select s.Value; | ||
if (sagaMetaData.CorrelationProperties.Count == 0) return; |
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.
let's avoid the if short from
{ | ||
if (storedSaga.Value.SagaData.GetType() != sagaType || (storedSaga.Key == saga.Id)) continue; |
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.
let's avoid the if short from
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 was used in other parts in this file as well that's why I kept it consistent.
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.
not considering this as a blocker, but I don't think consistency on this brings any value in that case.
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.
of course it does, at least in the same file the same consistent code style should be used. When I port back into existing code I try to stay consistent with what is there from a style perspective. Applying new formatting rules doesn't make much sense either.
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 you feel strongly about it @timbussmann feel free to apply your desired style changes while merging
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.
@timbussmann I applied formatting as a separate commit just for you ❤️
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.
💃
@timbussmann please merge if you're happy with the changes |
Who's affected
All users using InMemory saga persister that have messages concurrently trying to start the same saga instance on an endpoint with concurrency set to a value above the default of 1.
Symptoms
Two saga instances are created which leads to incorrect business behavior.
Solution
v5 supports multiple correlation properties. So here the lock will be taken on the
FullName
of the saga entity type