<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/unified_agent_client/client_impl.h, branch CLI_2.31.0</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=CLI_2.31.0</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=CLI_2.31.0'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-04-10T10:30:47Z</updated>
<entry>
<title>C++ client reconnect after agent SIGKILL/long outage</title>
<updated>2026-04-10T10:30:47Z</updated>
<author>
<name>andybg</name>
<email>andybg@yandex-team.com</email>
</author>
<published>2026-04-10T10:11:09Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=e65fc92c9d31ea9ffa49c59fea807c0f0b2c92fd'/>
<id>urn:sha1:e65fc92c9d31ea9ffa49c59fea807c0f0b2c92fd</id>
<content type='text'>
## Проблема

После аварийного завершения агента (SIGKILL) или длительной недоступности C++ клиент Unified Agent не восстанавливал соединение сам. Сессия оставалась в состоянии «активна», сообщения накапливались в буфере (inflight), при достижении лимита начинались потери (dropped messages), и доставка не возобновлялась даже после поднятия агента — требовался перезапуск приложения-клиента.

## Как исправлено

Добавлен механизм «страховки»: если у сессии есть не подтверждённые сообщения (inflight), но по активному gRPC-стриму долго нет никакой активности (ни read, ни write, ни finish), клиент принудительно отменяет текущий вызов и запускает обычный путь реконнекта (повторные попытки установки сессии). «Длительность молчания» задаётся новым параметром; по умолчанию механизм включён (30 с) — зависание сессии никому не нужно, отключить можно явно, выставив таймаут в 0.

{% cut "Технические детали" %}

**Корневая причина:** реконнект планировался только в `OnGrpcCallFinished`, то есть после завершения активного stream-вызова. При «зависшем» транспорте (transport stall после падения агента) gRPC мог не вызывать финальный callback, `ActiveGrpcCall` оставался занятым, и новый `MakeGrpcCall` не запускался.

**Изменения в коде:**
- В `TClientParameters` добавлен параметр `GrpcCallInactivityTimeout` (по умолчанию 30 с; 0 = отключено).
- В сессии заведён периодический watchdog-таймер; при срабатывании проверяется: есть ли активный `TGrpcCall`, есть ли inflight-сообщения и не было ли активности дольше заданного таймаута. При выполнении условий вызывается принудительное закрытие текущего call (`BeginClose(true)`), что приводит к `OnGrpcCallFinished` и планированию следующего `MakeGrpcCall` по `GrpcReconnectDelay`.
- Время последней активности обновляется при любом успешном событии стрима (Accept, Read, Write, Finish, а также при инициализации сессии и при ack).

**Тестирование:** добавлен интеграционный тест `TestReconnectAfterLongStall` (агент поднимается → сессия и первая доставка → убийство агента → отправка во время даунтайма → пауза → повторный запуск агента → проверка, что inflight обнуляется и сессия переинициализируется без рестарта приложения). Регрессии по существующим reconnect-тестам не наблюдаются.

{% endcut %}
commit_hash:f55efec2cff20fa975500e73d60ee57654abb2e0
</content>
</entry>
<entry>
<title>Add throttling for max inflight error logs</title>
<updated>2026-01-14T22:51:38Z</updated>
<author>
<name>andybg</name>
<email>andybg@yandex-team.com</email>
</author>
<published>2026-01-14T22:34:18Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=743db03e460759247cc83b5c9f44cba60416b240'/>
<id>urn:sha1:743db03e460759247cc83b5c9f44cba60416b240</id>
<content type='text'>
## Problem
Log spam with repeated ``'max inflight of [***] bytes reached, [***] bytes dropped'`` errors appearing multiple times within the same second, causing log flooding.

## Solution
Implemented one-second throttling mechanism for this specific error message to prevent log spam while maintaining accurate counter tracking.

## Testing
- Added `TestMaxInflightBytesThrottling` integration test
- Confirms throttling limits log entries to ≤3 for 50 rapid message drops (vs 50 without throttling)
- Ensures all dropped message counters remain accurate regardless of throttling
commit_hash:58f44ca8ce2b8b416586f8ca7a3d3ca971f1e9cb
</content>
</entry>
<entry>
<title>feat grpc: update to grpc 1.53.1</title>
<updated>2023-07-17T16:35:29Z</updated>
<author>
<name>leonidlazarev</name>
<email>leonidlazarev@yandex-team.com</email>
</author>
<published>2023-07-17T16:35:29Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=cb8e9a6330e4e5d9a0e2f8506e7469bbd641ec63'/>
<id>urn:sha1:cb8e9a6330e4e5d9a0e2f8506e7469bbd641ec63</id>
<content type='text'>
update grpc to 1.53.1
update grpcio/py3 to 1.53.1

Added patches:
    22-grpc-code-output.patch - allow translation of grpc code to internal string type.
    23-max-thread-limitation.patch - to provide interface for settings of thread number limit, as
    grpc::DynamicThreadPool doesn't provide interface to limit thread number anymore.
    24-support_for-non-abort-grpc.patch - generate exception instead of application crash
    25-forkable-destruction-order.patch - correct forkable logic for TimerManager
    27-skip-child-post-fork-operations.patch - allow to skip child post fork operations to exclude UB (used for unified agent only)
    pr33495_fox_nested_fork.patch - fix issues with nested forks
    pr33582_fork_handler.patch - disable fork handler support  if it is not requested intentionally</content>
</entry>
<entry>
<title>Log backend move</title>
<updated>2023-02-09T09:40:11Z</updated>
<author>
<name>hor911</name>
<email>hor911@ydb.tech</email>
</author>
<published>2023-02-09T09:40:11Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=24689527cd888aa8a640ecb5077e656b3520d373'/>
<id>urn:sha1:24689527cd888aa8a640ecb5077e656b3520d373</id>
<content type='text'>
</content>
</entry>
</feed>
