Created in different context error
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 20/100
Research direction
Start with ContextVarsScopeManager and the after_request function in tracer.wrappers.fastapi.fastapi_wrapper, then reproduce the failure using the linked sample project with a Flask WSGI application mounted in FastAPI. Done means closing the scope no longer raises the “created in a different Context” error in that setup.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 90
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MagicStack/contextvars
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
MagicStack/contextvars#17 · 1 reaction ·
-
2.4: pytest warning Open
Difficulty 1/5 Under an hour Newbie friendliness 35/100
MagicStack/contextvars#16 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
MagicStack/contextvars#15 · 2 reactions ·
-
asyncio support Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
MagicStack/contextvars#2 · 16 comments ·
All issues in MagicStack/contextvars
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·