HDFS-4017. Unclosed FileInputStream in GetJournalEditServlet. Contributed by Chao Shi.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-3077@1395727 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10a0eaaf0a
commit
70fc5cf01c
@ -84,3 +84,5 @@ HDFS-3955. QJM: Make acceptRecovery() atomic. (todd)
|
||||
HDFS-3956. QJM: purge temporary files when no longer within retention period (todd)
|
||||
|
||||
HDFS-4004. TestJournalNode#testJournal fails because of test case execution order (Chao Shi via todd)
|
||||
|
||||
HDFS-4017. Unclosed FileInputStream in GetJournalEditServlet (Chao Shi via todd)
|
||||
|
@ -46,6 +46,7 @@
|
||||
import org.apache.hadoop.hdfs.server.namenode.TransferFsImage;
|
||||
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
|
||||
import org.apache.hadoop.hdfs.util.DataTransferThrottler;
|
||||
import org.apache.hadoop.io.IOUtils;
|
||||
import org.apache.hadoop.security.SecurityUtil;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.util.ServletUtil;
|
||||
@ -157,6 +158,7 @@ private boolean checkStorageInfoOrSendError(JNStorage storage,
|
||||
@Override
|
||||
public void doGet(final HttpServletRequest request,
|
||||
final HttpServletResponse response) throws ServletException, IOException {
|
||||
FileInputStream editFileIn = null;
|
||||
try {
|
||||
final ServletContext context = getServletContext();
|
||||
final Configuration conf = (Configuration) getServletContext()
|
||||
@ -181,8 +183,7 @@ public void doGet(final HttpServletRequest request,
|
||||
|
||||
FileJournalManager fjm = storage.getJournalManager();
|
||||
File editFile;
|
||||
FileInputStream editFileIn;
|
||||
|
||||
|
||||
synchronized (fjm) {
|
||||
// Synchronize on the FJM so that the file doesn't get finalized
|
||||
// out from underneath us while we're in the process of opening
|
||||
@ -209,6 +210,8 @@ public void doGet(final HttpServletRequest request,
|
||||
String errMsg = "getedit failed. " + StringUtils.stringifyException(t);
|
||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errMsg);
|
||||
throw new IOException(errMsg);
|
||||
} finally {
|
||||
IOUtils.closeStream(editFileIn);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user