Skip to content

Execute async cleanup tasks in CoordinatorTests#91794

Merged
DaveCTurner merged 1 commit intoelastic:mainfrom
DaveCTurner:2022-11-22-fix-CoordinatorTests-leak
Nov 22, 2022
Merged

Execute async cleanup tasks in CoordinatorTests#91794
DaveCTurner merged 1 commit intoelastic:mainfrom
DaveCTurner:2022-11-22-fix-CoordinatorTests-leak

Conversation

@DaveCTurner
Copy link
Copy Markdown
Member

Closing the JoinValidationService will enqueue a cache-cleaning task which must be executed to release any pages held by the cache.

This commit also introduces a deterministic leak detector to replace the one based on garbage collection, because in these tests we know exactly the expected lifecycle of all allocated pages.

Closes #91599
Closes #91379
Closes #90576

Closing the `JoinValidationService` will enqueue a cache-cleaning task
which must be executed to release any pages held by the cache.

This commit also introduces a deterministic leak detector to replace the
one based on garbage collection, because in these tests we know exactly
the expected lifecycle of all allocated pages.

Closes elastic#91599
Closes elastic#91379
Closes elastic#90576
@DaveCTurner DaveCTurner added >test Issues or PRs that are addressing/adding tests :Distributed/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. v8.6.1 v8.7.0 v8.5.3 labels Nov 22, 2022
@DaveCTurner DaveCTurner requested a review from kingherc November 22, 2022 11:32
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Nov 22, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Copy Markdown
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

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

LGTM! Just one comment if you think more tracing might help in the future.

@Override
public Recycler.V<byte[]> bytePage(boolean clear) {
final var page = super.bytePage(clear);
openPages += 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice if log is e.g. TRACE to also capture the thread stack of the pages. That way, if the assertion that there is no page remaining fails, we may be able to inspect which thread stacks created them. I believe this should be cheap for the majority of the tests (since I guess they do not run in TRACE mode) and when a test fails we may easily re-run it with TRACE to figure out leaks.

This is optional if you consider this would be beneficial.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I'd prefer not to do this here, it would mean we can't just use a counter to check for leaks (or we'd have two whole different implementations depending on the log level). I'd rather just add such tracing code as and when it's needed.

@DaveCTurner
Copy link
Copy Markdown
Member Author

I'm running some iterations of the CoordinatorTests in the background to see if this causes any problems before merging it.

@DaveCTurner DaveCTurner merged commit 7631500 into elastic:main Nov 22, 2022
@DaveCTurner DaveCTurner deleted the 2022-11-22-fix-CoordinatorTests-leak branch November 22, 2022 14:13
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Nov 22, 2022
Closing the `JoinValidationService` will enqueue a cache-cleaning task
which must be executed to release any pages held by the cache.

This commit also introduces a deterministic leak detector to replace the
one based on garbage collection, because in these tests we know exactly
the expected lifecycle of all allocated pages.

Closes elastic#91599
Closes elastic#91379
Closes elastic#90576
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Nov 22, 2022
Closing the `JoinValidationService` will enqueue a cache-cleaning task
which must be executed to release any pages held by the cache.

This commit also introduces a deterministic leak detector to replace the
one based on garbage collection, because in these tests we know exactly
the expected lifecycle of all allocated pages.

Closes elastic#91599
Closes elastic#91379
Closes elastic#90576
elasticsearchmachine pushed a commit that referenced this pull request Nov 22, 2022
Closing the `JoinValidationService` will enqueue a cache-cleaning task
which must be executed to release any pages held by the cache.

This commit also introduces a deterministic leak detector to replace the
one based on garbage collection, because in these tests we know exactly
the expected lifecycle of all allocated pages.

Closes #91599
Closes #91379
Closes #90576
elasticsearchmachine pushed a commit that referenced this pull request Nov 22, 2022
Closing the `JoinValidationService` will enqueue a cache-cleaning task
which must be executed to release any pages held by the cache.

This commit also introduces a deterministic leak detector to replace the
one based on garbage collection, because in these tests we know exactly
the expected lifecycle of all allocated pages.

Closes #91599
Closes #91379
Closes #90576
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. Team:Distributed Meta label for distributed team. >test Issues or PRs that are addressing/adding tests v8.5.3 v8.6.1 v8.7.0

Projects

None yet

3 participants