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

fix(server): fix leak in FuturesUnordered #1204

Merged
merged 6 commits into from
Sep 15, 2023
Merged

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Sep 15, 2023

FuturesUnordered was not getting polled until shutdown, so it was accumulating tasks forever. The change uses a channel instead to wait until all senders are closed before shutdown can happen.

Reduces the memory usage significantly but still slightly worse than v0.16.x, around 2x but that should be okay.

Close #1200

The tokio::spawn handles were never removed from `FutursUnordered`
which this commit fixes.

Reduces the memory usage signficantly but still slightly worse than v0.16.x
@niklasad1 niklasad1 requested a review from a team as a code owner September 15, 2023 15:15
Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

LGTM; nice catch! FuturesUnordered was not getting polled until shutdown, so it was accumulating tasks forever. The change uses a channel instead to wait until all senders are closed before shutdown can happen.

@niklasad1 niklasad1 merged commit 30c0fbb into master Sep 15, 2023
15 checks passed
@niklasad1 niklasad1 deleted the na-fix-leak-pending-calls branch September 15, 2023 16:02
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.

High memory consumption after 0.16.x
3 participants