Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES leak partial fix (v1) #6339

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

Manik2708
Copy link
Contributor

@Manik2708 Manik2708 commented Dec 11, 2024

Which problem is this PR solving?

Description of the changes

  • This is a better version of elasticsearch_test reducing the number of leaks from 50 to less than 10. Unfortunately we can't fix all the leakages because there is no way to close the v8 client of ES leading to some unclosed http transports. If the changes looks good then we can merge without embedding goleak (as it will lead to failure of test)

How was this change tested?

  • By running the integration tests

Checklist

Signed-off-by: Manik2708 <[email protected]>
@Manik2708
Copy link
Contributor Author

/Don't merge

Signed-off-by: Manik2708 <[email protected]>
Signed-off-by: Manik2708 <[email protected]>
@Manik2708
Copy link
Contributor Author

Manik2708 commented Dec 11, 2024

https://github.com/jaegertracing/jaeger/actions/runs/12275617395/job/34263203812?pr=6339#step:9:21169 4 goroutines are leaking and I have verified that they are from v8 client not from anywhere else. The reason is, there is no way to close this v8 client, closing the http transport can close some of the go-routines but there are most probably some transports which are started by client which remain in memory as a cache for reusability. Please see this: https://discuss.elastic.co/t/how-to-close-the-connection-using-go-client/350123/2. @yurishkuro

Signed-off-by: Manik2708 <[email protected]>
@Manik2708 Manik2708 requested a review from yurishkuro December 11, 2024 17:39
@Manik2708
Copy link
Contributor Author

I have applied the changes you said, but it is leading to more go leakage, earlier only 3-4 go leakages were there but it got increased significantly when same transport was used in both the clients.

plugin/storage/integration/elasticsearch_test.go Outdated Show resolved Hide resolved
@@ -144,10 +149,11 @@ func (s *ESStorageIntegration) initSpanstore(t *testing.T, allTagsAsFields bool)
require.NoError(t, err)
}

func healthCheck() error {
func healthCheck(t *testing.T) error {
c := getESHttpClient(t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe another alternative is to ensure we're only using a single http client for a test, i.e. either initialize it upfront or perhaps make this getESHttpClient function lazily initialize it and schedule a clean-up. I would prefer upfront init because with lazy it's hard to predict the scope (even though it looks like it would happen very early in each of the public tests, so might be ok, worth a try).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the approach of declaring it upfront and its working fine as leakages are again decreased to 4

@Manik2708 Manik2708 requested a review from yurishkuro December 12, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants