Skip to content

BulkIndexer memory leak? #956

Open
Open
@JAndritsch

Description

@JAndritsch

I'm observing what appears to be a memory leak when using a BulkIndexer. I noticed that my application's memory was growing rapidly as usage of the BulkIndexer increased. I thought it was maybe my own code in how I was handling the bulk index items, but I commented out the entire thing and was able to replicate the issue by simply triggering a scenario that ran this code successively:

indexer, _ := esutil.NewBulkIndexer(esutil.BulkIndexerConfig{
	Index:  "some-index",
	Client: s.client, // a pointer to elasticsearch.Client
})

ctx := context.Background()

indexer.Close(ctx)

You don't even need to add any items. Just triggering this code multiple times results in a massive increase in memory after a few iterations. My application uses like 8mb of memory after startup. Simply invoking the above code 3-4 times causes that to jump to 160mb. Another time after that and it goes up to 300+mb.

I am using package version v8.17.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions