Skip to content

[Bug]: Goroutine leak in plugin/storage/es/ #5083

Closed
@yurishkuro

Description

@yurishkuro

What happened?

Unrelated PR failed with goleak:

Runtime error
goleak: Errors on successful test run: found unexpected goroutines:
[Goroutine 106 in state select, with github.com/olivere/elastic.(*Client).healthchecker on top of the stack:
github.com/olivere/elastic.(*Client).healthchecker(0xc0002561a0)
	/home/runner/go/pkg/mod/github.com/olivere/elastic@v6.2.37+incompatible/client.go:1060 +0x229
created by github.com/olivere/elastic.DialContext in goroutine 102
	/home/runner/go/pkg/mod/github.com/olivere/elastic@v6.2.37+incompatible/client.go:404 +0xcfa
 Goroutine 107 in state select, with github.com/olivere/elastic.(*bulkWorker).work on top of the stack:
github.com/olivere/elastic.(*bulkWorker).work(0xc000476180, {0x1de9fb8, 0x2906f40})
	/home/runner/go/pkg/mod/github.com/olivere/elastic@v6.2.37+incompatible/bulk_processor.go:480 +0x1c5
created by github.com/olivere/elastic.(*BulkProcessor).Start in goroutine 102
	/home/runner/go/pkg/mod/github.com/olivere/elastic@v6.2.37+incompatible/bulk_processor.go:336 +0x5dc
]

Steps to reproduce

Unknown, this appears to be a spurious condition when ES clients are not being stopped properly (they kick off a bg healthcheck go routine). It's possible that there is a race condition between starting and stopping the client, since we already spent time fixing these go leaks.

Expected behavior

No go leaks in the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions