Skip to content

ValueError: <Token var=<ContextVar name='current_scope' default=None at 0xXXX> at 0xYYY> was created in a different Context #3724

@arkadiy-telegin

Description

@arkadiy-telegin

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.12.0

Steps to Reproduce

Noticed the following error in the asyncio integration. It crashes the program. I have the following init:

        sentry_sdk.init(
            dsn=settings.sentry_dsn,
            environment=settings.env,
            integrations=[
                AsyncioIntegration(),
                LoguruIntegration(),
                FastApiIntegration(),
                OpenAIIntegration(),
                RedisIntegration(),
                HttpxIntegration(),
                AioHttpIntegration(),
            ],
            traces_sample_rate=1.0,
            profiles_sample_rate=1.0,
        )

Can it be somehow related to #2908?

Expected Result

No crash.

Actual Result

Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/sentry_sdk/integrations/asyncio.py", line 46, in _coro_creating_hub_and_span
    with sentry_sdk.isolation_scope():
  File "/venv/lib/python3.11/site-packages/sentry_sdk/scope.py", line 1628, in isolation_scope
    _current_scope.reset(current_token)
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
ValueError: <Token var=<ContextVar name='current_scope' default=None at 0x7cc13c5a72e0> at 0x7cc0dc4eb880> was created in a different Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy