<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/error, branch main</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=main</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-07-21T06:52:42Z</updated>
<entry>
<title>Make THROW_ERROR_EXCEPTION_UNLESS/IF chainable with error attributes</title>
<updated>2026-07-21T06:52:42Z</updated>
<author>
<name>pechatnov</name>
<email>pechatnov@yandex-team.com</email>
</author>
<published>2026-07-21T06:21:36Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=b6bda2264da6775be09d9224c82c5b9587e60052'/>
<id>urn:sha1:b6bda2264da6775be09d9224c82c5b9587e60052</id>
<content type='text'>
commit_hash:4e76ece0b75ab787ed04b6be5f183cecbf9b8167
</content>
</entry>
<entry>
<title>YT-28451: Add tagged logging API and opaque event payload</title>
<updated>2026-07-17T09:07:46Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-07-16T07:32:17Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=cc4f0cb52cee106a1e84c653823087861b8c8df5'/>
<id>urn:sha1:cc4f0cb52cee106a1e84c653823087861b8c8df5</id>
<content type='text'>
Replace `TLogEvent::MessageRef` with an opaque `Payload` that carries the message
together with structured key/value tags, deferring tag rendering to the consumer
(logging thread).

- Add the `TTaggedPayloadWriter`/`TTaggedPayloadReader` codec (`NDetail`), with a
  per-thread chunk-cached builder so tagged logging does no per-message heap
  allocation.
- Model the payload as a typed `TLogEventPayload` — a `std::variant` of the opaque
  strong typedefs `TTaggedLogEventPayload` and `TStructuredLogEventPayload` (each
  over `TSharedRef`). The active alternative identifies the event kind, so the
  separate `ELogMessageKind` enum and `TLogEvent::MessageKind` field are removed;
  consumers dispatch via `std::holds_alternative`/`std::get` instead of a tag.
- Add the fluent `YT_TLOG_*` API: `YT_TLOG_INFO("Message").With(key, value)` and
  `.With(key, value, "%spec")`; disabled levels skip argument evaluation.
- Add well-known tags: `.With(value)` attaches a value under a statically known
  key resolved by ADL (e.g. `.With(error)` for the `Error` tag).
- Teach the plain-text and structured formatters to render tags; add the
  `enable_native_tags` knob to emit tags into a nested structured attribute.
- Add producer-side benchmarks. The tagged API is cheaper than `YT_LOG_*` for
  tagged calls and on par for tag-free ones:

#|
|| **Producer call** | **`YT_LOG_*`** | **`YT_TLOG_*`** | **Δ** ||
|| no tags   | 81 ns  | 82 ns  | +2%  ||
|| 1 tag     | 124 ns | 88 ns  | -29% ||
|| 2 tags    | 140 ns | 101 ns | -28% ||
|| 3 tags    | 372 ns | 283 ns | -24% ||
|#

--

#| || **&lt;a href="https://nda.ya.ru/t/p0sVNSOC7ijzFF" target="_blank"&gt;![](https://nda.ya.ru/t/mAiQIjHx7Mm3JC =30x) Echo tests&lt;/a&gt;** || |#
commit_hash:70efc90e5c2b71e5311415a4e4508db42ff28971
</content>
</entry>
<entry>
<title>Fix use-after-free in TError during program shutdown</title>
<updated>2026-07-12T15:55:57Z</updated>
<author>
<name>perst20</name>
<email>59165467+perst20@users.noreply.github.com</email>
</author>
<published>2026-07-12T15:31:10Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=5b991b83e00ca047828c60502386ca835029bab3'/>
<id>urn:sha1:5b991b83e00ca047828c60502386ca835029bab3</id>
<content type='text'>
---

Type: fix
Component: library/cpp/yt/error

Problem: TError::Enricher_ and TError::FromExceptionEnricher_ are static class members whose destructors are registered when error.cpp is loaded. However, if any code calls Singleton&lt;&gt;() during static initialization before error.cpp loads, the OnExit handler gets registered in standard atexit() first. Due to LIFO ordering, at program exit the enrichers are destroyed before OnExit() runs, but OnExit() then destroys Singletons whose destructors may create TError objects (e.g., to cancel futures), which invokes Enrich() on the already-destroyed std::function, causing use-after-free. This can lead to intermittent segfaults depending on the link order of translation units.

Solution: Store enrichers in a LeakySingleton&lt;TEnricherStorage&gt; so they are never destroyed, as TError can be created anywhere including during program shutdown.

---

Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1582
commit_hash:a9607f0094b4c60414d00ebca844db6a2ceafeb9
</content>
</entry>
<entry>
<title>YT-22593: Reduce TString usage in core/misc</title>
<updated>2026-06-06T22:31:50Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-06T22:15:06Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=ffc038d5a916cec181915795ca4b45f07ee2ae05'/>
<id>urn:sha1:ffc038d5a916cec181915795ca4b45f07ee2ae05</id>
<content type='text'>
commit_hash:ba8c42476d6274212745348071682042e780037f
</content>
</entry>
<entry>
<title>Cache process/thread id getters and use them in TError origin capture</title>
<updated>2026-06-06T21:16:49Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-06T20:52:00Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=f10c7206fb31af8057446bceef9707aabaa9456e'/>
<id>urn:sha1:f10c7206fb31af8057446bceef9707aabaa9456e</id>
<content type='text'>
## Motivation
Profiling the YT master Automaton thread showed TOriginAttributes::Capture (run on every non-OK TError) spending ~60% of its time in a getpid() syscall — uncached on glibc &gt;= 2.25. NYT::GetCurrentThreadId() (gettid) feeds hot thread-affinity / log-manager checks on the same thread.

## Changes
- New library/cpp/yt/system/process_id.* with cached GetProcessId(); GetSystemThreadId() now caches the kernel tid in TLS. Both caches reset in the child after fork.
- Moved thread_name.{h,cpp} from misc to system.
- Removed GetCurrentProcessId/GetCurrentThreadId shims from yt/yt/core/misc/proc.{h,cpp}; migrated all callers to NYT::GetProcessId / NYT::GetSystemThreadId.
- TOriginAttributes::Capture uses the cached getters; recorded Tid is now the real kernel tid (matches perf/ps).
- Added microbenchmarks (library/cpp/yt/system/benchmarks, yt/yt/core/benchmarks/error.cpp).

## Microbenchmarks (release)
| | before | after |
|---|---|---|
| getpid | 101 ns | 0.33 ns |
| gettid | 102 ns | 1.64 ns |
| Capture | 161 ns | 50 ns |
| failed TError | 221 ns | 74 ns |
commit_hash:ee37ae57d61a5a2dd33daee935270f4bb93b7ff9
</content>
</entry>
<entry>
<title>YT-26105: Make TError aware of ::TSystemError</title>
<updated>2026-05-25T08:19:52Z</updated>
<author>
<name>dann239</name>
<email>dann239@yandex-team.com</email>
</author>
<published>2026-05-25T07:58:24Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=b98aa1ad6a725444af35a0070e6dea6f2114f8d3'/>
<id>urn:sha1:b98aa1ad6a725444af35a0070e6dea6f2114f8d3</id>
<content type='text'>
commit_hash:ca6efe06865fe9fc9ebfd5ca8bbd79c2acbb4ff3
</content>
</entry>
<entry>
<title>YT: Add missing 16bit types to TErrorAttribute conversions</title>
<updated>2026-04-30T12:18:42Z</updated>
<author>
<name>dgolear</name>
<email>dgolear@yandex-team.com</email>
</author>
<published>2026-04-30T11:50:22Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=ff286f36b5f9efa572d1fecc8bed6ea553614716'/>
<id>urn:sha1:ff286f36b5f9efa572d1fecc8bed6ea553614716</id>
<content type='text'>
commit_hash:7e973890af2061e2a78b34d31c404f000375a88b
</content>
</entry>
<entry>
<title>Use implicit bool conversion for null check in origin_attributes.cpp</title>
<updated>2026-04-27T13:12:31Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-04-27T12:52:34Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=b36733c26de293fbc1562234f05ce2b41f7251a2'/>
<id>urn:sha1:b36733c26de293fbc1562234f05ce2b41f7251a2</id>
<content type='text'>
commit_hash:cc1f5b9ecc05f6b098f1645ba338fc644c0bb53f
</content>
</entry>
<entry>
<title>Increase default error attributes string truncation limit to 32K</title>
<updated>2026-04-17T21:44:40Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-04-17T21:05:14Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=e42e88962f914b154f2993ea19182f392f0a2bdf'/>
<id>urn:sha1:e42e88962f914b154f2993ea19182f392f0a2bdf</id>
<content type='text'>
commit_hash:da3595c17e930ef69088c3164f42adc50d57f283
</content>
</entry>
<entry>
<title>Fix some use-after-move bugs</title>
<updated>2026-04-17T13:37:33Z</updated>
<author>
<name>pavook</name>
<email>pavook@yandex-team.com</email>
</author>
<published>2026-04-17T12:40:13Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=70edb604e93a313f36e434fd25b312527d59f361'/>
<id>urn:sha1:70edb604e93a313f36e434fd25b312527d59f361</id>
<content type='text'>
commit_hash:4bc357937e76b2b082671bb0f67ac3012ee4dbca
</content>
</entry>
</feed>
