-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ForceReleaseProcessor will never be run when group condition is used and MongoDbMessageStore #8685
Comments
+1 on this. Precisely described, @antonvovk |
Thank you for the report! Indeed this is a problem we had caused via inconsistency with entity in the memory and whatever we have just update in the DB. I see one way to fix quickly: do not update a Another quick way is to re-fetch group in that And final (probably the best) fix is to implement a new Since that API was introduced in an old still in support version:
we have to fix this down to there as well, but we have to be careful do not make a breaking change. I believe any solution we chose would be possible to back-port, but we have to decide together which one is good for all of us. Please, help me with a choice 😄 |
Thanks for your quick response 😄 It would be good to have a quick fix that can be easily backported in 5.5.x/6.0.x/6.1.x. I think the second option will be the easiest and safest to do. The performance impact shouldn't be that noticeable and it will only affect those who use group condition. Then in 6.2.0, the third option can be used which is really the best one to make a proper fix. |
OK! Let it be! Then I'll implement quickly the second option. |
Fixes spring-projects#8685 The `AbstractCorrelatingMessageHandler` updates the group metadata in DB not only for provided `condition`, but also a `lastModified` field. A subsequent scheduling for group timeout takes the `lastModified` to compare with the value in the store after re-fetching group in task. This does not reflect reality since adding `condition` modifies the data in DB, but in-memory state remains the same. * Re-fetch a group from the store in the `AbstractCorrelatingMessageHandler.setGroupConditionIfAny()`. * Verify expected behavior via new `ConfigurableMongoDbMessageGroupStoreTests.groupIsForceReleaseAfterTimeoutWhenGroupConditionIsSet()` **Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`**
This the fix in related PR: #8686 |
* GH-8685: Re-fetch group after setting condition Fixes #8685 The `AbstractCorrelatingMessageHandler` updates the group metadata in DB not only for provided `condition`, but also a `lastModified` field. A subsequent scheduling for group timeout takes the `lastModified` to compare with the value in the store after re-fetching group in task. This does not reflect reality since adding `condition` modifies the data in DB, but in-memory state remains the same. * Re-fetch a group from the store in the `AbstractCorrelatingMessageHandler.setGroupConditionIfAny()`. * Verify expected behavior via new `ConfigurableMongoDbMessageGroupStoreTests.groupIsForceReleaseAfterTimeoutWhenGroupConditionIsSet()` **Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`** * * Fix Checkstyle violation in the test
* GH-8685: Re-fetch group after setting condition Fixes #8685 The `AbstractCorrelatingMessageHandler` updates the group metadata in DB not only for provided `condition`, but also a `lastModified` field. A subsequent scheduling for group timeout takes the `lastModified` to compare with the value in the store after re-fetching group in task. This does not reflect reality since adding `condition` modifies the data in DB, but in-memory state remains the same. * Re-fetch a group from the store in the `AbstractCorrelatingMessageHandler.setGroupConditionIfAny()`. * Verify expected behavior via new `ConfigurableMongoDbMessageGroupStoreTests.groupIsForceReleaseAfterTimeoutWhenGroupConditionIsSet()` **Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`** * * Fix Checkstyle violation in the test
* GH-8685: Re-fetch group after setting condition Fixes #8685 The `AbstractCorrelatingMessageHandler` updates the group metadata in DB not only for provided `condition`, but also a `lastModified` field. A subsequent scheduling for group timeout takes the `lastModified` to compare with the value in the store after re-fetching group in task. This does not reflect reality since adding `condition` modifies the data in DB, but in-memory state remains the same. * Re-fetch a group from the store in the `AbstractCorrelatingMessageHandler.setGroupConditionIfAny()`. * Verify expected behavior via new `ConfigurableMongoDbMessageGroupStoreTests.groupIsForceReleaseAfterTimeoutWhenGroupConditionIsSet()` **Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`** * * Fix Checkstyle violation in the test
* GH-8685: Re-fetch group after setting condition Fixes #8685 The `AbstractCorrelatingMessageHandler` updates the group metadata in DB not only for provided `condition`, but also a `lastModified` field. A subsequent scheduling for group timeout takes the `lastModified` to compare with the value in the store after re-fetching group in task. This does not reflect reality since adding `condition` modifies the data in DB, but in-memory state remains the same. * Re-fetch a group from the store in the `AbstractCorrelatingMessageHandler.setGroupConditionIfAny()`. * Verify expected behavior via new `ConfigurableMongoDbMessageGroupStoreTests.groupIsForceReleaseAfterTimeoutWhenGroupConditionIsSet()` **Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`** * * Fix Checkstyle violation in the test
In what version(s) of Spring Integration are you seeing this issue?
6.1.0
To Reproduce
Use
MongoDbMessageStore
orConfigurableMongoDbMessageStore
as theMessageGroupStore
implementation.Create aggregator:
groupConditionSupplier
for theAbstractCorrelatingMessageHandler
.groupTimeoutExpression
for theAbstractCorrelatingMessageHandler
with a positive value of 5-10 seconds.Describe the bug
Let's take a look at this function from AbstractCorrelatingMessageHandler:
To run the
forceReleaseProcessor
thetimestamp
andlastModified
must be the same as the corresponding properties from the message group that was fetched at the beginning of this function.The
timestamp
andlastModified
parameters come from the message group that was fetched in theprocessMessageForGroup
function.The problem is that after fetching the message group in the
processMessageForGroup
we do a call tosetGroupConditionIfAny(message, messageGroup)
. And if we are using the group condition, this function will callmessageStore.setGroupCondition()
which will update the message group condition and itslastModifiedTime
property in MongoDB implementation.So we end up in a situation where the
lastModifiedTime
is newer in the database but the message group fetched in theprocessMessageForGroup
has an old value. This means that the condition in theforceReleaseProcessor
will never be true if we are using the group condition.Expected behavior
The message group instance in the
processMessageForGroup
should be updated after a call tosetGroupConditionIfAny
.The text was updated successfully, but these errors were encountered: