Mukul Gupta created FLINK-39909:
-----------------------------------
Summary: Heap state backend savepoint fails with NPE when MapState
contains null values
Key: FLINK-39909
URL: https://issues.apache.org/jira/browse/FLINK-39909
Project: Flink
Issue Type: Bug
Components: Runtime / Checkpointing, Runtime / State Backends
Reporter: Mukul Gupta
Found while investigating FLINK-38144.
HeapKeyValueStateIterator unconditionally calls
userValueSerializer.serialize(userValue, valueOut) after writing thenull flag,
causing NPE during canonical savepoint when MapState contains null values with
null-unsafe serializers (IntSerializer, LongSerializer, BooleanSerializer,
etc.).
Code path:
https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyValueStateIterator.java#365
Same asymmetric pattern fixed for RocksDB/ForSt in FLINK-38137. Only affects
canonical savepoints — heap checkpoints use MapSerializer.serialize() which
handles nulls internally.
Fix: skip serializer call when value is null (matching the deserialization side
which already checks the null flag).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)