Need clatification on "TransportException"

(Jeeva K) #1

I'm writing a elastic search wrapper for our application. I'm doing disruptive testing by taking a node down and similar things, so that I can do retry on the basis of the exception type.

I'm getting TransportException "TransportService is closed stopped can't send request". Also I'm using Transport client to connect to elastic search.

Not sure when will this happen. I need some clarification on this exception.

Also I need help on possible exceptions which can happen while doing disruptive testing.

Can anyone help me with the same?

(Jason Wee) #2

what nodes was that? client node or one of the cluster node?

from the exception, it looks like the client node been taken down that gave the exception.

        clientHandlers.put(requestId, new RequestHolder<>(handler, node, action, timeoutHandler));
        if (started.get() == false) {
            // if we are not started the exception handling will remove the RequestHolder again and calls the handler to notify the caller.
            // it will only notify if the toStop code hasn't done the work yet.
            throw new TransportException("TransportService is closed stopped can't send request");


(Jeeva K) #3

I took down the master node from cluster, while client was sending request.

This is my configuration: I have 6 nodes in cluster in which one of them is master.

(terrasacer) #4

Hi guys.

I have similar problem. My simple code is as follow

node = NodeBuilder.nodeBuilder()
        .put("http.enabled", false)
        .put("path.home", "/Users/my_home/Desktop")
client = node.client();

//index operations


The index operations are successful but I get an error when I close the node.

Feb 12, 2016 12:33:51 AM org.elasticsearch.cluster.action.shard.ShardStateAction$2 handleException
WARNING: [Pyro] failed to send shard started to [{Pyro}{ud9W86hCQ5OEWJ9FCCHQIQ}{}{}]
SendRequestTransportException[[Pyro][][internal:cluster/shard/started]]; nested: TransportException[TransportService is closed stopped can't send request];
	at org.elasticsearch.transport.TransportService.sendRequest(
	at org.elasticsearch.transport.TransportService.sendRequest(
	at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(
	at org.elasticsearch.cluster.action.shard.ShardStateAction.shardStarted(
	at org.elasticsearch.indices.cluster.IndicesClusterStateService$2.onRecoveryDone(
	at org.elasticsearch.index.shard.StoreRecoveryService$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
Caused by: TransportException[TransportService is closed stopped can't send request]
	at org.elasticsearch.transport.TransportService.sendRequest(
	... 8 more

I use version 2.2.0


Thank you in advance for your answers.

(Fabio Angelini) #5

I suggest you to wait for the green status after the node creation and to refresh the index before closing the node.

   // ... 
   client = node.client();
    //index operations
    public static void waitForReady(Client client) {
        // wait 30 seconds for yellow
        ClusterHealthRequest req = new ClusterHealthRequest().waitForYellowStatus();
        ClusterHealthResponse response = client.admin().cluster().health(req).actionGet(3000);
        if (response.getStatus() == ClusterHealthStatus.RED) {
            throw new RuntimeException("ElasticSearch cluster status failed become ready");

    public static void refreshIndex(Client client, String index) {
          RefreshRequest request = new RefreshRequest();

(system) #6