HDFS-9294. DFSClient deadlock when close file and failed to renew lease. Contributed by Brahma Reddy Battula
This commit is contained in:
parent
6b9a5beb2b
commit
e8bd1ba74b
@ -708,13 +708,17 @@ protected synchronized void start() {
|
|||||||
* 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;
|
||||||
|
}
|
||||||
|
getStreamer().getLastException().set(
|
||||||
|
new IOException("Lease timeout of "
|
||||||
|
+ (dfsClient.getConf().getHdfsTimeout() / 1000)
|
||||||
|
+ " seconds expired."));
|
||||||
|
closeThreads(true);
|
||||||
}
|
}
|
||||||
getStreamer().getLastException().set(new IOException("Lease timeout of "
|
|
||||||
+ (dfsClient.getConf().getHdfsTimeout() / 1000) + " seconds expired."));
|
|
||||||
closeThreads(true);
|
|
||||||
dfsClient.endFileLease(fileId);
|
dfsClient.endFileLease(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,11 +751,14 @@ protected void closeThreads(boolean force) throws IOException {
|
|||||||
* resources associated with this stream.
|
* resources associated with this stream.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() throws IOException {
|
public void close() throws IOException {
|
||||||
try (TraceScope ignored =
|
synchronized (this) {
|
||||||
dfsClient.newPathTraceScope("DFSOutputStream#close", src)) {
|
try (TraceScope ignored = dfsClient.newPathTraceScope(
|
||||||
closeImpl();
|
"DFSOutputStream#close", src)) {
|
||||||
|
closeImpl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
dfsClient.endFileLease(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void closeImpl() throws IOException {
|
protected synchronized void closeImpl() throws IOException {
|
||||||
@ -779,7 +786,6 @@ protected synchronized void closeImpl() throws IOException {
|
|||||||
dfsClient.getTracer().newScope("completeFile")) {
|
dfsClient.getTracer().newScope("completeFile")) {
|
||||||
completeFile(lastBlock);
|
completeFile(lastBlock);
|
||||||
}
|
}
|
||||||
dfsClient.endFileLease(fileId);
|
|
||||||
} catch (ClosedChannelException ignored) {
|
} catch (ClosedChannelException ignored) {
|
||||||
} finally {
|
} finally {
|
||||||
setClosed();
|
setClosed();
|
||||||
|
@ -757,16 +757,19 @@ protected synchronized void start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
synchronized void abort() throws IOException {
|
void abort() throws IOException {
|
||||||
if (isClosed()) {
|
synchronized (this) {
|
||||||
return;
|
if (isClosed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (StripedDataStreamer streamer : streamers) {
|
||||||
|
streamer.getLastException().set(
|
||||||
|
new IOException("Lease timeout of "
|
||||||
|
+ (dfsClient.getConf().getHdfsTimeout() / 1000)
|
||||||
|
+ " seconds expired."));
|
||||||
|
}
|
||||||
|
closeThreads(true);
|
||||||
}
|
}
|
||||||
for (StripedDataStreamer streamer : streamers) {
|
|
||||||
streamer.getLastException().set(new IOException("Lease timeout of "
|
|
||||||
+ (dfsClient.getConf().getHdfsTimeout()/1000) +
|
|
||||||
" seconds expired."));
|
|
||||||
}
|
|
||||||
closeThreads(true);
|
|
||||||
dfsClient.endFileLease(fileId);
|
dfsClient.endFileLease(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +957,6 @@ protected synchronized void closeImpl() throws IOException {
|
|||||||
dfsClient.getTracer().newScope("completeFile")) {
|
dfsClient.getTracer().newScope("completeFile")) {
|
||||||
completeFile(currentBlockGroup);
|
completeFile(currentBlockGroup);
|
||||||
}
|
}
|
||||||
dfsClient.endFileLease(fileId);
|
|
||||||
} catch (ClosedChannelException ignored) {
|
} catch (ClosedChannelException ignored) {
|
||||||
} finally {
|
} finally {
|
||||||
setClosed();
|
setClosed();
|
||||||
|
@ -2535,6 +2535,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
|
||||||
|
Loading…
Reference in New Issue
Block a user