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

When I get the access token for the device, I get an error when I use Mqttbox to send telemetry to the device (using edge, I've made sure the same is possible on thingsboard) #26

Open
LongMaxK opened this issue Sep 15, 2022 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@LongMaxK
Copy link

Description
When I get the access token for the device, I get an error when I use Mqttbox to send telemetry to the device (using edge, I've made sure the same is possible on thingsboard) please help me !!

detail
2022-09-16 00:23:08,320 [ts-service-ts-callback-24-thread-1] WARN o.t.s.s.action.EntityActionService - [fbd5dcd0-350c-11ed-8217-7bf37942aed4] Failed to push entity action to rule engine: ATTRIBUTES_UPDATED (not only this)
java.lang.NullPointerException: null
at org.thingsboard.server.queue.discovery.HashPartitionService.resolve(HashPartitionService.java:202)
at org.thingsboard.server.queue.discovery.HashPartitionService.resolve(HashPartitionService.java:188)
at jdk.internal.reflect.GeneratedMethodAccessor214.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy239.resolve(Unknown Source)
at org.thingsboard.server.service.queue.DefaultTbClusterService.pushMsgToRuleEngine(DefaultTbClusterService.java:189)
at org.thingsboard.server.service.action.EntityActionService.pushEntityActionToRuleEngine(EntityActionService.java:206)
at org.thingsboard.server.service.action.EntityActionService.logEntityAction(EntityActionService.java:219)
at org.thingsboard.server.service.entitiy.DefaultTbNotificationEntityService.logEntityAction(DefaultTbNotificationEntityService.java:95)
at org.thingsboard.server.service.entitiy.DefaultTbNotificationEntityService.logEntityAction(DefaultTbNotificationEntityService.java:68)
at org.thingsboard.server.controller.TelemetryController.logAttributesUpdated(TelemetryController.java:906)
at org.thingsboard.server.controller.TelemetryController$3.onSuccess(TelemetryController.java:704)
at org.thingsboard.server.controller.TelemetryController$3.onSuccess(TelemetryController.java:701)
at org.thingsboard.server.service.telemetry.DefaultTelemetrySubscriptionService$4.onSuccess(DefaultTelemetrySubscriptionService.java:409)
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1080)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

in src/main/java/org/thingsboard/server/queue/discovery/HashPartitionService.java(line 192?)
public TopicPartitionInfo resolve(ServiceType serviceType, TenantId tenantId, EntityId entityId) {
return resolve(serviceType, null, tenantId, entityId);
}

private TopicPartitionInfo resolve(QueueKey queueKey, EntityId entityId) {
    int hash = hashFunction.newHasher()
            .putLong(entityId.getId().getMostSignificantBits())
            .putLong(entityId.getId().getLeastSignificantBits()).hash().asInt();

    Integer partitionSize = partitionSizesMap.get(queueKey); 
    int partition = Math.abs(hash % partitionSize**[nullPointerException]**);

    return buildTopicPartitionInfo(queueKey, partition);
}

in partitionSizesMap: size = 2 QK(Main,TB_CORE,system) and QK(Main,TB_VC_EXECUTOR,system)

Environment

  • OS: windows 10
  • edge v3.4.1 in tags
  • Browser: tags v3.4.1 thingsboard/thingsboard-edge
@LongMaxK LongMaxK added the question Further information is requested label Sep 15, 2022
@volodymyr-babak
Copy link
Collaborator

Hello @LongMaxK
could you please attach a full tb-edge.log file to the ticket?
Sending telemetry to the device over MQTT protocol using an access token is the base functionality and should be supported by the edge.

@LongMaxK
Copy link
Author

Hello!!!!
I've solved the problem, but I'm afraid this workaround is not good. When I was debugging the code, I found that there were only two pieces of data in the partitionSizeMap in the method. When I analyzed the code logic, I found that the content of the database was missing, but I ran the install first and then ran the service. So I added three pieces of data to the queue table, and the current problem was solved.
image
I don't know why the content in the database is missing, and am worried that other follow-up problems may arise.

whats more,I really like thingsboard and thank you so much for getting back to me, thank you so much! !

@LongMaxK
Copy link
Author

I lost the log,sorry,But there are only these in the log, the rest look normal

@volodymyr-babak
Copy link
Collaborator

@LongMaxK thanks for the update!
I suppose you had found a critical bug in the core functionality of the edge on the initial startup of the service (under specific conditions, hash service is initialized incorrectly and messes all around).
I'm going to investigate it once get a chance more deeply and get back into this topic.

@LongMaxK
Copy link
Author

ok!!thx,xd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants