Hongshun Wang created FLINK-40202:
-------------------------------------

             Summary: HybridSplitAssigner may initialize enumerator metrics 
concurrently with snapshot split assignment
                 Key: FLINK-40202
                 URL: https://issues.apache.org/jira/browse/FLINK-40202
             Project: Flink
          Issue Type: Bug
          Components: Flink CDC
    Affects Versions: cdc-3.5.0
            Reporter: Hongshun Wang
             Fix For: cdc-3.6.0


h3. Problem

{{The issue has been observed with the following exception:}}

 
{code:java}
java.util.ConcurrentModificationException: null
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1043) 
~[?:?]
    at java.util.ArrayList$Itr.next(ArrayList.java:997) ~[?:?]
    at 
org.apache.flink.cdc.connectors.base.source.assigner.SnapshotSplitAssigner.initEnumeratorMetrics(SnapshotSplitAssigner.java:305)
        
~[ververica-connector-sqlserver-1.20-vvr-11.7.0-4-jdk11-jar-with-dependencies.jar:1.20-vvr-11.7.0-4-jdk11]
 {code}
{{}}

 
h3. *Root Cause* 
h3. HybridSplitAssigner#open
{code:java}
snapshotSplitAssigner.open();
// init enumerator metrics
snapshotSplitAssigner.initEnumeratorMetrics(enumeratorMetrics); {code}
{{SnapshotSplitAssigner#open}}

 
{code:java}
chunkSplitter.open();
discoveryCaptureTables();
captureNewlyAddedTables();
startAsynchronouslySplit(); {code}
{{}}

 
 # `SnapshotSplitAssigner#open` starts asynchronous snapshot splitting via 
`startAsynchronouslySplit()`.
 #  enumerator metrics are initialized only after 
`snapshotSplitAssigner.open()` returns.
 # This leaves a race window where the background splitting thread can mutate 
split state while `initEnumeratorMetrics()` is traversing it.

In the observed failure, the concurrent modification happens while iterating an 
`ArrayList`, resulting in `ConcurrentModificationException`.
h3. {{}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to