HDFS-9294. DFSClient deadlock when close file and failed to renew lease. Contributed by Brahma Reddy Battula
This commit is contained in:
parent
42a2bddcb7
commit
4123650e92
|
@ -123,6 +123,9 @@ Release 2.7.2 - UNRELEASED
|
||||||
HDFS-9426. Rollingupgrade finalization is not backward compatible
|
HDFS-9426. Rollingupgrade finalization is not backward compatible
|
||||||
(Kihwal Lee via vinayakumarb)
|
(Kihwal Lee via vinayakumarb)
|
||||||
|
|
||||||
|
HDFS-9294. DFSClient deadlock when close file and failed to renew lease.
|
||||||
|
(Brahma Reddy Battula via szetszwo)
|
||||||
|
|
||||||
Release 2.7.1 - 2015-07-06
|
Release 2.7.1 - 2015-07-06
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -2174,13 +2174,15 @@ public class DFSOutputStream extends FSOutputSummer
|
||||||
* Aborts this output stream and releases any system
|
* Aborts this output stream and releases any system
|
||||||
* resources associated with this stream.
|
* resources associated with this stream.
|
||||||
*/
|
*/
|
||||||
synchronized void abort() throws IOException {
|
void abort() throws IOException {
|
||||||
if (isClosed()) {
|
synchronized (this) {
|
||||||
return;
|
if (isClosed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
streamer.setLastException(new IOException("Lease timeout of "
|
||||||
|
+ (dfsClient.getHdfsTimeout() / 1000) + " seconds expired."));
|
||||||
|
closeThreads(true);
|
||||||
}
|
}
|
||||||
streamer.setLastException(new IOException("Lease timeout of "
|
|
||||||
+ (dfsClient.getHdfsTimeout()/1000) + " seconds expired."));
|
|
||||||
closeThreads(true);
|
|
||||||
dfsClient.endFileLease(fileId);
|
dfsClient.endFileLease(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2226,14 +2228,17 @@ public class DFSOutputStream extends FSOutputSummer
|
||||||
* resources associated with this stream.
|
* resources associated with this stream.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() throws IOException {
|
public void close() throws IOException {
|
||||||
TraceScope scope =
|
synchronized (this) {
|
||||||
dfsClient.getPathTraceScope("DFSOutputStream#close", src);
|
TraceScope scope = dfsClient.getPathTraceScope("DFSOutputStream#close",
|
||||||
try {
|
src);
|
||||||
closeImpl();
|
try {
|
||||||
} finally {
|
closeImpl();
|
||||||
scope.close();
|
} finally {
|
||||||
|
scope.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
dfsClient.endFileLease(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void closeImpl() throws IOException {
|
private synchronized void closeImpl() throws IOException {
|
||||||
|
@ -2268,7 +2273,6 @@ public class DFSOutputStream extends FSOutputSummer
|
||||||
} finally {
|
} finally {
|
||||||
scope.close();
|
scope.close();
|
||||||
}
|
}
|
||||||
dfsClient.endFileLease(fileId);
|
|
||||||
} catch (ClosedChannelException e) {
|
} catch (ClosedChannelException e) {
|
||||||
} finally {
|
} finally {
|
||||||
setClosed();
|
setClosed();
|
||||||
|
|
Loading…
Reference in New Issue