You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Christopher L. Shannon (JIRA)" <ji...@apache.org> on 2016/03/21 20:59:25 UTC

[jira] [Resolved] (AMQ-6218) Message content returns null occasionally from Virtual Topic to the consumer

     [ https://issues.apache.org/jira/browse/AMQ-6218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher L. Shannon resolved AMQ-6218.
-----------------------------------------
       Resolution: Fixed
    Fix Version/s: 5.13.3
                   5.14.0

There was a race condition when using concurrent store and dispatch for queues.  The issue is that KahaDB calls beoreMarshall() when storing which then calls storeContentAndClear() on the message which clears out the text field.  With concurrent store and dispatch on this can cause both content and text to end up null if the marshalling happens at the same time the message is being copied in another thread.  

I fixed this by grabbing a copy of the text before the rest of the copy method is called and then using that as the value.  The other methods in ActiveMQTextMessage follow a similar pattern of grabbing local references of the text and content fields to try and minimize other threads from interfering.

I did not add synchronization to prevent a performance hit but If other issues pop up we might need to explicitly synchronize access on those two fields in a future version to prevent other race conditions.

> Message content returns null occasionally from Virtual Topic to the consumer
> ----------------------------------------------------------------------------
>
>                 Key: AMQ-6218
>                 URL: https://issues.apache.org/jira/browse/AMQ-6218
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.12.2, 5.13.2
>            Reporter: Rohit Sonawat
>            Assignee: Christopher L. Shannon
>             Fix For: 5.14.0, 5.13.3
>
>         Attachments: AMQ6218Test.java, App.java, Full app.log
>
>
> I have 1 Virtual Topic and 40 Consumer to consume the messages sent by the topic. The problem is when I am sending thousands of Messages lets say 10000 via Virtual Topic I have noticed that 2 or 3 consumer are getting null as a text when I do message.getText(), but virtual topic is not sending a null as a text message if it so then all 40 consumer should report same.
> I have also noticed this problem is not happening in AMQ v5.11 or with levelDB in AMQ v5.12.2/5.13.2. It is happening only in when you use kahaDB with AMQ v5.12.2/5.13.2



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)