A few times over the last few years the busiest queue in our system would suddenly start spewing these "Duplicate dispatch on connection" warning messages into the log and 0 messages would be processed. Googling around the only references I could find mentioned "optimize acknowledge" may be at fault. We stopped using that feature and I though perhaps this issue was gone but it popped up again today.
The log messages look like this:
I randomly noticed that the "commandId" was negative. I looked at the messageId and sure enough it is very large, in the 2^31 range. I checked all my field reports for this bug and in all cases the id was just over 2^31. I dug into the activemq code and found the issue was the BitArrayBin class doesn't handle values of that size correctly. I was about to post that as a critical bug but found it had already been reported and fixed for 5.11.0 in another context.
In case other people have a system stable enough to generate 2^31 messages from a single producer they should know they can add the setting "?checkForDuplicates=false" at the queue or connection level. Are there any other mitigation strategies I may not know?