Sylwester Lachiewicz created FLINK-40136:
--------------------------------------------

             Summary: DynamicKafkaSourceEnumeratorTest flaky due to 
ConcurrentModificationException in metadata event polling
                 Key: FLINK-40136
                 URL: https://issues.apache.org/jira/browse/FLINK-40136
             Project: Flink
          Issue Type: Bug
            Reporter: Sylwester Lachiewicz


▎ hasLatestMetadataUpdateEvent() polls 
getLatestMetadataUpdateEventWithoutContextSync(), which reads 
MockSplitEnumeratorContext's internal sentSourceEvent list via reflection 
directly from the JUnit test thread, bypassing the context's single-threaded 
main executor. The enumerator's metadata discovery thread appends to that same 
list via sendEventToSourceReader() (correctly serialized through the main 
executor), so a test thread iterating the list via Stream.reduce() while that 
thread appends to it occasionally throws ConcurrentModificationException 
instead of the intended AssertionError "not ready yet" signal, causing 
intermittent test failures.

▎ Fix: catch ConcurrentModificationException alongside AssertionError in the 
CommonTestUtils.waitUtil(...) polling loop so it retries instead of failing the 
test.



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

Reply via email to