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

tedge-agent still subscribes to legacy topics when running as a child device #3034

Closed
reubenmiller opened this issue Jul 31, 2024 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@reubenmiller
Copy link
Contributor

Describe the bug

When running the tedge-agent as a child device, it subscribes to the legacy tedge/ topics when it shouldn't. For instance, below is the log output showing the unwanted subscriptions:

2024-07-31T16:48:56.526015106Z  INFO sm-agent: tedge_agent::agent: Running as a child device, tedge_to_te_converter and File Transfer Service disabled
2024-07-31T16:48:56.526161588Z  INFO Runtime: Running Signal-Handler-0
2024-07-31T16:48:56.52627807Z  INFO sm-agent: MQTT sub: te/device/pump///cmd/+/+
2024-07-31T16:48:56.526385737Z  INFO sm-agent: MQTT sub: te/device/pump/service/tedge-agent/cmd/health/check
2024-07-31T16:48:56.526485459Z  INFO sm-agent: MQTT sub: tedge/measurements
2024-07-31T16:48:56.526583163Z  INFO sm-agent: MQTT sub: tedge/measurements/+
2024-07-31T16:48:56.526677182Z  INFO sm-agent: MQTT sub: tedge/events/+
2024-07-31T16:48:56.526770423Z  INFO sm-agent: MQTT sub: tedge/events/+/+
2024-07-31T16:48:56.526864553Z  INFO sm-agent: MQTT sub: tedge/alarms/+/+
2024-07-31T16:48:56.527146443Z  INFO sm-agent: MQTT sub: tedge/alarms/+/+/+
2024-07-31T16:48:56.52724835Z  WARN sm-agent: MQTT sub: ignoring overlapping subscription to te/device/pump///cmd/health/check

Background

The tedge-agent includes a legacy topic converter, however it is only activated when the tedge-agent is running as the main device (e.g. te/device/main//). When running as a child device, the converter is not running (which is correct), however the topic converter builder already alters the MQTT actor and adds the subscriptions to the legacy topics.

To Reproduce

Run the tedge-agent as a child device for a few seconds and inspect the log output to see the subscriptions:

TEDGE_RUN_LOCK_FILES=false timeout 5 tedge-agent --mqtt-device-topic-id "device/pump//"

Below are the examples of the legacy topics that should not be subscribed to when running as a child device.

2024-07-31T16:48:56.526485459Z  INFO sm-agent: MQTT sub: tedge/measurements
2024-07-31T16:48:56.526583163Z  INFO sm-agent: MQTT sub: tedge/measurements/+
2024-07-31T16:48:56.526677182Z  INFO sm-agent: MQTT sub: tedge/events/+
2024-07-31T16:48:56.526770423Z  INFO sm-agent: MQTT sub: tedge/events/+/+
2024-07-31T16:48:56.526864553Z  INFO sm-agent: MQTT sub: tedge/alarms/+/+
2024-07-31T16:48:56.527146443Z  INFO sm-agent: MQTT sub: tedge/alarms/+/+/+

Expected behavior

When the tedge-agent is running as a child device, it should not subscribe to tedge/# topics.

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] Raspberry Pi 5 Model B Rev 1.0
System-Architecture Linux rpi5-d83add9f145a 6.1.0-rpi7-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
thin-edge.io version tedge 1.1.2~326+g2a9eed4
mosquitto version 2.0.18

Additional context

@reubenmiller reubenmiller added the bug Something isn't working label Jul 31, 2024
@reubenmiller reubenmiller self-assigned this Jul 31, 2024
@reubenmiller reubenmiller added this to the 1.2.0 milestone Jul 31, 2024
@reubenmiller
Copy link
Contributor Author

The linked PR includes a system test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants