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

fix(iot-dev): Fix bug caused by unclearing correlationCallbacks map #1647

Merged
merged 17 commits into from
Jan 11, 2023

Conversation

brycewang-microsoft
Copy link
Collaborator

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.

@timtay-microsoft
Copy link
Member

timtay-microsoft commented Dec 14, 2022

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?

@brycewang-microsoft brycewang-microsoft marked this pull request as draft December 16, 2022 19:35
@brycewang-microsoft brycewang-microsoft marked this pull request as ready for review December 19, 2022 19:12
@timtay-microsoft
Copy link
Member

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?

@brycewang-microsoft
Copy link
Collaborator Author

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.

@timtay-microsoft
Copy link
Member

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

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@brycewang-microsoft
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

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

Successfully merging this pull request may close these issues.

3 participants