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

Reconnection loop when device is disconnected by Astarte #31

Closed
Annopaolo opened this issue Jan 20, 2022 · 0 comments · Fixed by #34
Closed

Reconnection loop when device is disconnected by Astarte #31

Annopaolo opened this issue Jan 20, 2022 · 0 comments · Fixed by #34
Labels
bug Something isn't working

Comments

@Annopaolo
Copy link
Collaborator

#22 relies on the assumption that after the first connection, a MQTT session for the device is always present, as we never ask for a clean session.
However, the assumption does not hold when Astarte disconnects the device. In that case, the current automatic reconnection mechanism does not perform the required Astarte MQTT v1 steps (publishing introspection/emptycache/properties), and so the device enters a reconnection loop.
Relevant SDK logs using the example code:

Received error: EOF
Device connection state: false
Sending old messages with non-discard retention
Device connection state: true
Sending old messages with non-discard retention
Received error: EOF
Device connection state: false
Sending old messages with non-discard retention
Device connection state: true
Sending old messages with non-discard retention
Received error: EOF
...
@Annopaolo Annopaolo added the bug Something isn't working label Jan 20, 2022
Annopaolo added a commit to Annopaolo/astarte-device-sdk-go that referenced this issue Jan 20, 2022
Send introspection/emptycache/properties independently of sessionPresent flag.
This allows to perform the initialization steps of the Astarte MQTT v1 protocol
when the MQTT connection has been closed by the server.
Temporairly fixes astarte-platform#31.

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
Annopaolo added a commit to Annopaolo/astarte-device-sdk-go that referenced this issue Jan 20, 2022
Send introspection/emptycache/properties independently of sessionPresent flag.
This allows to perform the initialization steps of the Astarte MQTT v1 protocol
when the MQTT connection has been closed by the server.
Temporarily fixes astarte-platform#31.

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
Annopaolo added a commit to Annopaolo/astarte-device-sdk-go that referenced this issue Jan 20, 2022
…ection

Send introspection independently of sessionPresent flag whenever the device connects or reconnects.
EmptyCache and stored properties are resent only if a new MQTT session is used.
Temporarily fixes astarte-platform#31.
The definitive fix will revise the autoreconnection mechanism as a whole.

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@secomind.com>
@rbino rbino closed this as completed in #34 Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant