HADOOP-10404. Some accesses to DomainSocketWatcher#closed are not protected by the lock (cmccabe)
This commit is contained in:
parent
522b6505f4
commit
204148f0d4
|
@ -447,6 +447,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
HADOOP-11169. Fix DelegationTokenAuthenticatedURL to pass the connection
|
HADOOP-11169. Fix DelegationTokenAuthenticatedURL to pass the connection
|
||||||
Configurator to the authenticator. (Arun Suresh via wang)
|
Configurator to the authenticator. (Arun Suresh via wang)
|
||||||
|
|
||||||
|
HADOOP-10404. Some accesses to DomainSocketWatcher#closed are not protected
|
||||||
|
by lock (cmccabe)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
|
BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS
|
||||||
|
|
||||||
HADOOP-10734. Implement high-performance secure random number sources.
|
HADOOP-10734. Implement high-performance secure random number sources.
|
||||||
|
|
|
@ -101,6 +101,7 @@ public final class DomainSocketWatcher implements Closeable {
|
||||||
*/
|
*/
|
||||||
private class NotificationHandler implements Handler {
|
private class NotificationHandler implements Handler {
|
||||||
public boolean handle(DomainSocket sock) {
|
public boolean handle(DomainSocket sock) {
|
||||||
|
assert(lock.isHeldByCurrentThread());
|
||||||
try {
|
try {
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace(this + ": NotificationHandler: doing a read on " +
|
LOG.trace(this + ": NotificationHandler: doing a read on " +
|
||||||
|
@ -346,6 +347,7 @@ public final class DomainSocketWatcher implements Closeable {
|
||||||
* Wake up the DomainSocketWatcher thread.
|
* Wake up the DomainSocketWatcher thread.
|
||||||
*/
|
*/
|
||||||
private void kick() {
|
private void kick() {
|
||||||
|
assert(lock.isHeldByCurrentThread());
|
||||||
try {
|
try {
|
||||||
notificationSockets[0].getOutputStream().write(0);
|
notificationSockets[0].getOutputStream().write(0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -461,12 +463,17 @@ public final class DomainSocketWatcher implements Closeable {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error(toString() + " terminating on IOException", e);
|
LOG.error(toString() + " terminating on IOException", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
lock.lock();
|
||||||
|
try {
|
||||||
kick(); // allow the handler for notificationSockets[0] to read a byte
|
kick(); // allow the handler for notificationSockets[0] to read a byte
|
||||||
for (Entry entry : entries.values()) {
|
for (Entry entry : entries.values()) {
|
||||||
sendCallback("close", entries, fdSet, entry.getDomainSocket().fd);
|
sendCallback("close", entries, fdSet, entry.getDomainSocket().fd);
|
||||||
}
|
}
|
||||||
entries.clear();
|
entries.clear();
|
||||||
fdSet.close();
|
fdSet.close();
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue