Re: TextMessage.getText returning null
The issue is when using the VM transport and the getText() method has to
unmarshall data back into text from the byte sequence. This happens
because you go from the NIO to VM transport.
The main problem is you have multiple threads (3 consumers) at the same
time calling getText() on the text message and there is a race condition
where it will set the content to null during it.
I created a very simple test case to show the issue and created a jira
On Wed, May 30, 2018 at 6:06 PM, Arthur Naseef <art@xxxxxxxxxx> wrote:
> Try turning the broker and client logging up to trace and see what the
> logging shows for the message content.
> Also, try the following:
> - Same test with a Java producer (using plain ActiveMQ libs) instead of the
> Scala producer
> - Same test with a Java consumer (using plain ActiveMQ libs) instead of a
> Scala consumer
> - Use the "tcp" transport instead of the "nio" transport
> Anyway, the goal I would say is to trace the problem to the point of
> hand-off between the broker and client. For example, the following
> questions come to mind (for the problematic messages):
> - Is the broker receiving the body over the wire (i.e. tcp connection)?
> - Is the broker sending the body over the wire?
> - Is the client library receiving the body from the application?
> - Is the client library sending the body to the application?
> Hope this helps.
> On Wed, May 30, 2018 at 2:41 PM, codingismy11to7 <steven@xxxxxxxxxxxxxx>
> > We recently updated from (ancient) ActiveMQ 5.10.x to 5.15.4. I've
> > that text messages are now sporadically returning null as their message
> > bodies when they were sent with bodies.
> > After failing to make a unit test showing this error, I created a project
> > that reproduces part of what our software is doing, which reliably
> > replicates the race condition (my last run got null message bodies on
> > ~0.03%
> > of messages). I was able to vastly simplify what our software is doing
> > still reproduce, but when I tried to simplify further the issue stopped
> > appearing.
> > Reproduction and full explanation:
> > https://github.com/CodeMettle/amq_null_body_repro
> > Since I don't have a self-contained unit test I was hesitant to open an
> > issue directly and decided to send a message here instead.
> > I'm a Scala/Akka developer, so I used the tools I was comfortable with to
> > make this reproduction without writing a lot of code, but I'm sure
> > more comfortable in Java and the ActiveMQ API could reproduce in a unit
> > test. I'm assuming it has something to do with multiple Sessions
> > the same topic and calling TextMessage.getText at the same time.
> > Any suggestions of what to do next?
> > Thanks
> > --
> > Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-Dev-
> > f2368404.html