Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-2328

ConcurrentModificationException when closing JMS session

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • JBossAS-4.0.4.CR2
    • JBossAS-4.0.1 Final
    • JMS (JBossMQ)
    • None

    Description

      SpySession.java has a concurrency bug. Once in a while when closing it, I get the following exception:

      java.util.ConcurrentModificationException
      at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:449)
      at java.util.AbstractList$Itr.remove(AbstractList.java:434)
      at org.jboss.mq.SpySession.close(SpySession.java:461)
      at com.hmsonline.common.ejb.JMSUtil$4.callback(JMSUtil.java:104)
      at com.hmsonline.common.ejb.JMSUtil$7.run(JMSUtil.java:153)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)

      I stared at SpySession.java for a while trying to figure out how this could happen, because the close method makes a local copy of the producers Set. Then I noticed that 5 lines before the exception occurs, the iterator "i" gets reassigned:
      i = unacknowledgedMessages.iterator();
      and no copy is made of that list and it is not thread-safe.

      Attachments

        Activity

          People

            adrian.brock Adrian Brock (Inactive)
            javajedi_jira Tim McCune (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: