AWSIoTTopic constant disconnected/reconnected messages
See original GitHub issueHi, I’m using the SDK on a Raspberry PI 3, Java 8 and having issues with listening on a Topic.
Basically, my code is:
public class TestTopicListener extends AWSIotTopic {
public TestTopicListener(String topic, AWSIotQos qos) {
super(topic, qos);
System.out.println("Listener: Connecting to " + topic);
}
@Override
public void onMessage(AWSIotMessage message) {
System.out.println(System.currentTimeMillis() + ": <<< " + message.getStringPayload());
if ( message.getStringPayload().equalsIgnoreCase("restart"))
System.exit(0);
}
}
And I’m just getting the following messages on the console:
Jul 19, 2016 11:07:07 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionFailure INFO: Connection temporarily lost Jul 19, 2016 11:07:07 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionFailure INFO: Client connection lost: rpi001 Jul 19, 2016 11:07:10 AM com.amazonaws.services.iot.client.core.AwsIotConnection$1 run INFO: Connection is being retried Jul 19, 2016 11:07:11 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionSuccess INFO: Connection successfully established Jul 19, 2016 11:07:11 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionSuccess INFO: Client connection active: rpi001 Jul 19, 2016 11:07:12 AM com.amazonaws.services.iot.client.mqtt.AwsIotMqttMessageListener onFailure WARNING: Request failed for topic $aws/things/rpi001/shadow/update: Connection lost (32109) - java.io.EOFException Jul 19, 2016 11:07:12 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionFailure INFO: Connection temporarily lost Jul 19, 2016 11:07:12 AM com.amazonaws.services.iot.client.core.AbstractAwsIotClient onConnectionFailure INFO: Client connection lost: rpi001 Jul 19, 2016 11:07:15 AM com.amazonaws.services.iot.client.core.AwsIotConnection$1 run INFO: Connection is being retried Jul 19, 2016 11:07:15 AM com.amazonaws.services.iot.client.core.AwsIotConnection onConnectionSuccess INFO: Connection successfully established
I’m subscribing to $aws/things/rpi001/shadow/update. It does seem like the very first message I publish on that topic from the client, the client also receives. But after that one, nothing…
The strange thing is that my publications to another topic seem to be working fine along with publishing to $aws/things/rpi001/shadow/update from the client. I’m seeing the updates in the IoT console.
Any help would be appreciated!
Thanks, Mac
Issue Analytics
- State:
- Created 7 years ago
- Comments:16 (7 by maintainers)

Top Related StackOverflow Question
There are two things to rule out first when it comes to connection issues. One is client side issues, such as intermittent network issues; another one is server side disconnect, which can be caused by various reasons, such as policy violation, protocol violations and so on. Can you check your CloudWatch logs for IoT to see if you see any errors there? Another check worth doing is to do a packet capture using tcpdump on your rPi and check how the TCP connection is terminated. If you could share your packet capture file, I’m happy to take a look at it.
Hmmm, I thought it was seconds, that’s why I set 30. I’ve changed to 30000 now. Strange though how 30 ms was enough to stop it from bouncing back and forth.