-
-
Notifications
You must be signed in to change notification settings - Fork 1k
avoid collapsing exception groups from user code #2830
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
base: master
Are you sure you want to change the base?
Changes from all commits
ae86e1d
a4687d7
ffacdb2
02c221f
c7c6206
802409a
5b43511
6500d2f
5e4a262
e44b254
e24198f
e780650
6ad6d7c
f30ef9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
import anyio | ||
import anyio.to_thread | ||
|
||
from starlette._utils import create_collapsing_task_group | ||
from starlette.background import BackgroundTask | ||
from starlette.concurrency import iterate_in_threadpool | ||
from starlette.datastructures import URL, Headers, MutableHeaders | ||
|
@@ -258,7 +259,7 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: | |
except OSError: | ||
raise ClientDisconnect() | ||
else: | ||
async with anyio.create_task_group() as task_group: | ||
async with create_collapsing_task_group() as task_group: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we also have an issue with With my comment on the other PR I was trying to avoid the changes here. 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's the same sort of issue, but it's wrapped in two TaskGroups before the user gets the exception. Collapsing is ok here because if wait_for_disconnect raises an exception it is always 'catastrophic' eg won't be caught |
||
|
||
async def wrap(func: typing.Callable[[], typing.Awaitable[None]]) -> None: | ||
await func() | ||
|
Uh oh!
There was an error while loading. Please reload this page.