Skip to content

Stream_stream writes to closed stream crashing channel #182

@zachary-walravens

Description

@zachary-walravens

Summary

stream_stream writing on closed stream causes channel closure.

Reproduction Steps

• Use stream_steam to have many asyncio tasks sending messages on different streams on the same connection to an gRPC server concurrently.
• Randomly close ~10% of the streams on the server side

Expected Results

The stream that the error was raised on is closed. The other streams are still active and the other tasks can still send and receive gRPC messages

Actual Results

• Sometimes, since the cancelation of sending_task isn't awaited, sending_task will write to a closed gRPC stream causing the server to close the whole channel.
All tasks sending messages will get an exception

System Information

zacharywalravens@Mac desktop % protoc --version; python --version; pip show betterproto2
libprotoc 33.4
Python 3.12.12
Name: betterproto2
Version: 0.9.1
Summary: A better Protobuf / gRPC generator & library
Home-page:
Author:
Author-email: Adrien Vannson adrien.vannson@protonmail.com, "Daniel G. Taylor" danielgtaylor@gmail.com
License-Expression: MIT
Location: /opt/homebrew/Caskroom/miniconda/base/envs/flow_server/lib/python3.12/site-packages
Requires: python-dateutil, typing-extensions
Required-by: flow-server

Checklist

  • I have searched the issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have verified this issue occurs on the latest prelease of betterproto which can be installed using pip install -U --pre betterproto, if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions