Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Topics for two devices with different Client IDs are being monitored by a single device. #16448

@javaxhb

Description

@javaxhb

What happened?

  1. EMQX version v5.8.8
  2. Authentication method uses client username, Client ID, and password for authentication.
  3. The two devices are RT65012 and T77523; their respective monitored Topics are iot/device/RT65012 and iot/device/T77523.
  4. Both devices use the same authentication account; in Cluster Configuration - MQTT Configuration, 'Use username as Client ID' is turned off.
  5. Problems encountered:
    5.1 RT65012 does not appear under Monitoring - Clients, while T77523 displays normally.
    5.2 After T77523 comes online, checking its subscribed topics, it initially shows:
Image Subsequently, it changes to: Image

The captured logs are as follows:
2025-12-17T09:38:35.331409+00:00 [MQTT] [email protected]:55366 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=1, ReasonCodes=[0]), username: jixieshi
2025-12-17T09:38:35.362399+00:00 [MQTT] [email protected]:55366 msg: mqtt_packet_received, packet: SUBSCRIBE(Q1, R0, D0, PacketId=2 TopicFilters=[iot/device/T77523(#{nl => 0,qos => 0,rap => 0,rh => 0})]), username: jixieshi
2025-12-17T09:38:35.362591+00:00 [AUTHZ] [email protected]:55366 msg: authorization_module_ignore, action: SUBSCRIBE(Q0), authorize_type: client_info, module: emqx_authz_client_info, topic: iot/device/T77523, username: jixieshi
2025-12-17T09:38:35.362698+00:00 [AUTHZ] [email protected]:55366 msg: authorization_matched_allow, action: SUBSCRIBE(Q0), authorize_type: file, module: emqx_authz_file, topic: iot/device/T77523, username: jixieshi
2025-12-17T09:38:35.362759+00:00 [SUBSCRIBE] [email protected]:55366 msg: subscribe, sub_id: T77523, sub_opts: [nl: 0, qos: 0, sub_props: [], rap: 0, rh: 0], topic: iot/device/T77523, username: jixieshi
2025-12-17T09:38:35.362934+00:00 [MQTT] [email protected]:55366 msg: mqtt_packet_sent, packet: SUBACK(Q0, R0, D0, PacketId=2, ReasonCodes=[0]), username: jixieshi
2025-12-17T09:38:35.397575+00:00 [MQTT] [email protected]:55366 msg: mqtt_packet_received, packet: PUBLISH(Q0, R0, D0, Topic=iot/service/deviceid, PacketId=undefined, Payload(text)={"cmd":"declare","type":"device","sn":"T77523","ip":"192.168.10.2","version_code":"20000015","version_name":"7.8.7","timestamp":1765964313,"token":""}), username: jixieshi
2025-12-17T09:38:35.397734+00:00 [AUTHZ] [email protected]:55366 msg: authorization_module_ignore, action: PUBLISH(Q0,R0), authorize_type: client_info, module: emqx_authz_client_info, topic: iot/service/deviceid, username: jixieshi
2025-12-17T09:38:35.397784+00:00 [AUTHZ] [email protected]:55366 msg: authorization_matched_allow, action: PUBLISH(Q0,R0), authorize_type: file, module: emqx_authz_file, topic: iot/service/deviceid, username: jixieshi
2025-12-17T09:38:35.397818+00:00 [PUBLISH] [email protected]:55366 msg: publish_to, payload_encode: text, topic: iot/service/deviceid, username: jixieshi, payload: {"cmd":"declare","type":"device","sn":"T77523","ip":"192.168.10.2","version_code":"20000015","version_name":"7.8.7","timestamp":1765964313,"token":""}
2025-12-17T09:38:45.826103+00:00 [RULE_SQL_EXEC] [email protected]:55366 msg: rule_activated, environment: [], input: [node: emqx@emqx-core-7f8f9cf999-1.emqx-headless.sports-prod.svc.cluster.local, reason: discarded, timestamp: 1765964325826, peername: 10.206.16.6:55366, sockname: 172.16.0.83:1883, event: client.disconnected, username: jixieshi, proto_ver: 4, client_attrs: [], clientid: T77523, proto_name: MQTT, connected_at: 1765964315293, disconn_props: [User-Property: []], disconnected_at: 1765964325825], rule_id: Device_Disconnected_WH_D, rule_trigger_ts: [1765964325826], username: jixieshi
2025-12-17T09:38:45.826321+00:00 [RULE_SQL_EXEC] [email protected]:55366 msg: SQL_yielded_result, result: [node: emqx@emqx-core-7f8f9cf999-1.emqx-headless.sports-prod.svc.cluster.local, reason: discarded, timestamp: 1765964325826, peername: 10.206.16.6:55366, sockname: 172.16.0.83:1883, metadata: [rule_id: Device_Disconnected_WH_D], event: client.disconnected, username: jixieshi, proto_ver: 4, client_attrs: [], clientid: T77523, proto_name: MQTT, connected_at: 1765964315293, disconn_props: [User-Property: []], disconnected_at: 1765964325825], rule_id: Device_Disconnected_WH_D, rule_trigger_ts: [1765964325826], username: jixieshi
2025-12-17T09:38:45.826388+00:00 [BRIDGE] [email protected]:55366 msg: bridge_action, action_info: [name: Device_Disconnected_WH_D, type: http], rule_id: Device_Disconnected_WH_D, rule_trigger_ts: [1765964325826], username: jixieshi

What did you expect to happen?

I hope to resolve the following two issues:

  1. RT65012 should display normally in the client list, similar to T77523.
  2. The topic iot/device/RT65012 should appear in the topic list of the RT65012 client, not in the T77523 client, which ultimately causes iot/device/RT65012 to overwrite the iot/device/T77523 topic.

How can we reproduce it (as minimally and precisely as possible)?

No response

Anything else we need to know?

No response

EMQX version

Details v5.8.8 ```console $ ./bin/emqx_ctl broker # paste output here ```

OS version

Details
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

Log files

T77523 (1).zip

Details

This issue was automatically translated from Chinese.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions