Skip to content

Created in different context error #18

Open
@gokhan721

Description

@gokhan721

Hi all,

Everything has worked fine for ContextVarsScopeManager if I have only Fastapi application. But, When I tried to mount a Flask WSGIApplication to the Fastapi application, I've got an error from ContextVarsScopeManager as "<Token var=<ContextVar name='scope' at 0x7ff47d568a90> at 0x7ff47d61fe00> was created in a different Context". This error has been raised from after_request function of tracer.wrappers.fastapi.fastapi_wrapper module while trying to close scope. When I debugged the code, I have found out that "if token._var is not self" check into reset function of ContextVar class has caused this exception. I've created a sample project to reproduce the issue and shared it's Github url below.

Github url: https://github.com/gokhan721/opentracing_contextvar_work

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions