You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "cchung100m (via GitHub)" <gi...@apache.org> on 2026/10/07 10:01:56 UTC
[PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
cchung100m opened a new pull request, #11435:
URL: https://github.com/apache/ozone/pull/11435
## What changes were proposed in this pull request?
TBD
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16751
## How was this patch tested?
Existing unit and integration tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "cchung100m (via GitHub)" <gi...@apache.org>.
cchung100m commented on code in PR #11435:
URL: https://github.com/apache/ozone/pull/11435#discussion_r4226444262
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java:
##########
@@ -104,10 +105,17 @@ private static List<BlockExtendedInputStream> createStreams(
return partStreams;
}
- private static BlockLocationInfo getBlockLocationInfo(OmKeyInfo newKeyInfo,
+ @VisibleForTesting
Review Comment:
Thanks, I’ll remove the @VisibleForTesting annotation. I’m keeping the method package-private so the unit test in the same package can call it directly. If you’d prefer that I leave the method private and test it through getFromOmKeyInfo with a method BlockInputStreamFactory, I can switch to that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NPE in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "cchung100m (via GitHub)" <gi...@apache.org>.
cchung100m commented on PR #11435:
URL: https://github.com/apache/ozone/pull/11435#issuecomment-6358431647
HI @peterxcli
Thanks for the suggestion and the diff! I agree that the null check was only needed because the retry function `RpcClient` swallowed the `IOException` and returned null, so I've applied your refactor:
- Changed the retry function type from `Function<OmKeyInfo, OmKeyInfo>` to `CheckedFunction<OmKeyInfo, OmKeyInfo, IOException>` in `KeyInputStream`, `RpcClient`, and `TestBlockTokens`.
- Moved the `IOException` catch and error log into the retry lambda in `KeyInputStream#createSteams`. It still returns null on a failed lookup, which `BlockExtenedInputStrem#refreshBlockInfo` already handles.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on PR #11435:
URL: https://github.com/apache/ozone/pull/11435#issuecomment-6041911499
I'd add extra unit tests to cover new branches
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "cchung100m (via GitHub)" <gi...@apache.org>.
cchung100m commented on PR #11435:
URL: https://github.com/apache/ozone/pull/11435#issuecomment-6055238249
cc @adoroszlai @peterxcli
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NPE in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on PR #11435:
URL: https://github.com/apache/ozone/pull/11435#issuecomment-6385771492
Thanks @cchung100m @cchung100m @adoroszlai
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NPE in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli merged PR #11435:
URL: https://github.com/apache/ozone/pull/11435
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "cchung100m (via GitHub)" <gi...@apache.org>.
cchung100m commented on PR #11435:
URL: https://github.com/apache/ozone/pull/11435#issuecomment-6075677501
Hi @peterxcli
Thanks for the suggestions. I looked into this and could not find a local refactor that removes the checks without changing a contract. The two `null`s come from existing behavior:
1. `newKeyInfo == null`: the retry function in `RpcClient#getInputStreamWithRetryFunction` catches `IOException` and returns `null`, and `BlockExtendedInputStream#refreshBlockInfo` already treats a `null` result as "no new location, warn and keep retrying".
2. `getLatestVersionLocations() == null`: `OmKeyInfo` returns `null` when `keyLocationVersions` is empty, and several callers check for it (for example, `ChunkKeyHandler`, `OMMultipartUploadUtils`, `SnapshotUtils`, `KeyManagerImpl#slimLocationVersion`).
Returning an empty group instead of `null` would change the contract for many callers. In particular, `OmKeyInfo#updateLocationInfoList` calls `setMultipartKey(...)` on the returned group, and several callers read `getVersion()`, so an empty placeholder could silently hide an update that today fails loudly. Making the retry function throw instead of returning `null` would change the read behavior from warn-and-retry to failing the read.
So I kept the guard in `getBlockLocationInfo`, which is where the existing "nullable refresh result" contract applies. If you think a non-null `getLatestVersionLocations()` is worth pursuing, I'm happy to file a separate Jira for it. Please let me know if I missed a simpler approach.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #11435:
URL: https://github.com/apache/ozone/pull/11435#discussion_r4220758901
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyInputStream.java:
##########
@@ -104,10 +105,17 @@ private static List<BlockExtendedInputStream> createStreams(
return partStreams;
}
- private static BlockLocationInfo getBlockLocationInfo(OmKeyInfo newKeyInfo,
+ @VisibleForTesting
Review Comment:
I think we no longer suggest adding `@VisibleForTesting`, but I forgot the actual reason. at least getter is harmless
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh [ozone]
Posted by "cchung100m (via GitHub)" <gi...@apache.org>.
cchung100m commented on PR #11435:
URL: https://github.com/apache/ozone/pull/11435#issuecomment-6053014520
Hi @yandrey321
Thanks for the reminder. I updated the part you mentioned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org