You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Elias Rami (Jira)" <ji...@apache.org> on 2021/07/22 14:11:00 UTC

[jira] [Issue Comment Deleted] (ARTEMIS-3223) MQTT spec violation when subscribed to wildcard topic on redistribution

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

Elias Rami updated ARTEMIS-3223:
--------------------------------
    Comment: was deleted

(was: i can reproduce with artemis 3 node cluster:
 * subscribe to one of the broker nodes with mosquitto_sub with clean session false and with a wildcard subscription:

{code:java}
mosquitto_sub -i client1 -h amq1-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -t 'emob/emob-test/test/+/test' -d -c{code}
 * publish a message on every cluster node with mosquitto_pub:

{code:java}
mosquitto_pub -i publisher3 -h amq3-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -u testuser -P testpassword --insecure -t emob/emob-test/test/12345/test -m test3 -d 
mosquitto_pub -i publisher2 -h amq2-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -u testuser -P testpassword --insecure -t emob/emob-test/test/12345/test -m test2 -d 
mosquitto_pub -i publisher1 -h amq1-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -u testuser -P testpassword --insecure -t emob/emob-test/test/12345/test -m test1 -d
{code}
 * everything is working as expected:

{code:java}
mosquitto_sub -i client1 -h amq1-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -t 'emob/emob-test/test/+/test' -d -c 
Client client1 sending CONNECT 
Client client1 received CONNACK (0) 
Client client1 sending SUBSCRIBE (Mid: 1, Topic: emob/emob-test/test/+/test, QoS: 0, Options: 0x00) 
Client client1 received SUBACK Subscribed (mid: 1): 0 
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
test1 
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
test2 
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
test3
{code}
 * now disconnect the client:

{code:java}
mosquitto_sub -i client1 -h amq1-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -t 'emob/emob-test/test/+/test' -d -c 
Client client1 sending CONNECT 
Client client1 received CONNACK (0) 
Client client1 sending SUBSCRIBE (Mid: 1, Topic: emob/emob-test/test/+/test, QoS: 0, Options: 0x00) 
Client client1 received SUBACK Subscribed (mid: 1): 0 
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
test1 
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
test2 
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
test3 
Client client1 sending PINGREQ 
Client client1 received PINGRESP 
Client client1 sending PINGREQ 
Client client1 received PINGRESP 
^CClient client1 sending DISCONNECT
{code}
 * publish the same messages again:

{code:java}
mosquitto_pub -i publisher1 -h amq1-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -u testuser -P testpassword --insecure -t emob/emob-test/test/12345/test -m test1 -d
Client publisher1 sending CONNECT 
Client publisher1 received CONNACK (0) 
Client publisher1 sending PUBLISH (d0, q0, r0, m1, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
Client publisher1 sending DISCONNECT 

mosquitto_pub -i publisher2 -h amq2-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -u testuser -P testpassword --insecure -t emob/emob-test/test/12345/test -m test2 -d 
Client publisher2 sending CONNECT 
Client publisher2 received CONNACK (0) 
Client publisher2 sending PUBLISH (d0, q0, r0, m1, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
Client publisher2 sending DISCONNECT 

mosquitto_pub -i publisher3 -h amq3-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -u testuser -P testpassword --insecure -t emob/emob-test/test/12345/test -m test3 -d 
Client publisher3 sending CONNECT 
Client publisher3 received CONNACK (0) 
Client publisher3 sending PUBLISH (d0, q0, r0, m1, 'emob/emob-test/test/12345/test', ... (5 bytes)) 
Client publisher3 sending DISCONNECT


{code}
{code:java}

#


# 



# 



# 

# 

# reconnect the client to the same node or another node:
# same node:

mosquitto_sub -i client1 -h amq1-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -t 'emob/emob-test/test/+/test' -d -c
Client client1 sending CONNECT
Client client1 received CONNACK (0)
Client client1 sending SUBSCRIBE (Mid: 1, Topic: emob/emob-test/test/+/test, QoS: 0, Options: 0x00)
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes))
test1
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/+/test', ... (5 bytes))
test3
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/+/test', ... (5 bytes))
test2
Client client1 received SUBACK
Subscribed (mid: 1): 0

# boom mqtt spec violation, 2 times emob/emob-test/test/+/test as topic, instead of emob/emob-test/test/12345/test

# another node:

mosquitto_sub -i client1 -h amq2-ocp-staging.ihs.dev.lx.oeamtc.at -p 1883 -t 'emob/emob-test/test/+/test' -d -c
Client client1 sending CONNECT
Client client1 received CONNACK (0)
Client client1 sending SUBSCRIBE (Mid: 1, Topic: emob/emob-test/test/+/test, QoS: 0, Options: 0x00)
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/12345/test', ... (5 bytes))
test2
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/+/test', ... (5 bytes))
test1
Client client1 received PUBLISH (d0, q0, r0, m0, 'emob/emob-test/test/+/test', ... (5 bytes))
test3
Client client1 received SUBACK
Subscribed (mid: 1): 0

# boom mqtt spec violation again, 2 times wildcard, 1 time correct arrival
{code}
 

 )

