Skip to content

[BUG] JVM memory pressure build due to TransportBulkRequest pile up because of cluster state objects.Β #20085

@SwethaGuptha

Description

@SwethaGuptha

What is the bug?
Having too many outstanding TransportBulkAction request can lead to memory build up on the node as the each request handler holds a reference to cluster state object.

https://github.com/opensearch-project/OpenSearch/blob/6b5c08aecf496b8fbdeb6314b841713684dc49df/server/src/main/java/org/opensearch/action/bulk/TransportBulkAction.java#L596C1-L603C57

        protected void doRun() {
            assert bulkRequest != null;
            final ClusterState clusterState = observer.setAndGetObservedState();
            if (handleBlockExceptions(clusterState)) {
                return;
            }
            final ConcreteIndices concreteIndices = new ConcreteIndices(clusterState, indexNameExpressionResolver);
            Metadata metadata = clusterState.metadata();

static class ConcreteIndices {
private final ClusterState state;
private final IndexNameExpressionResolver indexNameExpressionResolver;
private final Map<String, Index> indices = new HashMap<>();
ConcreteIndices(ClusterState state, IndexNameExpressionResolver indexNameExpressionResolver) {

    static class ConcreteIndices {
        private final ClusterState state;
        private final IndexNameExpressionResolver indexNameExpressionResolver;
        private final Map<String, Index> indices = new HashMap<>();


        ConcreteIndices(ClusterState state, IndexNameExpressionResolver indexNameExpressionResolver) {

The high memory JVM pressure was observed on a cluster where there were 500+ outstanding indexing request on a node and the cluster state size was 55MB, a total of 30GB memory was consumed in this case.

Image

500 cluster state objects

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions