Skip to content

Conversation

@cbrewster
Copy link
Member

Why

By default, new asyncio tasks hold onto a reference to the current context. If the user of river has a lot of data in the context while the restore budget task is created, that context cannot be GC'd until the task exits. This can lead to accidental memory leaks.

As a followup we will replace this rate limiter with one that does not require background tasks.

What changed

  • Create a fresh context for restore budget task

Test plan

  • Shouldn't have any behavior impact here, we don't rely on the context for budget restoration.
  • We should see fewer memory leaks internally

@cbrewster cbrewster requested a review from a team as a code owner November 25, 2024 21:25
@cbrewster
Copy link
Member Author

Current dependencies on/for this PR:

This comment was autogenerated by Freephite.

@cbrewster cbrewster requested review from ryantm and removed request for a team November 25, 2024 21:25
@cbrewster cbrewster added the minor Bump minor version label Nov 25, 2024
@cbrewster cbrewster merged commit f8580f0 into main Nov 25, 2024
3 checks passed
@cbrewster cbrewster deleted the 11-25-use_empty_context_in_restore_budget_task branch November 25, 2024 21:44
@cbrewster cbrewster added patch Bump patch version and removed minor Bump minor version labels Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bump patch version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants