CRE-2025-0028
OpenTelemetry Python fails to detach context token across async boundariesLowImpact: 6/10Mitigation: 1/10
CRE-2025-0028View on GitHub
Description
In OpenTelemetry Python, detaching a context token that was created in a different context can raise a `ValueError`. This occurs when asynchronous operations, such as generators or coroutines, are finalized in a different context than they were created, leading to context management errors and potential trace data loss.
Mitigation
- Ensure that context tokens are detached in the same context they were created. - Use `contextlib.aclosing()` to manage asynchronous generators properly. - Upgrade to a version of OpenTelemetry Python where this issue is addressed. '