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-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-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.SecondaryNameNode;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.TransferFsImage;
|
import org.apache.hadoop.hdfs.server.namenode.TransferFsImage;
|
||||||
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
|
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
|
||||||
import org.apache.hadoop.hdfs.util.DataTransferThrottler;
|
import org.apache.hadoop.hdfs.util.DataTransferThrottler;
|
||||||
|
import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.util.ServletUtil;
|
import org.apache.hadoop.util.ServletUtil;
|
||||||
|
@ -157,6 +158,7 @@ public class GetJournalEditServlet extends HttpServlet {
|
||||||
@Override
|
@Override
|
||||||
public void doGet(final HttpServletRequest request,
|
public void doGet(final HttpServletRequest request,
|
||||||
final HttpServletResponse response) throws ServletException, IOException {
|
final HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
FileInputStream editFileIn = null;
|
||||||
try {
|
try {
|
||||||
final ServletContext context = getServletContext();
|
final ServletContext context = getServletContext();
|
||||||
final Configuration conf = (Configuration) getServletContext()
|
final Configuration conf = (Configuration) getServletContext()
|
||||||
|
@ -181,7 +183,6 @@ public class GetJournalEditServlet extends HttpServlet {
|
||||||
|
|
||||||
FileJournalManager fjm = storage.getJournalManager();
|
FileJournalManager fjm = storage.getJournalManager();
|
||||||
File editFile;
|
File editFile;
|
||||||
FileInputStream editFileIn;
|
|
||||||
|
|
||||||
synchronized (fjm) {
|
synchronized (fjm) {
|
||||||
// Synchronize on the FJM so that the file doesn't get finalized
|
// Synchronize on the FJM so that the file doesn't get finalized
|
||||||
|
@ -209,6 +210,8 @@ public class GetJournalEditServlet extends HttpServlet {
|
||||||
String errMsg = "getedit failed. " + StringUtils.stringifyException(t);
|
String errMsg = "getedit failed. " + StringUtils.stringifyException(t);
|
||||||
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errMsg);
|
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errMsg);
|
||||||
throw new IOException(errMsg);
|
throw new IOException(errMsg);
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeStream(editFileIn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue