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

Silent async breakage on Python 3.6 #694

Closed
marco-neumann-by opened this issue May 18, 2020 · 1 comment · Fixed by #701
Closed

Silent async breakage on Python 3.6 #694

marco-neumann-by opened this issue May 18, 2020 · 1 comment · Fixed by #701

Comments

@marco-neumann-by
Copy link

Abstract

aiocontextvars is required on Python 3.6 to make async integrations work (e.g. ASGI), but this is only obvious from reading the source code.

Technical Background

Here the aiocontextvars is optionally used under Python 3.6 to setup async-aware context vars. Without the package, async integrations just silently break (e.g. the ASGI integration misses a bunch of metadata, likely because under some conditions the current Hub/client is not found).

Potential Solutions

  • log message: emit a message indicating the missing requirement (maybe only if the debug=True flag is set)
  • warning: same as previous point, but as a Python warning (not logging)
  • optional requirement: add an optional requirement (like async) that under Python 3.6 requires aiocontextvars here.
  • docs: add a note to the integration docs

Refs

#289, #293

@untitaker
Copy link
Member

you're absolutely right, we do this for async framework integrations but not for the middleware

untitaker added a commit that referenced this issue Jun 3, 2020
…701)

Found multiple issues with the asgi middleware:

    lack of warning if contextvars are broken -- as part of that I refactored/unified the error message we give in such situations, also added more information as gevent just recently released a version that deals with contextvars better
    exposed methods that were meant for overriding.. but all that is done in there can be done in event processors, so we make them private

Fix #630
Fix #700
Fix #694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants