Skip to content

Conversation

@gf2121
Copy link
Contributor

@gf2121 gf2121 commented Oct 7, 2023

Description

This is a bug left by #12573. As we are using a common ByteBlockPool across all BytesRefHash, the map clear won't help release the memory held by ByteBlockPool and the pool will allocate new slices when new terms added because the offset is never reset.

Sorry for the missing!

@gf2121 gf2121 requested a review from jpountz October 9, 2023 03:19
Copy link
Member

@mikemccand mikemccand left a comment

Choose a reason for hiding this comment

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

Good catch @gf2121!

Just to confirm: the previous PR was not released/included in 9.8.0 right? So users are not hitting this memory leak when using the 9.8.0 release.

public void testDeletedTerms() {
int iters = atLeast(10);
String[] fields = new String[] {"a", "b", "c"};
BufferedUpdates.DeletedTerms actual = new BufferedUpdates.DeletedTerms();
Copy link
Member

Choose a reason for hiding this comment

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

Does moving the BufferedUpdates up here mean the memory leak is more obvious (i.e. the test now fails with OOME or so, before your fix)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I'm moving this to test #clear runs properly, not related to the memory leak issue :)

@jpountz
Copy link
Contributor

jpountz commented Oct 9, 2023

wow good catch. Out of curiosity, how did you catch it? Are you running snapshot Lucene builds in production?

@gf2121
Copy link
Contributor Author

gf2121 commented Oct 9, 2023

Just to confirm: the previous PR was not released/included in 9.8.0 right? So users are not hitting this memory leak when using the 9.8.0 release.

Yes, the previous PR is not included in 9.8.0 release.

Out of curiosity, how did you catch it? Are you running snapshot Lucene builds in production?

Not really, just come up this accidentally when reading codes :)

@gf2121 gf2121 merged commit e20e245 into apache:main Oct 10, 2023
s1monw pushed a commit to s1monw/lucene that referenced this pull request Oct 10, 2023
@gf2121 gf2121 added this to the 9.9.0 milestone Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants