Skip to content

Rewriteable#rewriteAndFetch may complete its listener on a transport thread #133312

@idegtiarenko

Description

@idegtiarenko

While adding additional assertCurrentThreadPool in ES|QL code we noticed that after executing

Rewriteable.rewriteAndFetch(
new FunctionsRewriteable(plan),
queryRewriteContext(services, indexNames(plan)),
listener.delegateFailureAndWrap((l, r) -> l.onResponse(r.plan))
);

from the SEARCH threadpool, a listener (and everything happening after) it could end up on a wide variety of threads including transport, see
assert ThreadPool.assertCurrentThreadPool(
TcpTransport.TRANSPORT_WORKER_THREAD_NAME_PREFIX,
ThreadPool.Names.SYSTEM_READ,
ThreadPool.Names.SEARCH,
ThreadPool.Names.SEARCH_COORDINATION,
MachineLearning.NATIVE_INFERENCE_COMMS_THREAD_POOL_NAME
);

I believe it is not expected. If it is, it would be ideal to document it so that users of this api are aware and fork back to the correct thread pool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/SearchCatch all for Search Foundations:Search/SearchSearch-related issues that do not fall into other categories>bugTeam:SearchMeta label for search teamTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearchpriority:highA label for assessing bug priority to be used by ES engineers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions