java.util.ConcurrentModificationException

GitHub | anbarasuthresnathan | 2 months ago
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  2. 0

    In Spring Integration 2.0.0.M3 the following stacktrace sometimes happens when a message is handled by two threads and one is printing it. The cause is that the list under iterator that is returned in the MessageHistory.iterator() call can be modified by the other thread. {noformat} 10:49:54,222 [defaultPool-1] ERROR [org.springframework.integration.channel.MessagePublishingErrorHandler] - <failure occurred in messaging task> java.util.ConcurrentModificationException        at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)        at java.util.AbstractList$Itr.next(AbstractList.java:343)        at java.util.AbstractCollection.toString(AbstractCollection.java:421)        at org.springframework.integration.history.MessageHistory.toString(MessageHistory.java:86)        at java.lang.String.valueOf(String.java:2826)        at java.lang.StringBuilder.append(StringBuilder.java:115)        at java.util.AbstractMap.toString(AbstractMap.java:490)        at org.springframework.integration.core.MessageHeaders.toString(MessageHeaders.java:159)        at java.lang.String.valueOf(String.java:2826)        at java.lang.StringBuilder.append(StringBuilder.java:115)        at org.springframework.integration.message.GenericMessage.toString(GenericMessage.java:80)        at java.lang.String.valueOf(String.java:2826)        at java.lang.StringBuilder.append(StringBuilder.java:115)        at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.postReceive(AbstractMessageChannel.java:281)        at org.springframework.integration.channel.AbstractPollableChannel.receive(AbstractPollableChannel.java:57)        at org.springframework.integration.endpoint.PollingConsumer.doPoll(PollingConsumer.java:71)        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.innerPoll(AbstractPollingEndpoint.java:236)        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.poll(AbstractPollingEndpoint.java:220)        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.access$0(AbstractPollingEndpoint.java:217)        at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:208)        at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52)        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)        at java.lang.Thread.run(Thread.java:637) {noformat}

    Spring JIRA | 7 years ago | Jeroen van Erp
    java.util.ConcurrentModificationException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.ConcurrentModificationException

      No message provided

      at java.util.ArrayList$ArrayListIterator.next()
    2. Java RT
      AbstractCollection.toString
      1. java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
      2. java.util.AbstractCollection.toString(AbstractCollection.java:372)
      2 frames
    3. Android Platform
      JSONArray.toString
      1. org.json.JSONStringer.value(JSONStringer.java:252)
      2. org.json.JSONObject.writeTo(JSONObject.java:720)
      3. org.json.JSONStringer.value(JSONStringer.java:237)
      4. org.json.JSONObject.writeTo(JSONObject.java:720)
      5. org.json.JSONStringer.value(JSONStringer.java:237)
      6. org.json.JSONArray.writeTo(JSONArray.java:613)
      7. org.json.JSONArray.toString(JSONArray.java:585)
      7 frames
    4. Java RT
      StringBuilder.append
      1. java.lang.StringBuilder.append(StringBuilder.java:202)
      1 frame
    5. io.socket.parser
      Parser$Encoder.encode
      1. io.socket.parser.Parser$Encoder.encodeAsString(Parser.java:116)
      2. io.socket.parser.Parser$Encoder.encode(Parser.java:85)
      2 frames
    6. io.socket.client
      Socket$5.run
      1. io.socket.client.Manager.packet(Manager.java:461)
      2. io.socket.client.Socket.packet(Socket.java:264)
      3. io.socket.client.Socket.access$1100(Socket.java:19)
      4. io.socket.client.Socket$5.run(Socket.java:201)
      4 frames
    7. io.socket.thread
      EventThread$2.run
      1. io.socket.thread.EventThread$2.run(EventThread.java:75)
      1 frame
    8. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      3. java.lang.Thread.run(Thread.java:818)
      3 frames