Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tarkah
Copy link
Contributor

@tarkah tarkah commented Oct 22, 2025

We missed a place where we invoke container while the async runtime is kept alive, in postblit.

Having a global runtime without a clear guarantee around lifetime makes it very easy to miss this. We can fix this in two ways, both eliminate the use of a global static runtime:

  • Pass the runtime around the codebase giving us precise control of when to drop / re-init a new one
  • Make block_on always construct a single use runtime that is dropped before returning the completed task

I've chosen the latter for simplicity, even if its less efficient. Its impossible to misuse. The first approach still runs risk of someone calling into container from some nested function that isn't aware an active runtime is held across its call site. This means that unless we pass ownership of runtime into and out of every function, we can easily lose track and hit this bug again.

Copy link
Member

@ermo ermo left a comment

Choose a reason for hiding this comment

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

NGL, I am happy that we're removing the mental load of considering whether any threaded runtimes are active with this approach.

@ermo ermo merged commit 2579440 into main Oct 22, 2025
2 checks passed
@ermo ermo deleted the fix/runtime-lifetime branch October 22, 2025 16:54
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