Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClusterBlockException cannot be caught for bulk request when using node client #7086

Closed
ppf2 opened this Issue Jul 30, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@ppf2
Copy link
Member

ppf2 commented Jul 30, 2014

When the cluster is in the ClusterBlockException state (Eg. not enough master to meet min master nodes), the ClusterBlockException cannot be caught for a bulk request when using node client:

 BulkRequestBuilder brb = client.prepareBulk();
            XContentBuilder builder = XContentFactory.jsonBuilder().startObject().field("bfield1", "bvalue1").endObject();
            String jsonString = builder.string();
            IndexRequestBuilder irb = client.prepareIndex(INDEX_NAME,TYPE_NAME,"b1");
            irb.setSource(jsonString);
            brb.add(irb);
            BulkResponse bulkResponse = brb.execute().actionGet();

Returns the exception:

Exception in thread "elasticsearch[client_node][generic][T#4]" org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master];
    at org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedException(ClusterBlocks.java:138)
    at org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedRaiseException(ClusterBlocks.java:128)
    at org.elasticsearch.action.bulk.TransportBulkAction.executeBulk(TransportBulkAction.java:197)
    at org.elasticsearch.action.bulk.TransportBulkAction.access$000(TransportBulkAction.java:65)
    at org.elasticsearch.action.bulk.TransportBulkAction$1.onFailure(TransportBulkAction.java:143)
    at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$2.run(TransportAction.java:119)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

The above cannot be caught in a catch(ClusterBlockException exception) clause. However, when the cluster is in the same state using the node client, the ClusterBlockException can be caught for search requests.

kimchy added a commit to kimchy/elasticsearch that referenced this issue Jul 31, 2014

cluster block with auto create index bulk action can cause bulk execu…
…tion to not return

when there is a cluster block (like no master yet discovered), the bulk action doesn't properly catch the exception of inner execute to notify the listener, causing the bulk operation to hang
closes elastic#7086

@kimchy kimchy closed this in #7109 Jul 31, 2014

kimchy added a commit that referenced this issue Jul 31, 2014

cluster block with auto create index bulk action can cause bulk execu…
…tion to not return

when there is a cluster block (like no master yet discovered), the bulk action doesn't properly catch the exception of inner execute to notify the listener, causing the bulk operation to hang
closes #7086

kimchy added a commit that referenced this issue Jul 31, 2014

cluster block with auto create index bulk action can cause bulk execu…
…tion to not return

when there is a cluster block (like no master yet discovered), the bulk action doesn't properly catch the exception of inner execute to notify the listener, causing the bulk operation to hang
closes #7086

kimchy added a commit that referenced this issue Sep 8, 2014

cluster block with auto create index bulk action can cause bulk execu…
…tion to not return

when there is a cluster block (like no master yet discovered), the bulk action doesn't properly catch the exception of inner execute to notify the listener, causing the bulk operation to hang
closes #7086

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

cluster block with auto create index bulk action can cause bulk execu…
…tion to not return

when there is a cluster block (like no master yet discovered), the bulk action doesn't properly catch the exception of inner execute to notify the listener, causing the bulk operation to hang
closes elastic#7086
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.