-
Notifications
You must be signed in to change notification settings - Fork 56
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
duplicate device registration messages when using tedge-log-plugin as a child device #2389
Comments
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Doing some further investigations and it seems to be a problem just in the Only using tedge-log-plugin - FAIL
It is possible that the registration of the Only using tedge-configuration-plugin - OK
Only using tedge-agent - OK
|
I've found an easier way to reproduce the bug, I'll update the ticket description |
That was my first assumption as well, but this isn't the case here. It is another message race during the startup. The child device list sync mechanism of the mapper, during its startup, where it looks at the differences between the child device list received from the cloud vs the ones known locally, and any new local ones are registered with the cloud is what's triggering that duplicate registration message. Here is the message race that's happening:
I'll update this ticket with the fix approach, once I work out something. |
@albinsuresh Though are you sure that sending the child-device registration message first before any operation registration messages wouldn't fix the situation? Or is it just by chance that I didn't see this error on other components (e.g. tedge-configuration-plugin, tedge-agent etc.)? |
After further testing it seems to affect all components when running as a child-device. When starting the following components with different child ids and the tedge-mapper-c8y is stopped, it results in 3 erroneous device registration messages:
|
If the child device directory the child device operation directories follow the default external id naming scheme, they are auto-registered with the right topic id and name derived from that external id.
…tory-registration Fix auto-registration of child device op dirs #2389
Merged PR to address the incorrect registration of the child devices. Add systems tests here: |
QA has thoroughly checked the feature and here are the results:
|
Describe the bug
A child device is being registered twice under two different topic names which results in operation sent from Cumulocity not being mapped to the correct
te/
topic (or at least not the topic which is being listened to by the "child-device").The error was discovered during updates to the tedge-demo-container@feat-te-as-child-device project which uses the following container setup:
Once the child device container starts up, two
te/
registration messages for the same@id
are present but on different local te topics. An example of the two duplicated registration messages are shown below:The error seems to be caused when the
tedge-log-plugin
component is registered as a child device when thetedge-mapper-c8y
is not running. When the mapper starts, it creates the erroneouste/device/<child-id>//
registration message.To Reproduce
Given a main device with thin-edge.io connected to Cumulocity IoT, run the following steps:
Open a console and stop the tedge-mapper-c8y service
In a new console, start the tedge-log-plugin as a child device
Go to the previous console, and start the mapper
Check the registration messages
Inspect the registration messages, and there should NOT be duplicated registration messages for the
child1
device for differentte/device/<child-id>//
topics:Expected behavior
When using thin-edge.io as a child device, it should only register the
@id
of the device under one topic on startup, and that topic should be the same as the configuredmqtt.device_topic_id
setting in the/etc/tedge/tedge.toml
.For example, if
mqtt.device_topic_id
is set todevice/child01//
, then the topic should be:And there should not be a second registration message sent to a topic with this pattern:
Screenshots
Environment (please complete the following information):
alpine linux 3.18
docker
aarch64
0.12.1~513+g8edcba2
Additional context
The text was updated successfully, but these errors were encountered: