maobaolong commented on a change in pull request #1228: URL: https://github.com/apache/hadoop-ozone/pull/1228#discussion_r458516884
########## File path: hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectEndpoint.java ########## @@ -562,13 +562,18 @@ private Response createMultipartKey(String bucket, String key, long length, OmMultipartCommitUploadPartInfo omMultipartCommitUploadPartInfo = ozoneOutputStream.getCommitUploadPartInfo(); - String eTag = omMultipartCommitUploadPartInfo.getPartName(); + if (omMultipartCommitUploadPartInfo != null) { Review comment: > Do we know why omMultipartCommitUploadPartInfo is null in this case As `IOUtils.closeQuietly(ozoneOutputStream)` called in the finally block of the method createMultipartKey, every IOException has been swallowed by the closeQuietly, so when closing ozoneOutputStream, maybe there are some exception occurred. And the close method of KeyOutputStream, we can see `blockOutputStreamEntryPool.commitKey` is called here. ```java public void close() throws IOException { if (closed) { return; } closed = true; try { handleFlushOrClose(StreamAction.CLOSE); if (!isException) { Preconditions.checkArgument(writeOffset == offset); } blockOutputStreamEntryPool.commitKey(offset); } finally { blockOutputStreamEntryPool.cleanup(); } } ``` Lets guess, if `commitMultipartUploadPart` failed with an IOException, `commitUploadPartInfo` would be `null`, so the NPE occurred. ```java void commitKey(long offset) throws IOException { if (keyArgs != null) { // in test, this could be null long length = getKeyLength(); Preconditions.checkArgument(offset == length); keyArgs.setDataSize(length); keyArgs.setLocationInfoList(getLocationInfoList()); // When the key is multipart upload part file upload, we should not // commit the key, as this is not an actual key, this is a just a // partial key of a large file. if (keyArgs.getIsMultipartKey()) { commitUploadPartInfo = omClient.commitMultipartUploadPart(keyArgs, openID); } else { omClient.commitKey(keyArgs, openID); } } else { LOG.warn("Closing KeyOutputStream, but key args is null"); } } ``` > we should return an proper s3 error code from there. Sorry, i'm not very familiar with S3, do you have any idea and suggestion about the return error type ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org