{"action":"created","issue":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6411","labels_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6411/labels{/name}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6411/comments","events_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6411/events","html_url":"https://github.com/elasticsearch/elasticsearch/issues/6411","id":35039598,"number":6411,"title":"Tribe node fails on index close.","user":{"login":"zazasa","id":6582479,"avatar_url":"https://avatars.githubusercontent.com/u/6582479?v=3","gravatar_id":"","url":"https://api.github.com/users/zazasa","html_url":"https://github.com/zazasa","followers_url":"https://api.github.com/users/zazasa/followers","following_url":"https://api.github.com/users/zazasa/following{/other_user}","gists_url":"https://api.github.com/users/zazasa/gists{/gist_id}","starred_url":"https://api.github.com/users/zazasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zazasa/subscriptions","organizations_url":"https://api.github.com/users/zazasa/orgs","repos_url":"https://api.github.com/users/zazasa/repos","events_url":"https://api.github.com/users/zazasa/events{/privacy}","received_events_url":"https://api.github.com/users/zazasa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/labels/adoptme","name":"adoptme","color":"207de5"},{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/labels/bug","name":"bug","color":"9e2c2c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-06-05T09:09:32Z","updated_at":"2015-01-08T10:42:08Z","closed_at":null,"body":"Hi, \r\nI have 1 tribe node, on 1 cluster with 1 master and 2 data nodes.\r\nHere the tribe config:\r\n```\r\ntribe.t1.cluster.name: appliance_bu-01\r\ntribe.t1.discovery.zen.ping.unicast.hosts: [\"bu-01\"]\r\n```\r\nThe tribe operates normally when I create indices and making query requests. \r\nBut if I close an index I will se a null pointer exception in the log file, and it stops working properly (e.g. I can see the cluster state, but some query fails).\r\nHere a simple test:\r\n\r\non the master node:\r\n```\r\ncurl -XPUT \"http://localhost:9200/movies/movie/2\" -d'\r\n{\r\n    \"title\": \"The Godfather\",\r\n    \"director\": \"Francis Ford Coppola\",\r\n    \"year\": 1972\r\n}'\r\n{\"_index\":\"movies\",\"_type\":\"movie\",\"_id\":\"2\",\"_version\":1,\"created\":true}\r\n\r\ncurl -XPOST \"http://localhost:9200/movies/_close\"\r\n{\"acknowledged\":true}\r\n```\r\n\r\non the tribe node:\r\n```\r\ntail -f /var/log/elasticsearch/elasticsearch.log\r\n\r\n[2014-06-05 10:53:09,539][INFO ][tribe                    ] [Lord Pumpkin] [t1] adding index [movies]\r\n[2014-06-05 10:54:33,140][WARN ][tribe                    ] [Lord Pumpkin] failed to process [cluster event from t1, zen-disco-receive(from master [[Cornelius van Lunt][ZYRaI1BMQ0avMdyxCSMfAg][bu-01][inet[/*myipaddress*:9300]]{data=false, master=true}])]\r\njava.lang.NullPointerException\r\n\tat org.elasticsearch.cluster.routing.RoutingTable$Builder.add(RoutingTable.java:400)\r\n\tat org.elasticsearch.tribe.TribeService$TribeClusterStateListener$1.execute(TribeService.java:297)\r\n\tat org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:309)\r\n\tat org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:134)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n\r\n```\r\n\r\nmy ES version is the same on each node:\r\n```\r\n{\r\n  \"status\" : 200,\r\n  \"name\" : \"Lord Pumpkin\",\r\n  \"version\" : {\r\n    \"number\" : \"1.2.0\",\r\n    \"build_hash\" : \"c82387f290c21505f781c695f365d0ef4098b272\",\r\n    \"build_timestamp\" : \"2014-05-22T12:49:13Z\",\r\n    \"build_snapshot\" : false,\r\n    \"lucene_version\" : \"4.8\"\r\n  },\r\n  \"tagline\" : \"You Know, for Search\"\r\n}\r\n```\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/comments/69163070","html_url":"https://github.com/elasticsearch/elasticsearch/issues/6411#issuecomment-69163070","issue_url":"https://api.github.com/repos/elasticsearch/elasticsearch/issues/6411","id":69163070,"user":{"login":"smorovic","id":5859622,"avatar_url":"https://avatars.githubusercontent.com/u/5859622?v=3","gravatar_id":"","url":"https://api.github.com/users/smorovic","html_url":"https://github.com/smorovic","followers_url":"https://api.github.com/users/smorovic/followers","following_url":"https://api.github.com/users/smorovic/following{/other_user}","gists_url":"https://api.github.com/users/smorovic/gists{/gist_id}","starred_url":"https://api.github.com/users/smorovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smorovic/subscriptions","organizations_url":"https://api.github.com/users/smorovic/orgs","repos_url":"https://api.github.com/users/smorovic/repos","events_url":"https://api.github.com/users/smorovic/events{/privacy}","received_events_url":"https://api.github.com/users/smorovic/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T10:42:08Z","updated_at":"2015-01-08T10:42:08Z","body":"I managed to fix this in 1.4.2 codebase (this is unchanged in current master).\r\nTribe needs to check index close state and do the same as if it was deleted:\r\n\r\n```diff\r\n--- bak/elasticsearch-1.4.2/src/main/java/org/elasticsearch/tribe/TribeService.java\t2014-12-16 15:10:48.000000000 +0100\r\n+++ ./elasticsearch-1.4.2/src/main/java/org/elasticsearch/tribe/TribeService.java\t2015-01-07 18:15:57.000000000 +0100\r\n@@ -259,6 +259,9 @@\r\n                             if (tribeIndex == null) {\r\n                                 logger.info(\"[{}] removing index [{}]\", tribeName, index.index());\r\n                                 removeIndex(blocks, metaData, routingTable, index);\r\n+                            } else if (tribeIndex.state() == IndexMetaData.State.CLOSE) {\r\n+                                logger.info(\"[{}] removing closed index [{}]\", tribeName, index.index());\r\n+                                removeIndex(blocks, metaData, routingTable, index);\r\n                             } else {\r\n                                 // always make sure to update the metadata and routing table, in case\r\n                                 // there are changes in them (new mapping, shards moving from initializing to started)\r\n```\r\n"}}