I'm getting a Blocking Operation related exception when running search using Java

I searched past issues, but I can't find any reference to this one.

I'm upgrading a 1.4.2 solution to a 2.4.4 (on the way to 5.x).

The offending operation is basically:

QueryBuilder query = ...
Client client = Node.client(); // Same behaviour with transport client

The exception I'm getting is:

Caused by: java.lang.AssertionError: Expected current thread [Thread[task-scheduler-6,5,main]] to not be the scheduler thread. Reason: [Blocking operation]
	at org.elasticsearch.threadpool.ThreadPool.assertNotScheduleThread(ThreadPool.java:1089)
	at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:119)
	at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:42)
	at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:64)

I've looked at the ES source and I see that the get operation should, indeed, not be running on a scheduler thread, but I'm unclear why this is happening or how to avoid it.

I didn't mention I'm running this within the spring framework. On looking closer at how ES determines whether the scheduler thread is the current thread (sub-string check), I now believe this is a Spring/ES conflict. I'll drop a custom task scheduler in spring to rename it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.