Skip to content

ARTEMIS-6360 A second send of a duplicate id in the same transaction is a duplicate - #6884

Open
grepjava wants to merge 1 commit into
apache:mainfrom
grepjava:ARTEMIS-6360
Open

grepjava wants to merge 1 commit into
apache:mainfrom
grepjava:ARTEMIS-6360

Conversation

@grepjava

@grepjava grepjava commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

PostOfficeImpl.checkNotBridgeDuplicateID checked each send against cache.contains only. In a client transaction the id is not in the cache yet: addToCache(duplID, tx, false) adds it after the commit, so that a client resending a transaction after a failure is not rejected. A second send of the same id in the same transaction therefore passed the check too, and the commit delivered both messages (and added the id to the cache twice, see ARTEMIS-6361).

The ids a transaction sends are now kept in the transaction, by cache, and a send whose id the transaction already sent is a duplicate: the transaction is marked rollback-only, as for an id already in the cache. Other transactions do not see them, so a resent transaction is still accepted.

DuplicateDetectionTest.testSameIdTwiceInOneTransaction sends two messages with the same id in one transaction, expects the commit to fail with ActiveMQDuplicateIdException and no message to arrive, then sends the id in a new transaction and gets it. It fails without the fix.

https://issues.apache.org/jira/browse/ARTEMIS-6360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant