Skip to content

Fix race condition in the DelayHandler #8894

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

Closed
artembilan opened this issue Feb 7, 2024 · 0 comments
Closed

Fix race condition in the DelayHandler #8894

artembilan opened this issue Feb 7, 2024 · 0 comments

Comments

@artembilan
Copy link
Member

The access to MessageGroup and its collection of messages must be exclusive to produce consistent results.
Otherwise it fails like sporadically:

Caused by: java.util.ConcurrentModificationException: (No message provided)	
	at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:756)	
	at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:778)	
	at java.util.Iterator.forEachRemaining(Iterator.java:133)	
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)	
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)	
	at org.springframework.integration.handler.DelayHandler.reschedulePersistedMessages(DelayHandler.java:600)
@artembilan artembilan added this to the 6.3.0-M1 milestone Feb 7, 2024
artembilan added a commit that referenced this issue Feb 7, 2024
Fixes: #8894

* Guard `this.messageStore` access in the `DelayHandler` with existing `this.lock`
to avoid `ConcurrentModificationException`

**Cherry-pick to `6.2.x`**

(cherry picked from commit 4b43969)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants