Martijn Visser created FLINK-41685:
--------------------------------------
Summary: CoordinatorStoreImpl#apply reads mutable store values
without synchronization
Key: FLINK-41685
URL: https://issues.apache.org/jira/browse/FLINK-41685
Project: Flink
Issue Type: Bug
Components: Runtime / Coordination
Reporter: Martijn Visser
As a follow-up of FLINK-40505, {{CoordinatorStoreImpl#apply}} invokes its
consumer on {{store.get(key)}} without holding the lock used by {{compute}} and
{{computeIfPresent}}, even though {{CoordinatorStore}} documents that all
operations must be atomic.
With multiple sources sharing a watermark alignment group, one
coordinator's {{announceCombinedWatermark}} reads the non-thread-safe
{{WatermarkAggregator}} heap via
{{apply}} while another coordinator mutates it via {{computeIfPresent}}. A
concurrent read can observe a half-updated heap and announce a wrong bound
(including
{{Long.MIN_VALUE + drift}}).
We should execute {{CoordinatorStoreImpl#apply}} inside
{{ConcurrentHashMap#compute}}, document on {{CoordinatorStore#apply}} that the
consumer must not re-enter the store,
and add a concurrent unit test.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)