Skip to content

[Fix] [IoT] Check scheduleReconnect() return value #660

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

Merged
merged 4 commits into from
Jan 21, 2019

Conversation

sklikowicz
Copy link
Contributor

There is a bug in AWSIotMqttManager if auto reconnection is on (default).
If last reconnect attempt (10th by default) is successfully and there is following disconnect within the connection stability time (10 seconds by default) manager is not clearing reconnection counter so next reconnection is not scheduled and connection status is set to reconnect without checking returned value from the scheduleReconnect() method.

See:
setupCallbackForMqttClient()

if ((lastConnackTime + (connectionStabilityTime * MILLIS_IN_ONE_SECOND)) < getSystemTimeMs()) {
      resetReconnect(); // <--- will not call this method because stability time is not exceeded so the counter will not reset
 }
scheduleReconnect() ;// <--- this method will be called

scheduleReconnect()

if (maxAutoReconnectAttempts == -1 || autoReconnectsAttempted < maxAutoReconnectAttempts) { 
           {....} //<--- will not execute this code to start separete thread to reconnect because auto reconnnect counter was not reset and is higher then max
            return true;
        } else {
            return false; //<--- will execute this code and return false but setupCallbackForMqttClient() is not checking returned boolean and set connection status to reconnect before this called
        }

Verified

This commit was signed with the committer’s verified signature.
hawkw Eliza Weisman
…lient()
@mutablealligator mutablealligator self-assigned this Jan 17, 2019
@mutablealligator mutablealligator added the iot Issues with the AWS Android SDK for Internet of Things (IoT) label Jan 17, 2019
@mutablealligator mutablealligator added the bug Something isn't working label Jan 17, 2019

Verified

This commit was signed with the committer’s verified signature.
hawkw Eliza Weisman
palpatim and others added 2 commits January 21, 2019 10:30

Verified

This commit was signed with the committer’s verified signature.
hawkw Eliza Weisman

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@rohandubal rohandubal merged commit 90266af into aws-amplify:master Jan 21, 2019
sunchunqiang pushed a commit that referenced this pull request Mar 5, 2019

Verified

This commit was signed with the committer’s verified signature.
hawkw Eliza Weisman
…lient() (#660)
awsmobilesdk pushed a commit to awsmobilesdk/aws-sdk-android that referenced this pull request Apr 12, 2020

Verified

This commit was signed with the committer’s verified signature.
hawkw Eliza Weisman
…lient() (aws-amplify#660)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iot Issues with the AWS Android SDK for Internet of Things (IoT)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants