HADOOP-11333. Fix deadlock in DomainSocketWatcher when the notification pipe is full (zhaoyunjiong via cmccabe)
This commit is contained in:
parent
c732ed760e
commit
86e3993def
|
@ -473,6 +473,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HADOOP-11300. KMS startup scripts must not display the keystore /
|
HADOOP-11300. KMS startup scripts must not display the keystore /
|
||||||
truststore passwords. (Arun Suresh via wang)
|
truststore passwords. (Arun Suresh via wang)
|
||||||
|
|
||||||
|
HADOOP-11333. Fix deadlock in DomainSocketWatcher when the notification
|
||||||
|
pipe is full (zhaoyunjiong via cmccabe)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-18
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -103,6 +103,7 @@ public final class DomainSocketWatcher implements Closeable {
|
||||||
public boolean handle(DomainSocket sock) {
|
public boolean handle(DomainSocket sock) {
|
||||||
assert(lock.isHeldByCurrentThread());
|
assert(lock.isHeldByCurrentThread());
|
||||||
try {
|
try {
|
||||||
|
kicked = false;
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace(this + ": NotificationHandler: doing a read on " +
|
LOG.trace(this + ": NotificationHandler: doing a read on " +
|
||||||
sock.fd);
|
sock.fd);
|
||||||
|
@ -229,6 +230,14 @@ public final class DomainSocketWatcher implements Closeable {
|
||||||
*/
|
*/
|
||||||
private boolean closed = false;
|
private boolean closed = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if we have written a byte to the notification socket. We should not
|
||||||
|
* write anything else to the socket until the notification handler has had a
|
||||||
|
* chance to run. Otherwise, our thread might block, causing deadlock.
|
||||||
|
* See HADOOP-11333 for details.
|
||||||
|
*/
|
||||||
|
private boolean kicked = false;
|
||||||
|
|
||||||
public DomainSocketWatcher(int interruptCheckPeriodMs) throws IOException {
|
public DomainSocketWatcher(int interruptCheckPeriodMs) throws IOException {
|
||||||
if (loadingFailureReason != null) {
|
if (loadingFailureReason != null) {
|
||||||
throw new UnsupportedOperationException(loadingFailureReason);
|
throw new UnsupportedOperationException(loadingFailureReason);
|
||||||
|
@ -348,8 +357,14 @@ public final class DomainSocketWatcher implements Closeable {
|
||||||
*/
|
*/
|
||||||
private void kick() {
|
private void kick() {
|
||||||
assert(lock.isHeldByCurrentThread());
|
assert(lock.isHeldByCurrentThread());
|
||||||
|
|
||||||
|
if (kicked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
notificationSockets[0].getOutputStream().write(0);
|
notificationSockets[0].getOutputStream().write(0);
|
||||||
|
kicked = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
LOG.error(this + ": error writing to notificationSockets[0]", e);
|
LOG.error(this + ": error writing to notificationSockets[0]", e);
|
||||||
|
|
Loading…
Reference in New Issue