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

bug: async writer unexpectedly raises asyncio.CancelledError #550

Open
vivatttt opened this issue Jan 23, 2025 · 0 comments
Open

bug: async writer unexpectedly raises asyncio.CancelledError #550

vivatttt opened this issue Jan 23, 2025 · 0 comments
Labels

Comments

@vivatttt
Copy link

Bug Report

ydb == 3.18.14

Environment

Python == 3.12

Current behavior:

Asyncio.CancelledError is raised without a clear or consistent trigger, which interrupts the message writing process

Expected behavior:

The message should be written to the topic successfully, or the more specific exception should be raised

Steps to reproduce:

Attempt to send message using:

writer: ydb.topic.TopicWriterAsyncIO
messages:  ydb.topic.TopicWriterMessage

await asyncio.wait_for(writer.write_with_ack(messages), timeout)

Related code:

sdk traceback is:

File "contrib/tools/python3/Lib/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 102, in write_with_ack
    futures = await self.write_with_ack_future(messages)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 131, in write_with_ack_future
    futures = await self._reconnector.write_with_ack_future(converted_messages)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 286, in write_with_ack_future
    self._check_stop()
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 345, in _check_stop
    raise self._stop_reason.exception()
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 387, in _connection_loop
    done.pop().result()  # need for raise exception - reason of stop task
    ^^^^^^^^^^^^^^^^^^^
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 517, in _read_loop
    resp = await writer.receive()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "contrib/python/ydb/py3/ydb/_topic_writer/topic_writer_asyncio.py", line 643, in receive
    item = await self._stream.receive()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "contrib/python/ydb/py3/ydb/_grpc/grpcwrapper/common_utils.py", line 205, in receive
    grpc_message = await self.from_server_grpc.__anext__()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "contrib/python/grpcio/py3/grpc/aio/_call.py", line 326, in _fetch_stream_responses
    await self._raise_for_status()
  File "contrib/python/grpcio/py3/grpc/aio/_call.py", line 233, in _raise_for_status
    raise asyncio.CancelledError()
asyncio.exceptions.CancelledError",

Other information:

This occurs inconsistently (actually quite rarely) and we can't determine the root cause and even reproduce it due to unpredictable nature.

@vivatttt vivatttt added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants