Re: TextMessage.getText returning null
Ahh, I bet that is a result of using the VM transport. The broker is
likely doing the "beforeMarshal()" call that clears the text just before
the client is calling "getText()" on the same message - or just before
"copy()" is called to make a copy of the message.
Yeah, looking at the code carefully - the storeContent() method is handling
"text != null" with "content = null" by converting text to a byte sequence (
org.apache.activemq.util.ByteSequence) and stuffing that into "content".
If all this happens concurrent with a copy() or a call to getText(), then
it's entirely possible to get this race condition. So, disabling
"concurrent store and dispatch" could solve this problem. Also, using
critical sections in "storeContentAndClear()" as well as "getText()" might
eliminate the race condition.
With all that said, I don't see the big win of clearing the text field in
@Chris - can you try the patch here and see if it eliminates the problem?
I may have missed some paths that access both "text" and "content", but I
think I got the important ones. If that patch works, that increases
confidence that you found the right race condition.
On Thu, May 31, 2018 at 12:55 PM, Christopher Shannon <
> Found the culprit: Seems to be related to
> Specifically, this commit:
> Changing the storeContentAndClear() call back to storeContent() fixes it,
> however it was changed for a reason to prevent memory waste so need to see
> if/what a permanent fix is
> On Thu, May 31, 2018 at 3:54 PM, codingismy11to7 <steven@xxxxxxxxxxxxxx>
> > Ok, thank you...my thought also was that performance impact of using tcp
> > wouldn't be enough to hurt us in any substantial way, even though it
> > *feels*
> > really wasteful to be marshaling the message and using TCP when we're in
> > the
> > same JVM.
> > In response to your first message, I changed the transport from nio:// to
> > tcp:// on all the non-vm threads and the behavior still reproduces. Using
> > Java and raw AMQ libs is a much tougher problem...which I can do...but I
> > probably won't be able to get to that for a few days.
> > --
> > Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-Dev-
> > f2368404.html