HDFS-14287. DataXceiverServer May Double-Close PeerServer. Contributed by BELUGA BEHR.
This commit is contained in:
parent
920a89627d
commit
235e3da90a
@ -244,12 +244,17 @@ public void run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the server to stop reception of more requests.
|
// Close the server to stop reception of more requests.
|
||||||
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
peerServer.close();
|
if (!closed) {
|
||||||
closed = true;
|
peerServer.close();
|
||||||
|
closed = true;
|
||||||
|
}
|
||||||
} catch (IOException ie) {
|
} catch (IOException ie) {
|
||||||
LOG.warn("{}:DataXceiverServer: close exception",
|
LOG.warn("{}:DataXceiverServer: close exception",
|
||||||
datanode.getDisplayName(), ie);
|
datanode.getDisplayName(), ie);
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if in restart prep stage, notify peers before closing them.
|
// if in restart prep stage, notify peers before closing them.
|
||||||
@ -270,11 +275,16 @@ void kill() {
|
|||||||
assert (datanode.shouldRun == false || datanode.shutdownForUpgrade) :
|
assert (datanode.shouldRun == false || datanode.shutdownForUpgrade) :
|
||||||
"shoudRun should be set to false or restarting should be true"
|
"shoudRun should be set to false or restarting should be true"
|
||||||
+ " before killing";
|
+ " before killing";
|
||||||
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
this.peerServer.close();
|
if (!closed) {
|
||||||
this.closed = true;
|
peerServer.close();
|
||||||
|
closed = true;
|
||||||
|
}
|
||||||
} catch (IOException ie) {
|
} catch (IOException ie) {
|
||||||
LOG.warn("{}:DataXceiverServer.kill()", datanode.getDisplayName(), ie);
|
LOG.warn("{}:DataXceiverServer.kill()", datanode.getDisplayName(), ie);
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user