Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Error in MqttService in android

Hi, it depends what you are trying to do here, what line of code is causing the exception to be thrown?
 
Kind regards,
 
James Sutton
Software Engineer - IoT Foundation - MQTT Open Source Projects
Technical Trojan - Wimbledon Project

Phone: 01962 815438 | Extension: x372454
E-mail: 
Personal Website: www.jsutton.co.uk
Find me on:      
IBM

Hursley Park
HursleySO212JN
United Kingdom
 
IBM United Kingdom Limited Registered in England and Wales with number 741598 Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU
 
 
----- Original message -----
From: Parth Pandya <parth0309@xxxxxxxxx>
Sent by: paho-dev-bounces@xxxxxxxxxxx
To: General development discussions for paho project <paho-dev@xxxxxxxxxxx>
Cc:
Subject: Re: [paho-dev] Error in MqttService in android
Date: Thu, Feb 18, 2016 2:26 PM
 
Hi James,
 
Thanks for the prompt response also there are couple of errors that I have found while using the Mqtt on Android,
 
One such instance is crashing the app stacktrace is below, this report is from one of our client's tester.
 
02-16 19:23:13.114  5925  5925 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'org.eclipse.paho.android.service.m org.eclipse.paho.android.service.MqttService.a(java.lang.String)' on a null object reference
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at co.haptik.sdk.mqtt.MqttSDKConnection$1.propertyChange(SourceFile:2485)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at co.haptik.sdk.mqtt.Connection.notifyListeners(SourceFile:99)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at co.haptik.sdk.mqtt.Connection.addAction(SourceFile:94)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at co.haptik.sdk.mqtt.ActionListener.connect(SourceFile:63)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at co.haptik.sdk.mqtt.ActionListener.onSuccess(SourceFile:43)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at org.eclipse.paho.android.service.u.a(SourceFile:124)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at org.eclipse.paho.android.service.MqttAndroidClient.a(SourceFile:1485)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at org.eclipse.paho.android.service.MqttAndroidClient.onReceive(SourceFile:2440)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at android.support.v4.content.i.a(SourceFile:1297)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at android.support.v4.content.j.handleMessage(SourceFile:116)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:145)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5944)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Method.java:372)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
02-16 19:23:13.114  5925  5925 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
 
I hope you can tell me what am I doing wrong or should I just handle the try catch here.
 
Thanks.
 
Cheers,
Parth Pandya
LinkedIn. http://lnkd.in/bDZQfw6
 
On Thu, Feb 18, 2016 at 6:50 PM, James Sutton1 <james.sutton@xxxxxxxxxx> wrote:
Hi,
 
That's interesting, It looks like the cause of the crash is due to the AlarmPingSender trying to release a lock that it does not hold any more. I'm not sure how your app got into this situation and I've never seen it happen myself, strange!
 
I think the solution is to change line 164 of AlarmPingSender (https://github.com/eclipse/paho.mqtt.java/blob/develop/org.eclipse.paho.android.service/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/AlarmPingSender.java#L164) to add a check to see if the wakelock is actually still being held.
 
 
if (token == null && wakelock.isHeld()) {
   wakelock.release();
}
I'll add this into our develop branch today once I've made sure that it doesn't upset anything else. Once I've done that, you'll be able to use an updated SNAPSHOT library tomorrow once the build has run.
 
Just to make sure, are you currently using a SNAPSHOT build? If not, it might be worth a try as the snapshots are currently quite far ahead of the master builds.
 
Kind regards,
 
James Sutton
Software Engineer - IoT Foundation - MQTT Open Source Projects
Technical Trojan - Wimbledon Project

Phone: 01962 815438 | Extension: x372454
E-mail: james.sutton@xxxxxxxxxx
Personal Website: www.jsutton.co.uk
Find me on:      
IBM

Hursley Park
HursleySO212JN
United Kingdom
 
IBM United Kingdom Limited Registered in England and Wales with number 741598 Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU
 
 
----- Original message -----
From: Parth Pandya <parth0309@xxxxxxxxx>
Sent by: paho-dev-bounces@xxxxxxxxxxx
To: General development discussions for paho project <paho-dev@xxxxxxxxxxx>
Cc:
Subject: [paho-dev] Error in MqttService in android
Date: Thu, Feb 18, 2016 9:17 AM
 
Hey Guys,
 
My app keeps on crashing on one particular instance when I tried to run the mqttservice in background.
 
02-18 14:39:38.515 12580-12580/co.haptik.alpha E/AndroidRuntime: FATAL EXCEPTION: main
                                                                 Process: co.haptik.alpha, PID: 12580
                                                                 java.lang.RuntimeException: Error receiving broadcast Intent { act=MqttService.pingSender.user@test14909-staging flg=0x14 (has extras) } in org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver@37178ea7
                                                                     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:998)
                                                                     at android.os.Handler.handleCallback(Handler.java:739)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                     at android.os.Looper.loop(Looper.java:145)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:6912)
                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                     at java.lang.reflect.Method.invoke(Method.java:372)
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
                                                                  Caused by: java.lang.RuntimeException: WakeLock under-locked MqttService.client.user@test14909-staging
                                                                     at android.os.PowerManager$WakeLock.release(PowerManager.java:1642)
                                                                     at android.os.PowerManager$WakeLock.release(PowerManager.java:1613)
                                                                     at org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver.onReceive(AlarmPingSender.java:165)
                                                                     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:988)
                                                                     at android.os.Handler.handleCallback(Handler.java:739) 
                                                                     at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                     at android.os.Looper.loop(Looper.java:145) 
                                                                     at android.app.ActivityThread.main(ActivityThread.java:6912) 
                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                     at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
 
Any help would be great, thanks
 
Cheers,
Parth Pandya
LinkedIn. http://lnkd.in/bDZQfw6
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev
 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


Back to the top