Repository navigation
INT-2751 Fix Reaper Race Condition - #627
Closed
garyrussell wants to merge 2 commits into
Closed
garyrussell wants to merge 2 commits into
garyrussell wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Moving my comment from Commit to Diff
I think we can simplify it by modifying forceComplete() method which already holds the lock.
Basically modify its inner 'try' to look like this:
MessageGroup messageGroupNow = this.getMessageStore().getMessageGroup(group.getGroupId());
long lastModifiedNow = messageGroupNow.getLastModified();
if (group.getLastModified() == lastModifiedNow) {
if (releaseStrategy.canRelease(group)) {
this.completeGroup(correlationKey, group);
}
else {
this.expireGroup(correlationKey, group);
}
}
Contributor
Author
There was a problem hiding this comment.
Yep - good point - will change.
When the reaper runs, and finds a group that is in the process of being completed, the reaper blocks on the lock, but when the lock is released, goes ahead and reaps the group. Now, after obtaining the lock, the reaper checks to see if the modified date changed and, if so, aborts the reap of the group this time around. Required adding lastModified accounting for SimpleMessageGroup (accounting already exists for other message groups). Test case reproduced the problem, demonstrating duplicate output messages. After the fix, it shows the reap was aborted in the debug log.
PR Comments
Contributor
Author
|
Rebased, polished, pushed - probably easier to look at full diff to see current state. |
Contributor
|
LGTM, merging |
olegz
added a commit
to olegz/spring-integration
that referenced
this pull request
Sep 18, 2012
* INT-2751: INT-2751 Fix Reaper Race Condition
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.
When the reaper runs, and finds a group that is in the
process of being completed, the reaper blocks on the
lock, but when the lock is released, goes ahead and
reaps the group.
Now, after obtaining the lock, the reaper checks to
see if the modified date changed and, if so, aborts
the reap of the group this time around.
Required adding lastModified accounting for SimpleMessageGroup
(accounting already exists for other message groups).
Test case reproduced the problem, demonstrating duplicate
output messages.
After the fix, it shows the reap was aborted in the debug
log.