don't through fail to send exception on a the generic thread - it may be shut down already and will an exception
This commit is contained in:
parent
335379046a
commit
76465ec37a
|
@ -52,7 +52,6 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
||||||
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
|
||||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
|
||||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||||
import org.elasticsearch.index.IndexService;
|
import org.elasticsearch.index.IndexService;
|
||||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||||
|
@ -68,6 +67,7 @@ import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.BaseTransportResponseHandler;
|
import org.elasticsearch.transport.BaseTransportResponseHandler;
|
||||||
import org.elasticsearch.transport.ConnectTransportException;
|
import org.elasticsearch.transport.ConnectTransportException;
|
||||||
import org.elasticsearch.transport.EmptyTransportResponseHandler;
|
import org.elasticsearch.transport.EmptyTransportResponseHandler;
|
||||||
|
import org.elasticsearch.transport.SendRequestTransportException;
|
||||||
import org.elasticsearch.transport.TransportChannel;
|
import org.elasticsearch.transport.TransportChannel;
|
||||||
import org.elasticsearch.transport.TransportChannelResponseHandler;
|
import org.elasticsearch.transport.TransportChannelResponseHandler;
|
||||||
import org.elasticsearch.transport.TransportException;
|
import org.elasticsearch.transport.TransportException;
|
||||||
|
@ -1042,10 +1042,8 @@ public abstract class TransportReplicationAction<Request extends ReplicationRequ
|
||||||
}
|
}
|
||||||
forceFinishAsFailed(new RetryOnPrimaryException(shardId, message, shardFailedError));
|
forceFinishAsFailed(new RetryOnPrimaryException(shardId, message, shardFailedError));
|
||||||
} else {
|
} else {
|
||||||
assert (shardFailedError instanceof EsRejectedExecutionException) ||
|
assert shardFailedError instanceof SendRequestTransportException ||
|
||||||
(shardFailedError.getMessage() != null &&
|
shardFailedError instanceof NodeClosedException : shardFailedError;
|
||||||
shardFailedError.getMessage().contains("TransportService is closed")) :
|
|
||||||
shardFailedError;
|
|
||||||
onReplicaFailure(nodeId, exp);
|
onReplicaFailure(nodeId, exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1131,9 @@ public abstract class TransportReplicationAction<Request extends ReplicationRequ
|
||||||
|
|
||||||
interface IndexShardReference extends Releasable {
|
interface IndexShardReference extends Releasable {
|
||||||
boolean isRelocated();
|
boolean isRelocated();
|
||||||
|
|
||||||
void failShard(String reason, @Nullable Throwable e);
|
void failShard(String reason, @Nullable Throwable e);
|
||||||
|
|
||||||
ShardRouting routingEntry();
|
ShardRouting routingEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.cluster.ClusterStateTaskListener;
|
||||||
import org.elasticsearch.cluster.MasterNodeChangePredicate;
|
import org.elasticsearch.cluster.MasterNodeChangePredicate;
|
||||||
import org.elasticsearch.cluster.NotMasterException;
|
import org.elasticsearch.cluster.NotMasterException;
|
||||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||||
import org.elasticsearch.cluster.routing.IndexRoutingTable;
|
|
||||||
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
|
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
|
||||||
import org.elasticsearch.cluster.routing.RoutingNodes;
|
import org.elasticsearch.cluster.routing.RoutingNodes;
|
||||||
import org.elasticsearch.cluster.routing.RoutingService;
|
import org.elasticsearch.cluster.routing.RoutingService;
|
||||||
|
@ -54,6 +53,7 @@ import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.ConnectTransportException;
|
import org.elasticsearch.transport.ConnectTransportException;
|
||||||
import org.elasticsearch.transport.EmptyTransportResponseHandler;
|
import org.elasticsearch.transport.EmptyTransportResponseHandler;
|
||||||
import org.elasticsearch.transport.NodeDisconnectedException;
|
import org.elasticsearch.transport.NodeDisconnectedException;
|
||||||
|
import org.elasticsearch.transport.RemoteTransportException;
|
||||||
import org.elasticsearch.transport.TransportChannel;
|
import org.elasticsearch.transport.TransportChannel;
|
||||||
import org.elasticsearch.transport.TransportException;
|
import org.elasticsearch.transport.TransportException;
|
||||||
import org.elasticsearch.transport.TransportRequest;
|
import org.elasticsearch.transport.TransportRequest;
|
||||||
|
@ -112,7 +112,7 @@ public class ShardStateAction extends AbstractComponent {
|
||||||
waitForNewMasterAndRetry(actionName, observer, shardRoutingEntry, listener);
|
waitForNewMasterAndRetry(actionName, observer, shardRoutingEntry, listener);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("{} unexpected failure while sending request [{}] to [{}] for shard [{}]", exp, shardRoutingEntry.getShardRouting().shardId(), actionName, masterNode, shardRoutingEntry);
|
logger.warn("{} unexpected failure while sending request [{}] to [{}] for shard [{}]", exp, shardRoutingEntry.getShardRouting().shardId(), actionName, masterNode, shardRoutingEntry);
|
||||||
listener.onFailure(exp.getCause());
|
listener.onFailure(exp instanceof RemoteTransportException ? exp.getCause() : exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -167,6 +167,7 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
||||||
void setTracerLogExclude(List<String> tracelLogExclude) {
|
void setTracerLogExclude(List<String> tracelLogExclude) {
|
||||||
this.tracelLogExclude = tracelLogExclude.toArray(Strings.EMPTY_ARRAY);
|
this.tracelLogExclude = tracelLogExclude.toArray(Strings.EMPTY_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() {
|
protected void doStart() {
|
||||||
adapter.rxMetric.clear();
|
adapter.rxMetric.clear();
|
||||||
|
@ -326,13 +327,8 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
||||||
// callback that an exception happened, but on a different thread since we don't
|
// callback that an exception happened, but on a different thread since we don't
|
||||||
// want handlers to worry about stack overflows
|
// want handlers to worry about stack overflows
|
||||||
final SendRequestTransportException sendRequestException = new SendRequestTransportException(node, action, e);
|
final SendRequestTransportException sendRequestException = new SendRequestTransportException(node, action, e);
|
||||||
threadPool.executor(ThreadPool.Names.GENERIC).execute(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
holderToNotify.handler().handleException(sendRequestException);
|
holderToNotify.handler().handleException(sendRequestException);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,6 +401,7 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a new request handler
|
* Registers a new request handler
|
||||||
|
*
|
||||||
* @param action The action the request handler is associated with
|
* @param action The action the request handler is associated with
|
||||||
* @param requestFactory a callable to be used construct new instances for streaming
|
* @param requestFactory a callable to be used construct new instances for streaming
|
||||||
* @param executor The executor the request handling will be executed on
|
* @param executor The executor the request handling will be executed on
|
||||||
|
@ -417,6 +414,7 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a new request handler
|
* Registers a new request handler
|
||||||
|
*
|
||||||
* @param action The action the request handler is associated with
|
* @param action The action the request handler is associated with
|
||||||
* @param request The request class that will be used to constrcut new instances for streaming
|
* @param request The request class that will be used to constrcut new instances for streaming
|
||||||
* @param executor The executor the request handling will be executed on
|
* @param executor The executor the request handling will be executed on
|
||||||
|
@ -729,6 +727,7 @@ public class TransportService extends AbstractLifecycleComponent<TransportServic
|
||||||
private final static class ContextRestoreResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> {
|
private final static class ContextRestoreResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> {
|
||||||
private final TransportResponseHandler<T> delegate;
|
private final TransportResponseHandler<T> delegate;
|
||||||
private final ThreadContext.StoredContext threadContext;
|
private final ThreadContext.StoredContext threadContext;
|
||||||
|
|
||||||
private ContextRestoreResponseHandler(ThreadContext.StoredContext threadContext, TransportResponseHandler<T> delegate) {
|
private ContextRestoreResponseHandler(ThreadContext.StoredContext threadContext, TransportResponseHandler<T> delegate) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
this.threadContext = threadContext;
|
this.threadContext = threadContext;
|
||||||
|
|
Loading…
Reference in New Issue