You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Martijn Visser (Jira)" <ji...@apache.org> on 2026/09/19 15:47:00 UTC

[jira] [Updated] (FLINK-40136) DynamicKafkaSourceEnumeratorTest flaky due to ConcurrentModificationException in metadata event polling

     [ https://issues.apache.org/jira/browse/FLINK-40136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martijn Visser updated FLINK-40136:
-----------------------------------
    Affects Version/s: kafka-5.1.0

> 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
>          Components: Connectors / Kafka
>    Affects Versions: kafka-5.1.0
>            Reporter: Sylwester Lachiewicz
>            Priority: Minor
>              Labels: pull-request-available, test-stability
>
> ▎ 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)