-
Notifications
You must be signed in to change notification settings - Fork 76
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
Edge instance not syncing device state correctly #127
Comments
Hello, @aistisdev. Thanks for bringing the problem to our attention. The suffix is added in case 2 devices with the same name are created separately on both Thingsboard and Edge (during disconnection or not assigning a device with such name to Edge and creating there the same one). If I understood correctly, there was a device with the name 07332076 on TB, but it wasn't assigned to the Edge group, so when you create the same device on Edge - it creates the device in the correct group, but with suffix? I was able to reproduce this, but this logic is by design, we cannot have 2 devices with the same name, but in different groups. In my case, I was able to delete that device (07332076) from TB and recreate it (or just delete the device with a suffix and the original one - 07332076 assign to Edge group), no suffix was added. So could you provide some additional screens, etc., if the problem still exists? |
Hi, @AndriiLandiak
It's a bit convoluted, but I will try to sketch out the situation:
Now is the part that is convoluted...
The correct original device with 07332076 name was on edge only, and the 07332076_... device with the suffix was both on edge and thingsboard.
This was the case until today. When I started to write this post and take screenshots, the situation fixed itself.... I can now recreate that device correctly with any suffixes. It seems to me that something was cached somewhere and this kept on happening until today when it magically does not happen anymore...
I understand. Is it possible to configure edge to not publish anything if the device in thingsboard is not included in edge group? Because if we start deploying thousands of devices to edge and those devices are not added to the edge group, there would be an insane amount of trash devices with suffixes, which would then need to be debugged and deleted. |
I am a bit confused, what does it mean - publish to thingsboard edge? Added to device group, that is assigned to Edge or Edge All group, yeah?
There could be different reasons for that. As one of the example, a lot of events are present in DB with 07332076 name, which applies renaming but was not processed yet, or something else. In order, you could reproduce it - contact us again!
As for now, there are no such options. We could consider improving this in the next release. For example, add some logic for the user to choose - either he wants to create a device with a suffix or replace an existing one. Or some other approach. |
It sends telemetry to our parser, which then sends the telemetry as a standard mqtt gateway api message to thingsboard edge. So it just means that the device started sending messages to our endpoint (it was idle before that).
Yeah, we also had some new user email syncing issues at the same time, which was resolved by manually removing the user from the edge database and recreating the user in thingsboard after that. Maybe that had something to do with this issue. I will keep track of these issues if they appear again.
In our case it makes more sense to just leave the device inactive in thingsboard or both thingsboard and edge if the device is not included in the edge group. We can just have alarms based on inactivity, and then administrator of devices would solve the issue as needed. Seems like this feature of suffixed devices is targeted more for situations where data loss is a critical issue, but in our field a few lost messages is usually not critical. Also, we don't have any way to deal with the data from suffixed devices and to add to that, for each new message a new suffixed device is created, which makes it very confusing for administrators, especially when there can be a large amount of such devices.
That would be great! |
Hello @AndriiLandiak we have a recurrence of this issue, but we might have a bit more info:
** Additional notes**
My first thought is maybe the rule chain has some bugs, or the asynchronous behavior of it somehow causes this mismatch. However as this is not a regular occurrence it's hard to understand what is happening. Do you have any ideas how we could debug this? |
Describe the bug
One particular device on parent thingsboard instance will not sync correctly with edge no matter what is done. We have tried restarting all services, manual syncing after deleting and recreating the device. The device would not be deleted on edge instance. After that we deleted it from the edge database manually. This helped, but now we have a problem where if we create the same device, it automatically appends a suffix:
This happens no matter how many times we recreated it. For all other device names this does not seem to happen.
Your Server Environment
Deployment: monolith
Deployment type: k8s
ThingsBoard Version: thingsboard/tb-edge-pe:3.6.4EDGEPE
Community or Professional Edition: Professional Edition
OS Name and Version:
NAME="AlmaLinux"
VERSION="9.3 (Shamrock Pampas Cat)"
Expected behavior
Should create device 07332076 on both thingsboard and edge without any suffixes.
To Reproduce
Don't know how to reproduce it , but seems like this started when one of the users imported the device without attaching it to the edge group, and the edge started posting
Screenshots
Additional context
At the same time we also had problems with new user syncing where edge instance kept having:
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "tb_user_email_key"
exception. After deleting the user from the edge database manually, only the described problem with the device 07332076 persisted.The text was updated successfully, but these errors were encountered: