java.util.ConcurrentModificationException in ServerPingWithAlarmManager

Hi,

Occasionally we get this exception on Android using Smack 4.1.1:

java.lang.RuntimeException: Error receiving broadcast Intent { act=org.igniterealtime.smackx.ping.ACTION flg=0x14 (has extras) } in org.jivesoftware.smackx.ping.android.ServerPingWithAlarmManager$2@42851e18

at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:799)

at android.os.Handler.handleCallback(Handler.java:808)

at android.os.Handler.dispatchMessage(Handler.java:103)

at android.os.Looper.loop(Looper.java:193)

at android.app.ActivityThread.main(ActivityThread.java:5348)

at java.lang.reflect.Method.invokeNative(Method.java)

at java.lang.reflect.Method.invoke(Method.java:515)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)

at dalvik.system.NativeStart.main(NativeStart.java)

Caused by: java.util.ConcurrentModificationException

at java.util.WeakHashMap$HashIterator.next(WeakHashMap.java:165)

at org.jivesoftware.smackx.ping.android.ServerPingWithAlarmManager$2.onReceive(Ser verPingWithAlarmManager.java:116)

at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:789)

at android.os.Handler.handleCallback(Handler.java:808)

at android.os.Handler.dispatchMessage(Handler.java:103)

at android.os.Looper.loop(Looper.java:193)

at android.app.ActivityThread.main(ActivityThread.java:5348)

at java.lang.reflect.Method.invokeNative(Method.java)

at java.lang.reflect.Method.invoke(Method.java:515)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)

at dalvik.system.NativeStart.main(NativeStart.java)

Thanks for reporting. SMACK-676. I’ve uploaded 4.1.2-SNAPSHOT with a fix for the issue. Could you test and report back if it resolves the issue for you?

Hi Flo,

Thanks for your rapid response. I can release the SNAPSHOT in our beta group and see if it comes back.

I cannot find the snapshot release in the downloads page. Could you please provide me with a link or make it available via Maven?

Thanks,
Andrej

See igniterealtime/Smack · GitHub

you basically have to configure Maven Central’s Snapshot repository in order to fetch the snapshot.

Thanks, I will get back to you in a couple of weeks to share the results.

Thanks, I will get back to you in a couple of weeks to share the results.
I plan to release 4.1.2 within the next few days. So it’s sufficient if you report back that it still works, since I’m pretty sure that a ConcurrentModificaitonException can’t happen here again.

Hi, I will check if the ping alarm broadcaster receiver is executed overnight and let you know next morning.

Cheers,
Andrej

The broadcast receiver is executed as expected!

Thanks,
Andrej