Closed xunyuw closed 1 year ago
Hello, @xunyuw. Thank you for bringing the issue to our attention. Unfortunately, we were unable to reproduce it.
It's worth noting that on ThingsBoard CE, the device profile has two rule chains: the Default Rule chain for processing CE's devices and the Default Edge Rule chain for Edge for processing Edge devices' incoming messages and events). Edge's device/asset profile knows only about its Root Rule chain, so on Edge UI "Default Rule chain" is the "Default Edge Rule chain" on CE.
Here is my flow: I've created a new Device Profile and set the recently created Rule Chain "Test" into it (look at the screen)
Then I clicked Sync Edge (it's redundant, profiles should sync up in every change detected, no need to press the full sync-up button) and restarted Edge service, and after I had everything as expected: Thingsboard CE: Thingsboard Edge:
If this response doesn't address your concern and the problem still exists, please feel free to reach out again with additional details.
Hi @AndriiLandiak, Thanks for your reply, I paste tb-edge.log under and set DEBUG level for details.
The defaultRuleChainId "b6add140-669c-11ee-8881-ed8f66d9a9ca" can be found in line SQL cmd select deviceprof0_.id as id1_160, deviceprof0_.created_time as created_2_160, deviceprof0_.default_dashboard_id as default_3_160, deviceprof0_.default_edge_rule_chain_id as default_4_160, deviceprof0_.default_queue_name as default_5_160, deviceprof0_.default_rule_chain_id as default_6_160, deviceprof0_.description as descript7_160, deviceprof0_.external_id as external8_160, deviceprof0_.firmware_id as firmware9_160, deviceprof0_.image as image10_160, deviceprof0_.is_default as is_defa11_160, deviceprof0_.name as name12_160, deviceprof0_.profile_data as profile13_160, deviceprof0_.provision_device_key as provisi14_160, deviceprof0_.provision_type as provisi15_160, deviceprof0_.software_id as softwar16_160, deviceprof0_.tenant_id as tenant_17_160, deviceprof0_.transport_type as transpo18_160, deviceprof0_.type as type19_160 from deviceprofile deviceprof0 where deviceprof0_.id=? (This rule chain I set on TB CE and id is right I double checked already )
defaultRuleChainId
: value = b6add140-669c-11ee-8881-ed8f66d9a9ca
However there is a function set the defaultRuleChainId to NULL, after it the bug appeared. Thanks for you support again.
2023-10-11 02:23:08,395 [grpc-default-executor-2] DEBUG o.t.server.dao.sql.JpaAbstractDao - Saving entity DeviceProfileEntity(tenantId=458a3e50-249c-11ee-8db7-b1700d0264d7, name=Edge-BMS_GAOTE_20220627-v1, type=DEFAULT, image=null, transportType=DEFAULT, provisionType=DISABLED, description=, isDefault=false, defaultRuleChainId=null, defaultDashboardId=null, defaultQueueName=null, profileData={"configuration":{"type":"DEFAULT"},"transportConfiguration":{"type":"DEFAULT"},"provisionConfiguration":{"type":"DISABLED","provisionDeviceSecret":null},"alarms":null}, provisionDeviceKey=null, firmwareId=null, softwareId=null, defaultEdgeRuleChainId=null, externalId=null)
2023-10-11 02:23:08,392 [rule-dispatcher-22-6] DEBUG o.t.s.a.service.ContextAwareActor - Processing msg: RuleNodeToSelfMsg()
2023-10-11 02:23:08,392 [grpc-default-executor-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Creating new transaction with name [org.springframework.data.jpa.repository.support.SimpleJpaRepository.findById]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly
2023-10-11 02:23:08,392 [grpc-default-executor-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Opened new EntityManager [SessionImpl(656177357createdTime
: value = 1696855507826
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (createdTime
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultDashboardId
: value = null
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultDashboardId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultEdgeRuleChainId
: value = null
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultEdgeRuleChainId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultQueueName
: value = null
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultQueueName
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultRuleChainId
: value = b6add140-669c-11ee-8881-ed8f66d9a9ca
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultRuleChainId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute description
: value =
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (description
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute externalId
: value = null
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (externalId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute firmwareId
: value = null
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (firmwareId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute image
: value = null
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (image
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute isDefault
: value = false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (isDefault
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute name
: value = Edge-BMS_GAOTE_20220627-v1
2023-10-11 02:23:08,393 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (name
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute profileData
: value = {"alarms":null,"configuration":{"type":"DEFAULT"},"provisionConfiguration":{"type":"DISABLED","provisionDeviceSecret":null},"transportConfiguration":{"type":"DEFAULT"}}
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (profileData
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute provisionDeviceKey
: value = null
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (provisionDeviceKey
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute provisionType
: value = DISABLED
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (provisionType
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute softwareId
: value = null
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (softwareId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute tenantId
: value = 458a3e50-249c-11ee-8db7-b1700d0264d7
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (tenantId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute transportType
: value = DEFAULT
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (transportType
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute type
: value = DEFAULT
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (type
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Done materializing entity [org.thingsboard.server.dao.model.sql.DeviceProfileEntity#ad4bd520-66a1-11ee-8881-ed8f66d9a9ca]
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.h.l.e.p.AbstractLoadPlanBasedEntityLoader - Done entity load : org.thingsboard.server.dao.model.sql.DeviceProfileEntity#ad4bd520-66a1-11ee-8881-ed8f66d9a9ca
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Initiating transaction commit
2023-10-11 02:23:08,394 [grpc-default-executor-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Committing JPA transaction on EntityManager [SessionImpl(656177357createdTime
: value = 1696855507826
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (createdTime
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultDashboardId
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultDashboardId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultEdgeRuleChainId
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultEdgeRuleChainId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultQueueName
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultQueueName
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute defaultRuleChainId
: value = b6add140-669c-11ee-8881-ed8f66d9a9ca
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (defaultRuleChainId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute description
: value =
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (description
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute externalId
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (externalId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute firmwareId
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (firmwareId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute image
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (image
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute isDefault
: value = false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (isDefault
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute name
: value = Edge-BMS_GAOTE_20220627-v1
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (name
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute profileData
: value = {"alarms":null,"configuration":{"type":"DEFAULT"},"provisionConfiguration":{"type":"DISABLED","provisionDeviceSecret":null},"transportConfiguration":{"type":"DEFAULT"}}
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (profileData
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute provisionDeviceKey
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (provisionDeviceKey
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute provisionType
: value = DISABLED
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (provisionType
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute softwareId
: value = null
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (softwareId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute tenantId
: value = 458a3e50-249c-11ee-8db7-b1700d0264d7
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (tenantId
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute transportType
: value = DEFAULT
2023-10-11 02:23:08,397 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (transportType
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,398 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Processing attribute type
: value = DEFAULT
2023-10-11 02:23:08,398 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Attribute (type
) - enhanced for lazy-loading? - false
2023-10-11 02:23:08,398 [grpc-default-executor-2] DEBUG o.h.engine.internal.TwoPhaseLoad - Done materializing entity [org.thingsboard.server.dao.model.sql.DeviceProfileEntity#ad4bd520-66a1-11ee-8881-ed8f66d9a9ca]
2023-10-11 02:23:08,398 [grpc-default-executor-2] DEBUG org.hibernate.loader.Loader - Done entity load
2023-10-11 02:23:08,398 [grpc-default-executor-2] DEBUG o.s.orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [SessionImpl(534896530
Hello, @xunyuw. Thanks for your additional info. I've thoroughly reviewed the logs and the information you provided. However, I'm still unable to fully comprehend the underlying cause of the issue.
To enable TRACE logging for the specified components in Thingsboard CE and Thingsboard Edge, please follow these steps:
<logger name="org.thingsboard.server.service.edge" level="TRACE"/>
, <logger name="org.thingsboard.server.service.cloud" level="TRACE"/>
Once you've made these changes, please follow the steps to reproduce the issue as requested. The logs generated at the TRACE level during this process will provide valuable insights into the communication between Thingsboard CE and Thingsboard Edge. Additionally, capturing screenshots of the relevant steps would be beneficial for diagnosing the issue.
Looking forward to your prompt response to help you as soon as possible.
Hi @AndriiLandiak οΌI upload the screenshots to explain how to reproduce this bug.
set the Edge Rule Chain on Thingsboard CE
refresh the Device profile on Thingsboard Edge, the default rule Chain value is changed.
reboot the service on Edge by "service tb-edge restart".
the default rule chain value is empty.
The Rule Chain ID is b6add140-669c-11ee-8881-ed8f66d9a9ca The log with TRACE is below, thanks for your help!
Hello, @xunyuw. Glad to see hear from you again. Could you please provide some additional info?
Is the default rule chain set to null for Device Profile only on Edge? If yes, what is the value of the "default edge rule chain" on Thingsboard CE for Device Profile Edge-BMS-GAOTE-20220627-v1 after restarting Edge?
When Edge is restarting (disconnected from ThingsBoard CE), during the reconnection process, it performs a 'sync' from CE to Edge. This synchronization involves sending all related entities, including Device Profiles. To facilitate this process, it's essential to enable logging, specifically for the Edge: <logger name="org.thingsboard.server.service.cloud" level="TRACE"/>
. It's even better to enable logging for both ThingsBoard CE and Edge, as mentioned in my previous comment. This approach ensures that the output logs during Sync Up or when there are changes to the Device Profile will contain messages similar to those displayed in the screenshot below: (If we update Device Profile on CE, Edge should receive deviceProfileUpdateMsg)._
These logs will help to investigate the communication during synchronization process. Please, attach both logs before restarting (when you update Device Profile) and on Edge starting - when 'Sync Up' is performing.
Thanks a lot!
Hello @AndriiLandiakοΌ Thanks for your kindly support. I check the default value of "edge rule chain" of Device Profile in Thingsbaord CE and find it is always become null after set value. I think it is not a TB Edge bug. I will post to Thingsboard CE issues. Please close this bug now.
Thanks
@xunyuw
thanks for updates. closing ticket.
Describe the bug The Edge rule chain in Device Profile will be reset to default after restart tb-edge service
Your Server Environment
Thingsboard CE v3.6.0 Thingsboard Edge 3.6
Both running on Ubuntu 22.04
Your Client Environment
Desktop (please complete the following information): Windows 11 Chrome
To Reproduce Steps to reproduce the behavior:
Expected behavior Device profile rule chain will be loaded after restart the service