-
Notifications
You must be signed in to change notification settings - Fork 236
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
fix(iot-dev): Fix bug caused by unclearing correlationCallbacks map #1647
Conversation
…n IotHubTransport class
...evice-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/IotHubTransport.java
Outdated
Show resolved
Hide resolved
One interesting thing to remember is that only the happy path ends when we send the ack for the received twin update status message. It's possible that the service fails to send the final message (due to service bug or due to us losing connection) and the SDK never executes your change here. Since we don't know for sure that we'll get to the end of the happy path, we probably need to periodically check this map for very old messages and delete them. Maybe in the sendMessages thread loop? |
...evice-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/IotHubTransport.java
Show resolved
Hide resolved
...evice-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/IotHubTransport.java
Outdated
Show resolved
Hide resolved
In your first attempt, you removed the callback from the map once you knew the flow had finished successfully. Is there any reason you got rid of that in this fix? |
Hmm, just thought that we should be able to cover that case with this new approach as well. But yeah, keeping it (remove when the flow is complete) seems more straightforward so I will get it back. |
Thanks. I like having both approaches because otherwise we iterate over unnecessary entries in the map several times after it has already finished its purpose. The timeout approach is just to catch the atypical cases |
...evice-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/IotHubTransport.java
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
Bug fix for issue #1629
Currently we are never clearing the
correlationCallbacks
map in "IotHubTransport" class, even after the acknowledgement for received cloud to device message has been sent back to the hub. As a result, the size of map will grow endlessly which will result in OutOfMemory Error eventually.