HDFS-10688. BPServiceActor may run into a tight loop for sending block report when hitting IOException. Contributed by Chen Liang.

This commit is contained in:
Jing Zhao 2016-07-25 18:41:13 -07:00
parent d383bfdcd4
commit 0cde9e12a7

View File

@ -649,19 +649,24 @@ private void offerService() throws Exception {
return; return;
} }
LOG.warn("RemoteException in offerService", re); LOG.warn("RemoteException in offerService", re);
try { sleepAfterException();
long sleepTime = Math.min(1000, dnConf.heartBeatInterval);
Thread.sleep(sleepTime);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
} catch (IOException e) { } catch (IOException e) {
LOG.warn("IOException in offerService", e); LOG.warn("IOException in offerService", e);
sleepAfterException();
} }
processQueueMessages(); processQueueMessages();
} // while (shouldRun()) } // while (shouldRun())
} // offerService } // offerService
private void sleepAfterException() {
try {
long sleepTime = Math.min(1000, dnConf.heartBeatInterval);
Thread.sleep(sleepTime);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
/** /**
* Register one bp with the corresponding NameNode * Register one bp with the corresponding NameNode
* <p> * <p>