> MQTT spec violation when subscribed to wildcard topic on redistribution
> -----------------------------------------------------------------------
>
>                 Key: ARTEMIS-3223
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3223
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: MQTT
>    Affects Versions: 2.16.0, 2.17.0
>         Environment: *Clients*
>  * For testing
>  ** mosquitto_sub 1.4.15 (receiving client)
>  ** mosquitto_pub 1.4.15 (sending client)
>  * Also happens with these clients
>  ** PAHO Java MQTT3 Client
>  ** HiveMQ Java MQTT3 Client (throws "Malformed topic" exception)
> *Broker*
> We first noticed the problem with version 2.16.0, and it still exists in 2.17.0. We're running Artemis in docker using vromero/activemq-artemis Cluster connection is configured as follows:
> {code:java}
> <cluster-connections>
>   <cluster-connection name="activemq">
>     <connector-ref>netty-connector</connector-ref>
>     <retry-interval>500</retry-interval>
>     <use-duplicate-detection>true</use-duplicate-detection>
>     <message-load-balancing>ON_DEMAND</message-load-balancing>
>     <max-hops>1</max-hops>
>     <static-connectors>
>       <connector-ref>netty-connector</connector-ref>
>       <connector-ref>artemis0-connector</connector-ref>
>     </static-connectors>
>   </cluster-connection>
> </cluster-connections> {code}
> Address settings are configured as follows:
> {code:java}
> <address-settings xmlns="urn:activemq:core">
>     <address-setting match="test.*">
>         <default-purge-on-no-consumers>false</default-purge-on-no-consumers>
>         <auto-delete-addresses>true</auto-delete-addresses>
>         <auto-delete-addresses-delay>60000</auto-delete-addresses-delay>
>         <auto-delete-queues>true</auto-delete-queues>
>         <auto-delete-queues-delay>600000</auto-delete-queues-delay>
>         <auto-delete-created-queues>true</auto-delete-created-queues>
>         <dead-letter-address>DLQ</dead-letter-address>
>         <expiry-address>ExpiryQueue</expiry-address>
>         <redelivery-delay>5000</redelivery-delay>
>         <redistribution-delay>30000</redistribution-delay>
>         <max-size-bytes>-1</max-size-bytes>
>         <message-counter-history-day-limit>10</message-counter-history-day-limit>
>         <address-full-policy>PAGE</address-full-policy>
>         <auto-create-queues>true</auto-create-queues>
>         <auto-create-addresses>true</auto-create-addresses>
>         <auto-create-jms-queues>true</auto-create-jms-queues>
>         <auto-create-jms-topics>true</auto-create-jms-topics>
>     </address-setting>
>     <address-setting match="activemq.management#">
>       <dead-letter-address>DLQ</dead-letter-address>
>       <expiry-address>ExpiryQueue</expiry-address>
>       <redelivery-delay>0</redelivery-delay>
>       <redistribution-delay>100</redistribution-delay>
>       <max-size-bytes>-1</max-size-bytes>
>       <message-counter-history-day-limit>10</message-counter-history-day-limit>
>       <address-full-policy>PAGE</address-full-policy>
>       <auto-create-queues>true</auto-create-queues>
>       <auto-create-addresses>true</auto-create-addresses>
>       <auto-create-jms-queues>true</auto-create-jms-queues>
>       <auto-create-jms-topics>true</auto-create-jms-topics>
>     </address-setting>
>     <address-setting match="#">
>       <dead-letter-address>DLQ</dead-letter-address>
>       <expiry-address>ExpiryQueue</expiry-address>
>       <redelivery-delay>0</redelivery-delay>
>       <redistribution-delay>30000</redistribution-delay>
>       <max-size-bytes>-1</max-size-bytes>
>       <message-counter-history-day-limit>10</message-counter-history-day-limit>
>       <address-full-policy>PAGE</address-full-policy>
>       <default-purge-on-no-consumers>false</default-purge-on-no-consumers>
>       <auto-delete-addresses>true</auto-delete-addresses>
>       <auto-delete-addresses-delay>600000</auto-delete-addresses-delay>
>       <auto-delete-queues>true</auto-delete-queues>
>       <auto-delete-queues-delay>60000</auto-delete-queues-delay>
>       <auto-create-queues>true</auto-create-queues>
>       <auto-create-addresses>true</auto-create-addresses>
>       <auto-create-jms-queues>true</auto-create-jms-queues>
>       <auto-create-jms-topics>true</auto-create-jms-topics>
>     </address-setting>
> </address-settings> {code}
>  
>            Reporter: Andreas Hubert
>            Priority: Major
>
> This is a similar problem to ARTEMIS-2888 - if MQTT messages are redistributed after a client has reconnected and the subscription contains wildcards, the topic of the message contains the wildcard address, not the specific address the message was addressed to.
> *Note*: Addresses are written in JMS form (x.y.z) instead of MQTT form (x/y/z).
> *Step to reproduce*
>  # Connect the receiving client to node 1 with a durable session (aka clean-session false) and subscribe to a topic containing wildcards, e.g. *test.+.test1*
>  # Send a test message using another client to any node to topic *test.1234.test1*. It should be delivered correctly.
>  # Disconnect the receiving client.
>  # Send a test message to each individual node of the cluster (containing a unique payload for making them identifyable).
>  # Reconnect the receiving client to node 2 (it should work with any of the nodes, even the previously used node 1).
>  # The receiving client will receive all messages. But only the messages of the node the client is currently connected to will contain the correct topic. All other messages will contain *test.+.test1* as the topic.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)