Skip to content

bug: "Transaction not found" while writing to topic #648

Open
@vladkolotvin

Description

@vladkolotvin

Bug Report

YDB Python SDK version:

3.20.1

Environment

linux
python 3.12
x64

Current behavior:

При записи в топик в рамках транзакции иногда в лог падают необработанные ошибки:

30 апр. 09:02:20.295 Future exception was never retrieved
future: <Future finished exception=NotFound('message: "status is not ok: <main>: Error: Transaction not found: 01jt2m8ce514gjnz7a94zaym6r, code: 2015\\n" issue_code: 500030 severity: 1 (server_code: 400140)')>

Traceback (most recent call last):
  File \"/usr/local/lib/python3.12/site-packages/ydb/aio/query/pool.py\", line 163, in wrapped_callee
    result = await callee(tx, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  ... some our code

  File \"XXX.py\", line 65, in _put
    await tx_writer.write(ydb.TopicWriterMessage(text))
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 213, in write
    return await super().write_with_ack(messages)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 116, in write_with_ack
    results = [f.result() for f in futures]
               ^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 453, in _connection_loop
    done.pop().result()  # need for raise exception - reason of stop task
    ^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 583, in _read_loop
    resp = await writer.receive()
           ^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 718, in receive
    item = await self._stream.receive()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_grpc/grpcwrapper/common_utils.py\", line 210, in receive
    issues._process_response(grpc_message)
  File \"/usr/local/lib/python3.12/site-packages/ydb/issues.py\", line 230, in _process_response
    raise exc_obj(_format_response(response_proto), response_proto.issues)
    ydb.issues.NotFound: message: \"status is not ok: <main>: Error: Transaction not found: 01jt2m8ce514gjnz7a94zaym6r, code: 2015\
\" issue_code: 500030 severity: 1 (server_code: 400140)



30 апр. 09:02:20.298 Task was destroyed but it is pending!
task: <Task cancelling name='encode_loop' coro=<WriterAsyncIOReconnector._encode_loop() running at /usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py:476> wait_for=<Future cancelled> cb=[_wait.<locals>._on_completion() at /usr/local/lib/python3.12/asyncio/tasks.py:534]>



30 апр. 09:02:20.302 Task exception was never retrieved
future: <Task finished name='close writer' coro=<WriterAsyncIO.close() done, defined at /usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py:91> exception=NotFound('message: "status is not ok: <main>: Error: Transaction not found: 01jt2m8ce514gjnz7a94zaym6r, code: 2015\\n" issue_code: 500030 severity: 1 (server_code: 400140)')>

Traceback (most recent call last):
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 97, in close
    await self._reconnector.close(flush)
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 328, in close
    self._check_stop()
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 409, in _check_stop
    raise self._stop_reason.exception()
  File \"/usr/local/lib/python3.12/site-packages/ydb/aio/query/pool.py\", line 163, in wrapped_callee
    result = await callee(tx, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ... some our code
           
  File \"XXX.py", line 65, in _put
    await tx_writer.write(ydb.TopicWriterMessage(text))
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 213, in write
    return await super().write_with_ack(messages)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 116, in write_with_ack
    results = [f.result() for f in futures]
               ^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 453, in _connection_loop
    done.pop().result()  # need for raise exception - reason of stop task
    ^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 583, in _read_loop
    resp = await writer.receive()
           ^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_topic_writer/topic_writer_asyncio.py\", line 718, in receive
    item = await self._stream.receive()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ydb/_grpc/grpcwrapper/common_utils.py\", line 210, in receive
    issues._process_response(grpc_message)
  File \"/usr/local/lib/python3.12/site-packages/ydb/issues.py\", line 230, in _process_response
    raise exc_obj(_format_response(response_proto), response_proto.issues)
    ydb.issues.NotFound: message: \"status is not ok: <main>: Error: Transaction not found: 01jt2m8ce514gjnz7a94zaym6r, code: 2015\
\" issue_code: 500030 severity: 1 (server_code: 400140)

Expected behavior:

таких ошибок в логе нет

Steps to reproduce:

Получить с сервера ошибку Transaction not found, когда пишешь в топик

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