Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deregistering an entity does not clear all related retained MQTT messages #3492

Open
reubenmiller opened this issue Mar 20, 2025 · 0 comments
Assignees
Labels
bug Something isn't working theme:entity_store Entity store related functionality theme:mqtt Theme: mqtt and mosquitto related topics

Comments

@reubenmiller
Copy link
Contributor

reubenmiller commented Mar 20, 2025

Describe the bug

De-registering a child device via the entity store HTTP API does not clean up all of the related MQTT topics, for example, below shows that the name and type digital twin properties are still present:

tedge mqtt sub 'te/device/child01/service/custom-app/#'
[te/device/child01/service/custom-app/twin/name] "custom-app"
[te/device/child01/service/custom-app/twin/type] "custom-type"

The bug was found whilst trying to refactor the tests/RobotFramework/tests/cumulocity/registration/registration_lifecycle.robot test to use the deregistration API instead of manually clearing MQTT messages.

To Reproduce

  1. Register a child device

    tedge mqtt pub --retain 'te/device/child01//' '{"@type":"child-device","name":"${CHILD_SN}","type":"linux-device-Aböut"}'
  2. Register a service of the child device

    tedge mqtt pub --retain 'te/device/child01/service/custom-app' '{"@type":"service","@parent":"device/child01//","name":"custom-app","type":"custom-type"}'
  3. De-register the service via the HTTP API

    tedge http delete /tedge/entity-store/v1/entities/device/child01/service/custom-app

Expected behavior

After a service is deregistered (~1-2 seconds after), then all MQTT messages related to that service should no longer be stored as retained messages on the broker.

tedge mqtt sub 'te/device/child01/service/custom-app/#'

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] unknown
System-Architecture Linux b4c8b1418fda 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Sat Jul 6 02:50:39 UTC 2024 aarch64 GNU/Linux
thin-edge.io version tedge 1.4.3~316+gaa844f8

Additional context

@reubenmiller reubenmiller added bug Something isn't working theme:entity_store Entity store related functionality theme:mqtt Theme: mqtt and mosquitto related topics labels Mar 20, 2025
@albinsuresh albinsuresh self-assigned this Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working theme:entity_store Entity store related functionality theme:mqtt Theme: mqtt and mosquitto related topics
Projects
None yet
Development

No branches or pull requests

2 participants