You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/02/05 19:30:42 UTC

[jira] [Commented] (ARTEMIS-917) Retained messages from file system contain weird chars

    [ https://issues.apache.org/jira/browse/ARTEMIS-917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15853328#comment-15853328 ] 

ASF GitHub Bot commented on ARTEMIS-917:
----------------------------------------

GitHub user mtaylor opened a pull request:

    https://github.com/apache/activemq-artemis/pull/986

    ARTEMIS-917 Only return body of retained message after reboot

    The endOfBodyPosition pointer is not getting properly set for retained messages after reboot.  MessageImpl copy message does not set this.  This patch fixes the issue by getting the message body directly out of the message buffer.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mtaylor/activemq-artemis ARTEMIS-917

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/986.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #986
    
----
commit 26cec5f31148978425a7e20a14e08cfa1cd6b0da
Author: Martyn Taylor <mt...@redhat.com>
Date:   2017-02-05T19:20:32Z

    ARTEMIS-917 Only return body of retained message after reboot

----


> Retained messages from file system contain weird chars
> ------------------------------------------------------
>
>                 Key: ARTEMIS-917
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-917
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 1.5.1
>         Environment: - Machine:
> It's an EC2 instance on AWS cloud of type m4.large: 2 vCPU, 8G RAM and SSD storage.
> - OS:
> CentOS Linux release 7.3.1611 (Core) - x86_64
> - JVM:
> java version "1.8.0_111"
> Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
> Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
> - Distro package version of libaio:
> Arch        : x86_64
> Version     : 0.3.109
> Release     : 13.el7
>            Reporter: Francesco Padovani
>         Attachments: broker-ARTEMIS-917.xml
>
>
> I'm testing the "retained message" feature of MQTT protocol.
> It seems that the broker works well while the retained messages are kept in ram: messages are sent correctly.
> But when the Broker needs to recover and send the retained messages from the file system (e.g. after a restart), clients receive them with weird chars inside.
> Following are the steps to reproduce the behaviour:
> [Server Side]
> 1. Create a dedicated user and a folder for the Broker installation (with right permission for that user)
> 2. Set JAVA_HOME environment variable for the above user (jdk 1.8.0_111 in my case), download and unpack apache artemis 1.5.1.
> 3. Create a broker instance (set a username, password and role).
> 4. cd into the just created broker folder and create a user by using the following command:
> bin/artemis user add
>   --> set username = <username>
>   --> set password = <password>
>   --> set role = mqtt
> 5. Set the broker.xml file accordingly to the attached one (by changing ip and folder references).
> 6. Run the broker: in foreground ("bin/artemis run") or as a service (bin/artemis-service start) it's the same.
> [Client Side]
> 7. use a mqtt client to publish a retained message on a topic. E.g. with mosquitto client the command could be the following:
> mosquitto_pub -d -h <broker_ip> -p 1883 -u <user> -P <password> -t /topic/test -r -q <QoS> -m "test for a retained message"
> 8. use a mqtt client to subscribe the same topic specified in the previous step. E.g.:
> mosquitto_sub -d -h <broker_ip> -p 1883 -u <user> -P <password> -q <QoS> -t /topic/test
> ...it receives the retained message sent in previous step. The message is good.
> [Server Side]
> 9. Stop the Broker: "bin/artemis stop" or "bin/artemis-service stop"
> 10. Wait until the Broker finishes to stop ("stopped" in the log) and then restart it: "bin/artemis run" or "bin/artemis-service start". Check until it's up and running.
> [Client Side]
> 11. use a mqtt client to subscribe the same topic specified in step 7/8. E.g.:
> mosquitto_sub -d -h <broker_ip> -p 1883 -u <user> -P <password> -q <QoS> -t /topic/test
> ...HERE THE ISSUE: it receives the same retained message published in step 7, but with weird chars inside.
> 12. If you try to replicate steps 7 and 8 (publish a new retained message and subscribe to receive it) you will notice that the new retained message comes back to be clean (no weird chars).
> NOTE: it doesn't matter the client used for test. I replicated the same behaviour by using mosquitto_client, mqtt-spy and mqtt.fx



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)