Skip to content

Commit 794ee75

Browse files
committed
HDFS-15957. The ignored IOException in the RPC response sent by FSEditLogAsync can cause the HDFS client to hang
1 parent bf66116 commit 794ee75

File tree

1 file changed

+14
-6
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode

1 file changed

+14
-6
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogAsync.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class FSEditLogAsync extends FSEditLog implements Runnable {
4747
private Thread syncThread;
4848
private static final ThreadLocal<Edit> THREAD_EDIT = new ThreadLocal<Edit>();
4949

50+
// number of retry times for sending edit log sync response.
51+
private static final int RESPONSE_SEND_RETRIES = 3;
52+
5053
// requires concurrent access from caller threads and syncing thread.
5154
private final BlockingQueue<Edit> editPendingQ;
5255

@@ -378,13 +381,18 @@ public void logSyncWait() {
378381

379382
@Override
380383
public void logSyncNotify(RuntimeException syncEx) {
381-
try {
382-
if (syncEx == null) {
383-
call.sendResponse();
384-
} else {
385-
call.abortResponse(syncEx);
384+
for (int retries = 0; retries <= RESPONSE_SEND_RETRIES; retries++) {
385+
try {
386+
if (syncEx == null) {
387+
call.sendResponse();
388+
} else {
389+
call.abortResponse(syncEx);
390+
}
391+
break;
392+
} catch (Exception e) {
393+
LOG.info("Error in sending log sync response, retry " + retries, e);
386394
}
387-
} catch (Exception e) {} // don't care if not sent.
395+
}
388396
}
389397

390398
@Override

0 commit comments

Comments
 (0)