[
https://issues.apache.org/jira/browse/KAFKA-20922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104176#comment-18104176
]
Matthias J. Sax edited comment on KAFKA-20922 at 8/12/26 8:00 PM:
------------------------------------------------------------------
It seems, this is not something we could hit in production atm though –
`valueTimestampHeaders` should never be null at this place? The existing guards
in window-store and session-store and fails safes only. Update the ticket from
"bug" to "improvement" to reflect this. Please let me know if I am wrong.
No objection to add the same guards, but it's not something we need to worry
about for AK 4.4 release.
Btw, it seems there is two more places we should update, too:
* MeteredTimestampedKeyValueStoreWithHeadersQueryIterator.next() (line
694-695) — backs RangeQuery/TimestampedRangeQuery.
* MeteredTimestampedKeyValueStoreWithHeadersIterator.next() (line 801-802) —
backs the plain (non-IQv2) range()/all()/reverseRange()/reverseAll().
was (Author: mjsax):
It seems, this is not something we could hit in production atm though –
`valueTimestampHeaders` should never be null at this place? The existing guards
in window-store and session-store and fails safes only.
No objection to add the same guards, but it's not something we need to worry
about for AK 4.4 release.
Btw, it seems there is two more places we should update, too:
* MeteredTimestampedKeyValueStoreWithHeadersQueryIterator.next() (line
694-695) — backs RangeQuery/TimestampedRangeQuery.
* MeteredTimestampedKeyValueStoreWithHeadersIterator.next() (line 801-802) —
backs the plain (non-IQv2) range()/all()/reverseRange()/reverseAll().
> TimestampedRangeWithHeadersQuery iterator can NPE on a null-deserialized
> value (KV path missing the null guard the window path has)
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-20922
> URL: https://issues.apache.org/jira/browse/KAFKA-20922
> Project: Kafka
> Issue Type: Improvement
> Components: streams
> Affects Versions: 4.4.0
> Reporter: Jess Jin
> Priority: Minor
>
> MeteredTimestampedKeyValueStoreWithHeadersReadOnlyRecordIterator.next()
> (backing TimestampedRangeWithHeadersQuery) dereferences a possibly-null
> ValueTimestampHeaders:
> {code:java}
> final ValueTimestampHeaders<V> valueTimestampHeaders =
> valueTimestampHeadersDeserializer.apply(keyValue.value);
> final Headers headers = valueTimestampHeaders.headers(); // NPE if
> valueTimestampHeaders == null
> {code}
> ValueTimestampHeaders.make() returns null whenever the value deserializes to
> null, so valueTimestampHeaders can be null and .headers() throws a bare
> NullPointerException.
> The window-store path
> (MeteredWindowStoreWithHeadersReadOnlyRecordIterator.next()) already guards
> this and throws a StreamsException naming the key instead. The KV path should
> mirror that guard.
> Found during review of PR #22975:
> [https://github.com/apache/kafka/pull/22975#discussion_r3738681473]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)