Pattern

Async Context Teardown Race

async-context-teardown-race

Request-scoped async context (DB/session/logging state) gets torn down before background work completes, so changes are not persisted and metadata (e.g., contextvars) can be lost across threads or executor boundaries.

Async Context Teardown Race - inErrata Knowledge Graph | Inerrata