paho.mqtt.android
paho.mqtt.android copied to clipboard
Android Paho client leaked intentReceiver issue
Please fill out the form below before submitting, thank you! Android API Version Bug Seen on:24
Android Version Bug Seen on: 7.0
I am using android service version 1.1.1 and mqtt client version 1.2.1.
Description of Bug:
I have created a sample mqtt android application in which i have implemented all methods of mqtt client like connect, disconnect, subscribe, unsubscribe.I have implemented manual auto reconnect which means that when a disconnection happens i am calling connect method after 500 ms.
I am getting leaked intentReceiver, only in MI devices after 3-4 min of connection. In Other devices it is happening, when mobile network is not stable due to which frequent connection and disconnection happens.
In my close implementation, i have followed these steps to close a connection: client.disconnect() //here client is MqttAndroidClient client.unregisterResources() client.setcallback(null) client.close() client =null
Console Log output (if available):
2019-03-19 15:04:21.774 10143-10488/com.eclipse.mqtt D/AlarmPingSender: Success. Release lock(MqttService.client.device_test):1552988061774
2019-03-19 15:04:51.757 10143-10143/com.eclipse.mqtt D/AlarmPingSender: Sending Ping at:1552988091757
2019-03-19 15:04:51.763 10143-10143/com.eclipse.mqtt D/AlarmPingSender: Schedule next alarm at 1552988121763
2019-03-19 15:04:51.763 10143-10143/com.eclipse.mqtt D/AlarmPingSender: Alarm scheule using setExactAndAllowWhileIdle, next: 30000
2019-03-19 15:04:51.894 10143-10488/com.eclipse.mqtt D/AlarmPingSender: Success. Release lock(MqttService.client.device_test):1552988091894
2019-03-19 15:04:56.438 10143-10143/com.eclipse.mqtt E/ActivityThread: Service org.eclipse.paho.android.service.MqttService has leaked IntentReceiver org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver@7107401 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Service org.eclipse.paho.android.service.MqttService has leaked IntentReceiver org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver@7107401 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.
i am facing the same error. did you get a fix yet?
Hi there I m facing the same issue on Android 10 , the below sequence reproduces it try { // unsubscribe here unsubscribe("testTopic"); mqttClient.unregisterResources(); mqttClient.close(); mqttClient.disconnect(); mqttClient.setCallback(null); mqttClient = null; } catch (MqttException e) { Timber.e( e.toString()); }
In the issue below it says it should work but still doesn't https://github.com/eclipse/paho.mqtt.android/issues/178
@knolleary @ralight @ranabdc do we have any workaround on this point?