Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arkadiy-telegin opened this issue Nov 1, 2024 · 1 comment

Comments

@arkadiy-telegin
Copy link

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
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 1, 2024
@szokeasaurusrex szokeasaurusrex changed the title ValueError: <Token var=<ContextVar name='current_scope' default=None at 0xXXX> at 0xYYY> was created in a different Context ValueError: <Token var=<ContextVar name='current_scope' default=None at 0xXXX> at 0xYYY> was created in a different Context Nov 4, 2024
@szokeasaurusrex
Copy link
Member

@arkadiy-telegin Could you please provide a Python script which reproduces the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Community
Development

No branches or pull requests

2 participants