Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-1590

LogInterceptor is not thread-safe

    XMLWordPrintable

Details

    Description

      The LogInterceptor captures log events using an ArrayList<> which is not thread-safe. This can lead to

      java.util.ConcurrentModificationException
      	at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:939)
      	at java.base/java.util.ArrayList$Itr.next(ArrayList.java:893)
      	at io.debezium.junit.logging.LogInterceptor.containsMessage(LogInterceptor.java:85)
      	at io.debezium.junit.logging.LogInterceptor.containsWarnMessage(LogInterceptor.java:66)
      	at io.debezium.connector.postgresql.RecordsStreamProducerIT.lambda$shouldWarnOnMissingHeartbeatForFilteredEvents$23(RecordsStreamProducerIT.java:1076)
      	at org.awaitility.core.CallableCondition$ConditionEvaluationWrapper.eval(CallableCondition.java:100)
      	at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:201)
      	at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:188)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
      	at java.base/java.lang.Thread.run(Thread.java:844)
      

      We should probably change the behavior to using a CopyOnWriteArrayList.

      Attachments

        Activity

          People

            ccranfor@redhat.com Chris Cranford
            ccranfor@redhat.com Chris Cranford
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: