-
Notifications
You must be signed in to change notification settings - Fork 235
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
[Device Client] MQTT error reconnecting #268
Comments
Thanks for filing the issue. We will look into the classification of exception in this case and fix accordingly. For configuring the sdk to reconnect indefinitely, setting the operation timeout to max value is the way to go. If you are referring retrying indefinitely in case of "non-retryable" exception, it could be achieved on the application side. You could implement connection status change callback and handle the disconnect accordingly, e.g.: DeviceClient client = new DeviceClient("", IotHubClientProtocol.AMQPS, publicKeyCertificateString, false, privateKeyString, false); client.registerConnectionStatusChangeCallback(new IotHubConnectionStatusChangeCallback()
}, new Object()); Please note that it is not recommended to just reopen indefinitely without evaluating the underlying exception, since it could waste resources if the system is already suggesting that the situation is non-recoverable. |
Thanks, I already had something similar to handle DISCONNECTED case, just thought that a timeout shouldn't be considered non-retryable. |
We are going to go ahead and alter the SDK to interpret SocketTimeoutException as a retryable exception in the future. We'll keep this thread updated as we merge in those changes and eventually release them |
0a21df8 fixed the mapping of SocketTimeoutException. It will be included in the next release. Thanks. |
Thanks for the fix! Do you have an estimated release date for the new version? |
We should be releasing in the next few days. I'll update this thread as soon as we do. |
I can't use the new version 1.13.2 in android. (android API level : 19)。Only dependency this SDK。
after I add this Statement
so I included the following within build.gradle
still fail:
Why log4j-api-2.11.0.jar process fail in android? |
@YMZ1994420 I have open a new issue to track #313 |
OS and version used: Raspbian Jessie and Windows 10
Java runtime used: JDK 1.8 (Oracle's)
SDK version used: 1.11.2
Description of the issue:
Around 2 minuts after a connection drop, a socket timeout is wrongly identified as non-retryable BAD_CREDENTIALS exception and the reconnection process stops (we have it configured to keep trying to reconnect 'forever' as operation timeout is set to Long.MAX_VALUE) making us having to restart all affected devices. Haven't tried with the latest version of the sdk because the release notes do not state any change or bugfix, only new features.
Despite this being a bug with exceptions classification, it'd be nice to have an option or configuration for the sdk to keep trying to reconnect indefinitely (recreating any needed objects/connections in case a critical exception happens)
Code sample exhibiting the issue:
Console log of the issue:
The first message on the connection callback status are correctly identified as NO_NETWORK:
Two minutes later a timeout is detected as BAD_CREDENTIALS which the code treats as "non retryable" exception.
The text was updated successfully, but these errors were encountered: