tabish121 commented on PR #1659: URL: https://github.com/apache/activemq/pull/1659#issuecomment-3910213938
> @tabish121 - I know you worked on some of the transport stuff back in the day, do you have any thoughts on this issue? The ActiveMQ Openwire message commands are not written with concurrent access in mind so if that is going on then you will definitely run into trouble. There are various options in the broker and client that might come into play here and trigger this if messages are being sent via VM Transports and are being accessed by more than one thread. The safest course in any client code that operates on a message outside the thread it was received on it to copy it as the copy is a none mutating call that should allow another thread to perform get / set operations safely. The plain JMS consumer reads a message from the VM transport bit is safe because every consumer gets its own copy of the message sourced from the version that the VM transport was handed. Now if your consumer code takes that copy of the message and send it off into more than one thread for say logging and also a send you could see this as something concurrently reading the message while another thread is trying to put it back through a producer could see the state where the content and the text (or Map if using a MapMessage etc) are both null or they might not as none of those fields is volatile. TLDR: When in doubt copy first. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
