fix(iot-dev): Fix how the client handles failed disconnections#1338
Merged
timtay-microsoft merged 9 commits intomasterfrom Sep 10, 2021
Merged
fix(iot-dev): Fix how the client handles failed disconnections#1338timtay-microsoft merged 9 commits intomasterfrom
timtay-microsoft merged 9 commits intomasterfrom
Conversation
Previously, the SDK would throw an exception if the service didn't respond to the mqtt/amqp disconnect messages and it would leave the SDK in a weird semi-closed state. This change makes it so that the close logic in our transport layers always cleans up the local resources even if the service doesn't respond to the disconnection in a timely manner
timtay-microsoft
commented
Sep 3, 2021
|
|
||
| // reconnection may have failed, so check last retry decision, check for timeout, and check if last exception | ||
| // was terminal | ||
| try |
Member
Author
There was a problem hiding this comment.
This section is a bit hard to see the diff on, but basically the try/catch was removed since the caught exception is no longer thrown
timtay-microsoft
commented
Sep 3, 2021
| { | ||
| // As per the documentation for mqttAsyncClient.close() this exception is only thrown if the client is already | ||
| // closed. No need to re-attempt anything here. | ||
| log.debug("Mqtt client was already closed, so ignoring the thrown exception", ex); |
Member
Author
There was a problem hiding this comment.
I need to double check that the exception is a part of this log statement
Member
Author
There was a problem hiding this comment.
Yep, this does work the way I thought. Even though there is no "{}" space for it, log.debug knows to print the exception with the base message
|
Anybody to review this PR for @timtay-microsoft? I need this fix ASAP. I can cheery-pick the commits unless you plan to change the code. Thanks, |
drwill-ms
approved these changes
Sep 10, 2021
abhipsaMisra
approved these changes
Sep 10, 2021
This was referenced Sep 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the SDK would throw an exception if the service didn't respond to the mqtt/amqp disconnect messages and it would leave the SDK in a weird semi-closed state.
This change makes it so that the close logic in our transport layers always cleans up the local resources even if the service doesn't respond to the disconnection in a timely manner