android - Paho MQTT AlarmPingSender wakelock stucked -
i using paho android service project (app name sealer). (link)
i've tested 22 hours , result has brought me strange result.
it seems app keeps awake cpu long time (~10,5 h).
i've searched in source code wakelock tag , found wakelock tag belongs alarmpingsender class. has met problem ever ?
i didn't modify android service source code, it's original.
i've attached screenshots (hangouts , viber comparison).
edit 1.
there code snippet source code:
mqttoptions = new mqttconnectoptions(); mqttoptions.setcleansession(false); // defaultkeepalive 240 mqttoptions.setkeepaliveinterval(constants.defaultkeepalive);
edit 2
i think relevant code android service source code:
/* * class sends pingreq packet mqtt broker */ class alarmreceiver extends broadcastreceiver { private wakelock wakelock; private string wakelocktag = mqttserviceconstants.ping_wakelock + that.comms.getclient().getclientid(); @override public void onreceive(context context, intent intent) { // according docs, "alarm manager holds cpu wake lock // long alarm receiver's onreceive() method executing. // guarantees phone not sleep until have // finished handling broadcast.", class still // wake lock wait ping finished. int count = intent.getintextra(intent.extra_alarm_count, -1); log.d(tag, "ping " + count + " times."); log.d(tag, "check time :" + system.currenttimemillis()); imqtttoken token = comms.checkforactivity(); // no ping has been sent. if (token == null) { return; } // assign new callback token execute code after pingresq // arrives. wakelock receiver has one, // release until ping response returns. if (wakelock == null) { powermanager pm = (powermanager) service .getsystemservice(service.power_service); wakelock = pm.newwakelock(powermanager.partial_wake_lock, wakelocktag); } wakelock.acquire(); token.setactioncallback(new imqttactionlistener() { @override public void onsuccess(imqtttoken asyncactiontoken) { log.d(tag, "success. release lock(" + wakelocktag + "):" + system.currenttimemillis()); //release wakelock when done. if(wakelock != null && wakelock.isheld()){ wakelock.release(); } } @override public void onfailure(imqtttoken asyncactiontoken, throwable exception) { log.d(tag, "failure. release lock(" + wakelocktag + "):" + system.currenttimemillis()); //release wakelock when done. if(wakelock != null && wakelock.isheld()){ wakelock.release(); } } }); } }
it seems (at least according screenshots) wakelock somehow 'stucked', doesn't released.
i have same problem , created bug report. please have further help: https://bugs.eclipse.org/bugs/show_bug.cgi?id=480134
Comments
Post a Comment