You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Mukul Gupta (Jira)" <ji...@apache.org> on 2026/06/11 06:37:00 UTC

[jira] [Commented] (FLINK-39909) Heap state backend savepoint fails with NPE when MapState contains null values

    [ https://issues.apache.org/jira/browse/FLINK-39909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18088171#comment-18088171 ] 

Mukul Gupta commented on FLINK-39909:
-------------------------------------

I am already working on this, can someone please assign this Jira to me? 

[~fanrui] can you please review this i have able to reproduce this on my local.

> 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
>            Priority: Major
>
> 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)