[
https://issues.apache.org/jira/browse/HDFS-16738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17584308#comment-17584308
]
ASF GitHub Bot commented on HDFS-16738:
---------------------------------------
ayushtkn commented on code in PR #4791:
URL: https://github.com/apache/hadoop/pull/4791#discussion_r953918255
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java:
##########
@@ -541,19 +541,23 @@ public static String parseSpecialValue(String content,
String key) {
* @return The actual client's machine.
*/
public static String getClientMachine(final String[] ipProxyUsers) {
+ String clientMachine = null;
String cc = clientInfoFromContext(ipProxyUsers);
if (cc != null) {
// if the rpc has a caller context of "clientIp:1.2.3.4,CLI",
// return "1.2.3.4" as the client machine.
String key = CallerContext.CLIENT_IP_STR +
CallerContext.Builder.KEY_VALUE_SEPARATOR;
- return parseSpecialValue(cc, key);
+ clientMachine = parseSpecialValue(cc, key);
}
- String clientMachine = Server.getRemoteAddress();
- if (clientMachine == null) { //not a RPC client
- clientMachine = "";
+ if (clientMachine == null) {
+ clientMachine = Server.getRemoteAddress();
+ if (clientMachine == null) { //not a RPC client
+ clientMachine = "";
+ }
}
+
Review Comment:
nit: unnecessary change
> Invalid CallerContext caused NullPointerException
> -------------------------------------------------
>
> Key: HDFS-16738
> URL: https://issues.apache.org/jira/browse/HDFS-16738
> Project: Hadoop HDFS
> Issue Type: Bug
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Critical
> Labels: pull-request-available
>
> {code:java}
> 2022-08-23 11:58:03,258 [FSEditLogAsync] ERROR namenode.FSEditLog
> (JournalSet.java:mapJournalsAndReportErrors(398)) - Error: write op failed
> for required journal (JournalAndStream(mgr=QJM to [127.0.0.1:55779,
> 127.0.0.1:55781, 127.0.0.1:55783], stream=QuorumOutputStream starting at txid
> 1))
> java.lang.NullPointerException
> at org.apache.hadoop.io.UTF8.set(UTF8.java:97)
> at
> org.apache.hadoop.hdfs.server.namenode.FSImageSerialization.writeString(FSImageSerialization.java:361)
> at
> org.apache.hadoop.hdfs.server.namenode.FSEditLogOp$AddCloseOp.writeFields(FSEditLogOp.java:586)
> at
> org.apache.hadoop.hdfs.server.namenode.FSEditLogOp$Writer.writeOp(FSEditLogOp.java:4986)
> at
> org.apache.hadoop.hdfs.server.namenode.EditsDoubleBuffer$TxnBuffer.writeOp(EditsDoubleBuffer.java:158)
> at
> org.apache.hadoop.hdfs.server.namenode.EditsDoubleBuffer.writeOp(EditsDoubleBuffer.java:61)
> at
> org.apache.hadoop.hdfs.qjournal.client.QuorumOutputStream.write(QuorumOutputStream.java:50)
> at
> org.apache.hadoop.hdfs.server.namenode.JournalSet$JournalSetOutputStream$1.apply(JournalSet.java:462)
> at
> org.apache.hadoop.hdfs.server.namenode.JournalSet.mapJournalsAndReportErrors(JournalSet.java:393)
> at
> org.apache.hadoop.hdfs.server.namenode.JournalSet.access$200(JournalSet.java:56)
> at
> org.apache.hadoop.hdfs.server.namenode.JournalSet$JournalSetOutputStream.write(JournalSet.java:458)
> at
> org.apache.hadoop.hdfs.server.namenode.FSEditLog.doEditTransaction(FSEditLog.java:496)
> at
> org.apache.hadoop.hdfs.server.namenode.FSEditLogAsync$Edit.logEdit(FSEditLogAsync.java:311)
> at
> org.apache.hadoop.hdfs.server.namenode.FSEditLogAsync.run(FSEditLogAsync.java:253)
> at java.lang.Thread.run(Thread.java:748)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]