summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/error/error.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix use-after-free in TError during program shutdownperst2010 days1-13/+29
| | | | | | | | | | | | | | | | --- 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<>() 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<TEnricherStorage> 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
* YT-26105: Make TError aware of ::TSystemErrordann2392026-05-251-0/+2
| | | | commit_hash:ca6efe06865fe9fc9ebfd5ca8bbd79c2acbb4ff3
* YT-27061: Make OKFuture constinitbabenko2026-01-021-25/+13
| | | | commit_hash:3522ca2def9e06894323c3ac1b5e0e4e83572857
* YT: Do not merge OK errors to inner errorsdgolear2025-12-171-10/+9
| | | | commit_hash:7204f6d279e6660168d497e5fc43a8fd6a21acaa
* YT: Fix enricher, add from backtrace enricherpechatnov2025-05-061-8/+34
| | | | | From backtrace enricher можно использовать для захвата бектрейсов при создании ошибок из исключений, а так же для перекладывания атрибутов из сложных исключений других библиотек. commit_hash:76711bd3bb7dbc1e41e43f80d43340d2ce8e4df7
* YT: Add type name of std::exception to error text in TError constructorpechatnov2025-04-011-0/+1
| | | | | | | | | | | | | | | | | | | Без этого, исключение о выходе за пределы массива в векторе выглядит так: ``` vector origin (pid 178121, thread library-cpp-yt-) datetime 2025-03-31T14:59:49.069209Z ``` С фиксом: ``` vector origin (pid 178121, thread library-cpp-yt-) datetime 2025-03-31T14:59:49.069209Z exception_type std::out_of_range ``` commit_hash:7382eba16208f6847d581b901a7df4dfa39452b0
* YTORM-1292 Error enrichment via dependency injectiondeep2025-02-281-2/+30
| | | | | | | Идея такая: хочу подкладывать атрибуты в ошибки, не протаскивая их через стек (как в orm/server/objects) и не прогоняя все ошибки через специальные методы (как в orm/library/attributes). Для этого завожу fiber-local структурку с ленивым выведением строчек. Поскольку TError и TFls живут в разных мирах, пришлось сделать отдельный трамплин для совсем генеричной доработки ошибок в момент создания. Игнат посоветовал глянуть на Codicil. Там очень похоже, но нет key/value, поэтому похитил только название. Вообще, можно унифицировать, если есть запрос. commit_hash:203ec7abe5e8c8484e66d55f16192485db776806
* YT-22593: More trivial TString->std::string migrationsbabenko2025-02-221-17/+16
| | | | | [nodiff:runtime] commit_hash:1ba799aed1703ab7c6304b6da7090b3337f768dd
* yt/error: optimize constructing TError from TErrorExceptionKonstantin Khlebnikov2025-02-161-0/+6
| | | | | | | | | | | Here we can avoid dynamic cast and exception hazard. Signed-off-by: Konstantin Khlebnikov <[email protected]> --- Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/1070 commit_hash:e0709e1fe0f2109792b20b850e0e11a6e96f846a
* YT-21233: Drop dependency on yson in library/cpp/yt/error by switch to ↵arkady-e1ppa2024-12-261-21/+17
| | | | | | | std::string everywhere done commit_hash:8a83afa39917ba66a5161388a7cd74a4488d9908
* YT-21233: Issues and tidying up of rXXXXXXarkady-e1ppa2024-12-251-1/+7
| | | | commit_hash:19481c9fbb008aab4f4d676f1a3a242f6e90e90e
* YT-21233: Adjust (To/From)ErrorAttributeValue CPOs, revert ConvertTo ↵arkady-e1ppa2024-12-251-0/+827
becoming CPO, move TErrorCode and TError to library/cpp/yt/error \[nodiff:caesar\] List of changes: 1) Make `ConvertTo` a normal function again (basically, a revert of previous change). It turned out to be very inconvenient entry point 2) Introduce concept for "Primitive types" which are handled without yt/core module. Please note that inclusion of core **does not** affect work with primitive types (otherwise we would be facing and ODR violation). These are numerics, duration, instant, string-like objects and guid 3) Introduce `FromErrorAttributeValue` which is a substitute to `ConvertTo` with special behavior (see below) 4) Scheme for (de-)serialization has changed: 1) Primitive types are handled via `ConvertToTextYsonString` and `ConvertFromTextYsonString` 2) Other types are not supported without yt/core. Otherwise `ConvertToYsonString(value, EYsonFormat::Text)` used for serialization and `ConvertTo<T>(value)` for deserialization. 5) New format of attribute value storage allows to not care about concrete type of the attribute (text yson strings can be detected since they start with `\"` and deserialized so are text yson bools, everything else is already human readable). This drops dependency on `TTokenizer` 6) Some small parts (e.g. enums or constants or aliases) of yt/core/misc files were moved to library/cpp/yt/\* locations and re-included to drop dependencies of stripped\_error on them 7) `TErrorAttributes` is now a simple hash map instead of a handle to `IAttributeDictionary` 8) `ExtractFromAttributes` weak symbol is finally moved to library/cpp/yt/error due to point 9 allowing to fully drop dependency on `IAttributeDictionary`. Combined with point 7 this drops dep on yt/core/ytree altogether 9) Moved `TErrorCode` to library/cpp/yt/error. There is a logger there which forces dep on library/cpp/yt/logging. It is not required really, and can be later removed 10) Moved `TError` with format and macroes to library/cpp/yt/error. It still (and probably forever will) depend on yson. What can be done next: Switch TYsonString to TString and move ConvertTo/FromTextYsonString to library/cpp/yt/error. This would remove dep on library/cpp/yt/yson\_string commit_hash:6f11dc478ab782a1f98a5aedcd45a4800d3f4e7b