4 Replies Latest reply on Feb 16, 2017 2:07 AM by daniele_athome

    Concurrency issue in ping failed listeners set

    daniele_athome

      Hello devs,

      I believe there is a race condition when iterating over pingFailedListeners in PingManager:

       

      java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:788)
        at java.util.HashMap$KeyIterator.next(HashMap.java:815)
        at org.jivesoftware.smackx.ping.PingManager.pingMyServer(PingManager.java:252)
        at org.kontalk.service.msgcenter.MessageCenterService$3.run(MessageCenterService.java:1114)
        at java.lang.Thread.run(Thread.java:818)

       

      It's a synchronized set and that's ok, but access to it should be synchronized manually (source: Collections (Java Platform SE 7 ))

       

      For reference: Smack concurrency issue for ping failed listener · Issue #955 · kontalk/androidclient · GitHub

       

      Best