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

ExceptionGroup support #43

Open
VincentVanlaer opened this issue Apr 11, 2024 · 0 comments
Open

ExceptionGroup support #43

VincentVanlaer opened this issue Apr 11, 2024 · 0 comments

Comments

@VincentVanlaer
Copy link
Member

Since anyio 4.0, all task groups raise ExceptionGroups by default. We need to check whether that causes us to miss exceptions, and whether we are passing exception groups to users where we do not intent to raise one.

I did a quick scan for where we use task groups in the main code, assuming that no other anyio functions raise exception groups:

task_group = await self.enter_async_context(anyio.create_task_group())

task_group = await self.enter_async_context(anyio.create_task_group())

async def __call__(self, message_aiter, *, metadata=None):
stream = await self._stream_fn(metadata=metadata)
async with anyio.create_task_group() as task_group:
task_group.start_soon(send_multiple_messages_client, stream, message_aiter)
return await extract_message_from_singleton_stream(stream)

async def call_aiter(self, message_aiter, metadata):
stream = await self._stream_fn(metadata=metadata)
async with anyio.create_task_group() as task_group:
task_group.start_soon(send_multiple_messages_client, stream, message_aiter)
yield stream_to_async_iterator(stream)

async with GRPCProtoSocket(self.config, stream_) as grpc_socket:
# TODO: resource usage warning
# TODO: TaskGroup() uses a lot of memory if the connection is kept for a long time
# TODO: do we really need it here?
async with anyio.create_task_group() as task_group:
async for stream in grpc_socket.listen():
task_group.start_soon(self.request_received, stream)

Other uses of tasks groups is in tests and some sample scripts. While those probably should be double checked, the ones above are the most important ones.

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

No branches or pull requests

1 participant