diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-09 23:39:40 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-09 23:57:14 +0300 |
commit | e601ca03f859335d57ecff2e5aa6af234b6052ed (patch) | |
tree | de519a847e58a1b3993fcbfe05ff44cc946a3e24 /library/cpp/actors | |
parent | bbf2b6878af3854815a2c0ecb07a687071787639 (diff) | |
download | ydb-e601ca03f859335d57ecff2e5aa6af234b6052ed.tar.gz |
Y_VERIFY->Y_ABORT_UNLESS at ^l
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/actors')
105 files changed, 466 insertions, 466 deletions
diff --git a/library/cpp/actors/core/actor.cpp b/library/cpp/actors/core/actor.cpp index 73edd82067a..4f7d4c1493d 100644 --- a/library/cpp/actors/core/actor.cpp +++ b/library/cpp/actors/core/actor.cpp @@ -18,7 +18,7 @@ namespace NActors { ui64 count = value >> T::TimestampBits; count += Increment; - Y_VERIFY((count & ~T::CountMask) == 0); + Y_ABORT_UNLESS((count & ~T::CountMask) == 0); ui64 timestamp = value; if (Increment == 1 && count == 1) { @@ -53,7 +53,7 @@ namespace NActors { used += (static_cast<ui64>(time) - value) & TimestampMask; } - Y_VERIFY(LastUsageTimestamp <= time); + Y_ABORT_UNLESS(LastUsageTimestamp <= time); ui64 passed = time - LastUsageTimestamp; LastUsageTimestamp = time; @@ -188,7 +188,7 @@ namespace NActors { void IActor::Die(const TActorContext& ctx) { if (ctx.SelfID) - Y_VERIFY(ctx.SelfID == SelfActorId); + Y_ABORT_UNLESS(ctx.SelfID == SelfActorId); PassAway(); } @@ -206,7 +206,7 @@ namespace NActors { } void TActorVirtualBehaviour::Receive(IActor* actor, std::unique_ptr<IEventHandle> ev) { - Y_VERIFY(!!ev && ev->GetBase()); + Y_ABORT_UNLESS(!!ev && ev->GetBase()); ev->GetBase()->Execute(actor, std::move(ev)); } diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h index 3f9a5751a45..d1514256804 100644 --- a/library/cpp/actors/core/actor.h +++ b/library/cpp/actors/core/actor.h @@ -475,7 +475,7 @@ namespace NActors { } ~TRecurseContext() { - Y_VERIFY(TlsActivationContext == this, "TlsActivationContext mismatch; probably InvokeOtherActor was invoked from a coroutine"); + Y_ABORT_UNLESS(TlsActivationContext == this, "TlsActivationContext mismatch; probably InvokeOtherActor was invoked from a coroutine"); TlsActivationContext = Prev; } } context(actor.SelfId()); @@ -902,7 +902,7 @@ namespace NActors { template <ESendingType SendingType> TActorId IActor::Register(IActor* actor, TMailboxType::EType mailboxType, ui32 poolId) const noexcept { - Y_VERIFY(actor); + Y_ABORT_UNLESS(actor); return TlsActivationContext->ExecutorThread.RegisterActor<SendingType>(actor, mailboxType, poolId, SelfActorId); } @@ -910,8 +910,8 @@ namespace NActors { template <ESendingType SendingType> TActorId TActorSystem::Register(IActor* actor, TMailboxType::EType mailboxType, ui32 executorPool, ui64 revolvingCounter, const TActorId& parentId) { - Y_VERIFY(actor); - Y_VERIFY(executorPool < ExecutorPoolCount, "executorPool# %" PRIu32 ", ExecutorPoolCount# %" PRIu32, + Y_ABORT_UNLESS(actor); + Y_ABORT_UNLESS(executorPool < ExecutorPoolCount, "executorPool# %" PRIu32 ", ExecutorPoolCount# %" PRIu32, (ui32)executorPool, (ui32)ExecutorPoolCount); if constexpr (SendingType == ESendingType::Common) { return CpuManager->GetExecutorPool(executorPool)->Register(actor, mailboxType, revolvingCounter, parentId); diff --git a/library/cpp/actors/core/actor_bootstrapped.h b/library/cpp/actors/core/actor_bootstrapped.h index 5d3d381d6e6..70a6163bc53 100644 --- a/library/cpp/actors/core/actor_bootstrapped.h +++ b/library/cpp/actors/core/actor_bootstrapped.h @@ -16,7 +16,7 @@ namespace NActors { } STFUNC(StateBootstrap) { - Y_VERIFY(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap, "Unexpected bootstrap message"); + Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap, "Unexpected bootstrap message"); using T = decltype(&TDerived::Bootstrap); TDerived& self = static_cast<TDerived&>(*this); if constexpr (std::is_invocable_v<T, TDerived, const TActorContext&>) { diff --git a/library/cpp/actors/core/actor_coroutine.cpp b/library/cpp/actors/core/actor_coroutine.cpp index 8dde637bf25..9b0c81fa265 100644 --- a/library/cpp/actors/core/actor_coroutine.cpp +++ b/library/cpp/actors/core/actor_coroutine.cpp @@ -57,7 +57,7 @@ namespace NActors { } // ensure we have no unprocessed event and return back to actor system to receive one - Y_VERIFY(!Finished); + Y_ABORT_UNLESS(!Finished); // obtain pending event and ensure we've got one while (THolder<IEventHandle> event = ReturnToActorSystem()) { @@ -72,7 +72,7 @@ namespace NActors { bool TActorCoroImpl::ProcessEvent(THolder<IEventHandle> ev) { if (!SelfActorId) { // process bootstrap message, extract actor ids - Y_VERIFY(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap); + Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap); SelfActorId = ev->Recipient; ParentActorId = ev->Sender; ev.Reset(); @@ -97,7 +97,7 @@ namespace NActors { void TActorCoroImpl::Resume(THolder<IEventHandle> ev) { BeforeResume(); - Y_VERIFY(!PendingEvent); + Y_ABORT_UNLESS(!PendingEvent); PendingEvent.Swap(ev); #if CORO_THROUGH_THREADS @@ -106,7 +106,7 @@ namespace NActors { OutEvent.Wait(); #else // save caller context for a later return - Y_VERIFY(!ActorSystemContext); + Y_ABORT_UNLESS(!ActorSystemContext); TExceptionSafeContext actorSystemContext; ActorSystemContext = &actorSystemContext; @@ -114,7 +114,7 @@ namespace NActors { ActorSystemContext->SwitchTo(&FiberContext); #endif - Y_VERIFY(!PendingEvent); + Y_ABORT_UNLESS(!PendingEvent); } void TActorCoroImpl::DoRun() { @@ -150,7 +150,7 @@ namespace NActors { } #else TExceptionSafeContext* returnContext = std::exchange(ActorSystemContext, nullptr); - Y_VERIFY(returnContext); + Y_ABORT_UNLESS(returnContext); if (StoreTlsState) { StoreTlsState(this); } @@ -165,7 +165,7 @@ namespace NActors { } else { // we have returned from the actor system and it kindly asks us to terminate the coroutine as it is being // stopped - Y_VERIFY(InvokedFromDtor); + Y_ABORT_UNLESS(InvokedFromDtor); throw TDtorException(); } } diff --git a/library/cpp/actors/core/actor_virtual.h b/library/cpp/actors/core/actor_virtual.h index c9c34c4729d..9b02660c65d 100644 --- a/library/cpp/actors/core/actor_virtual.h +++ b/library/cpp/actors/core/actor_virtual.h @@ -21,7 +21,7 @@ public: { Y_VERIFY_DEBUG(dynamic_cast<TEvent*>(Handle->GetBase())); Event = static_cast<TEvent*>(Handle->GetBase()); - Y_VERIFY(Event); + Y_ABORT_UNLESS(Event); } }; diff --git a/library/cpp/actors/core/actorid.h b/library/cpp/actors/core/actorid.h index a9cac589b2b..df1cac1c4e7 100644 --- a/library/cpp/actors/core/actorid.h +++ b/library/cpp/actors/core/actorid.h @@ -50,7 +50,7 @@ namespace NActors { } explicit TActorId(ui32 nodeId, const TStringBuf& x) noexcept { - Y_VERIFY(x.size() <= MaxServiceIDLength, "service id is too long"); + Y_ABORT_UNLESS(x.size() <= MaxServiceIDLength, "service id is too long"); Raw.N.LocalId = 0; Raw.N.Hint = 0; Raw.N.NodeId = nodeId | ServiceMask; diff --git a/library/cpp/actors/core/actorsystem.cpp b/library/cpp/actors/core/actorsystem.cpp index 9207e3407e2..b73c5451349 100644 --- a/library/cpp/actors/core/actorsystem.cpp +++ b/library/cpp/actors/core/actorsystem.cpp @@ -106,7 +106,7 @@ namespace NActors { if (recpNodeId != NodeId && recpNodeId != 0) { // if recipient is not local one - rewrite with forward instruction Y_VERIFY_DEBUG(!ev->HasEvent() || ev->GetBase()->IsSerializable()); - Y_VERIFY(ev->Recipient == recipient, + Y_ABORT_UNLESS(ev->Recipient == recipient, "Event rewrite from %s to %s would be lost via interconnect", ev->Recipient.ToString().c_str(), recipient.ToString().c_str()); @@ -255,7 +255,7 @@ namespace NActors { } void TActorSystem::Start() { - Y_VERIFY(StartExecuted == false); + Y_ABORT_UNLESS(StartExecuted == false); StartExecuted = true; ScheduleQueue.Reset(new NSchedulerQueue::TQueueType()); @@ -273,7 +273,7 @@ namespace NActors { TActorSetupCmd& x = setup.ProxyActors[i]; if (x.Actor) { Interconnect[i] = Register(x.Actor.release(), x.MailboxType, x.PoolId, i); - Y_VERIFY(!!Interconnect[i]); + Y_ABORT_UNLESS(!!Interconnect[i]); } } ProxyWrapperFactory = std::move(SystemSetup->Interconnect.ProxyWrapperFactory); @@ -284,7 +284,7 @@ namespace NActors { for (ui32 i = 0, e = (ui32)SystemSetup->LocalServices.size(); i != e; ++i) { std::pair<TActorId, TActorSetupCmd>& x = SystemSetup->LocalServices[i]; const TActorId xid = Register(x.second.Actor.release(), x.second.MailboxType, x.second.PoolId, i); - Y_VERIFY(!!xid); + Y_ABORT_UNLESS(!!xid); if (!!x.first) RegisterLocalService(x.first, xid); } diff --git a/library/cpp/actors/core/actorsystem.h b/library/cpp/actors/core/actorsystem.h index 64a8e827d2a..1b18abc7873 100644 --- a/library/cpp/actors/core/actorsystem.h +++ b/library/cpp/actors/core/actorsystem.h @@ -117,7 +117,7 @@ namespace NActors { ui32 GetThreads(ui32 poolId) const { auto result = GetThreadsOptional(poolId); - Y_VERIFY(result, "undefined pool id: %" PRIu32, (ui32)poolId); + Y_ABORT_UNLESS(result, "undefined pool id: %" PRIu32, (ui32)poolId); return *result; } diff --git a/library/cpp/actors/core/balancer.cpp b/library/cpp/actors/core/balancer.cpp index d82701bbfbd..e09c8345436 100644 --- a/library/cpp/actors/core/balancer.cpp +++ b/library/cpp/actors/core/balancer.cpp @@ -51,11 +51,11 @@ namespace NActors { ui64 idle = std::clamp<i64>(1024 - cpuIdle * 512, 0, 1023); ui64 scale = std::clamp<i64>(1024 - scaleFactor * 32, 0, 1023); - Y_VERIFY(ui64(load) < (1ull << 2ull)); - Y_VERIFY(ui64(priority) < (1ull << 8ull)); - Y_VERIFY(ui64(scale) < (1ull << 10ull)); - Y_VERIFY(ui64(idle) < (1ull << 10ull)); - Y_VERIFY(ui64(poolId) < (1ull << 6ull)); + Y_ABORT_UNLESS(ui64(load) < (1ull << 2ull)); + Y_ABORT_UNLESS(ui64(priority) < (1ull << 8ull)); + Y_ABORT_UNLESS(ui64(scale) < (1ull << 10ull)); + Y_ABORT_UNLESS(ui64(idle) < (1ull << 10ull)); + Y_ABORT_UNLESS(ui64(poolId) < (1ull << 6ull)); static_assert(ui64(MaxPools) <= (1ull << 6ull)); @@ -135,7 +135,7 @@ namespace NActors { Config.MinCpus = std::clamp<ui32>(Config.MinCpus, 1, Config.Cpus); Config.MaxCpus = Max<ui32>(Config.MaxCpus, Config.Cpus); } else { - Y_VERIFY(Config.Cpus == 0, + Y_ABORT_UNLESS(Config.Cpus == 0, "Unexpected negative Config.Cpus# %" PRIi64, (i64)Config.Cpus); Config.MinCpus = 0; @@ -205,7 +205,7 @@ namespace NActors { } void TBalancer::SetPoolStats(TPoolId pool, const TBalancerStats& stats) { - Y_VERIFY(pool < MaxPools); + Y_ABORT_UNLESS(pool < MaxPools); TPool& p = Pools[pool]; p.Prev = p.Next; p.Next = stats; diff --git a/library/cpp/actors/core/benchmark_ut.cpp b/library/cpp/actors/core/benchmark_ut.cpp index 12ef30ecb27..380e983b922 100644 --- a/library/cpp/actors/core/benchmark_ut.cpp +++ b/library/cpp/actors/core/benchmark_ut.cpp @@ -210,8 +210,8 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { : Params(params) , ActiveEventRegistry_(activeEventRegistry) { - Y_VERIFY(!Params.Container.empty()); - Y_VERIFY(Params.Right - Params.Left + 1 <= static_cast<i32>(Params.Container.size()), + Y_ABORT_UNLESS(!Params.Container.empty()); + Y_ABORT_UNLESS(Params.Right - Params.Left + 1 <= static_cast<i32>(Params.Container.size()), "left: %d, right: %d, cont.size: %d", Params.Left, Params.Right, static_cast<i32>(Params.Container.size())); ActiveEventRegistry_.SetActive(this); } @@ -242,7 +242,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { switch (ev->GetTypeRewrite()) { hFunc(TEvQuickSort, Handle); default: - Y_VERIFY(false); + Y_ABORT_UNLESS(false); } } @@ -373,7 +373,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { BENCH_START(thread); - Y_VERIFY(threadPool.AddAndOwn(THolder(new TQuickSortTask(params, activeThreadRegistry)))); + Y_ABORT_UNLESS(threadPool.AddAndOwn(THolder(new TQuickSortTask(params, activeThreadRegistry)))); UNIT_ASSERT_C(activeThreadRegistry.WaitForAllInactive(60s), "timeout"); threaPoolSortDurationTotal += std::chrono::duration_cast<std::chrono::microseconds>(BENCH_END(thread)); @@ -491,7 +491,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { switch (ev->GetTypeRewrite()) { hFunc(TEvKvSendRequests, Handle); default: - Y_VERIFY(false); + Y_ABORT_UNLESS(false); } } @@ -529,7 +529,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { switch (ev->GetTypeRewrite()) { hFunc(TEvKvSearch, Handle); default: - Y_VERIFY(false); + Y_ABORT_UNLESS(false); } } @@ -587,7 +587,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { } } - Y_VERIFY(keys.size() >= requestsNumber); + Y_ABORT_UNLESS(keys.size() >= requestsNumber); std::random_shuffle(keys.begin(), keys.end()); keys.resize(requestsNumber); @@ -709,7 +709,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { BENCH_START(kvSearch); for (auto& key : keysToSearch) { - Y_VERIFY(threadPool.AddAndOwn(THolder(new TKvSearchTask(key, dict)))); + Y_ABORT_UNLESS(threadPool.AddAndOwn(THolder(new TKvSearchTask(key, dict)))); } // CondVar logic gives too much of overhead (2-10 times more than just sleep_for) @@ -897,7 +897,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { hFunc(TEvSumSendRequests, HandleRequest); hFunc(TEvSumVectorResult, HandleResult); default: - Y_VERIFY(false); + Y_ABORT_UNLESS(false); } } @@ -974,7 +974,7 @@ Y_UNIT_TEST_SUITE(ActorSystemBenchmark) { switch (ev->GetTypeRewrite()) { hFunc(TEvSumVector, Handle); default: - Y_VERIFY(false); + Y_ABORT_UNLESS(false); } } diff --git a/library/cpp/actors/core/callstack.cpp b/library/cpp/actors/core/callstack.cpp index 9297c1a079e..559cc73550c 100644 --- a/library/cpp/actors/core/callstack.cpp +++ b/library/cpp/actors/core/callstack.cpp @@ -19,7 +19,7 @@ namespace NActors { void EnableActorCallstack() { if (ActorBackTraceEnableCounter == 0) { - Y_VERIFY(PreviousFormatBackTrace == 0); + Y_ABORT_UNLESS(PreviousFormatBackTrace == 0); PreviousFormatBackTrace = SetFormatBackTraceFn(ActorFormatBackTrace); } @@ -30,7 +30,7 @@ namespace NActors { --ActorBackTraceEnableCounter; if (ActorBackTraceEnableCounter == 0) { - Y_VERIFY(PreviousFormatBackTrace); + Y_ABORT_UNLESS(PreviousFormatBackTrace); SetFormatBackTraceFn(PreviousFormatBackTrace); PreviousFormatBackTrace = 0; } diff --git a/library/cpp/actors/core/config.h b/library/cpp/actors/core/config.h index ab359982417..38aaf77797b 100644 --- a/library/cpp/actors/core/config.h +++ b/library/cpp/actors/core/config.h @@ -146,7 +146,7 @@ namespace NActors { ui32 GetThreads(ui32 poolId) const { auto result = GetThreadsOptional(poolId); - Y_VERIFY(result, "undefined pool id: %" PRIu32, (ui32)poolId); + Y_ABORT_UNLESS(result, "undefined pool id: %" PRIu32, (ui32)poolId); return *result; } }; @@ -218,7 +218,7 @@ namespace NActors { TCpuAllocationConfig(const TCpuMask& available, const TCpuManagerConfig& cfg) { for (const TUnitedExecutorPoolConfig& pool : cfg.United) { - Y_VERIFY(pool.PoolId < MaxPools, "wrong PoolId of united executor pool: %s(%d)", + Y_ABORT_UNLESS(pool.PoolId < MaxPools, "wrong PoolId of united executor pool: %s(%d)", pool.PoolName.c_str(), (pool.PoolId)); } ui32 allocated[MaxPools] = {0}; @@ -240,7 +240,7 @@ namespace NActors { } } for (const TUnitedExecutorPoolConfig& pool : cfg.United) { - Y_VERIFY(allocated[pool.PoolId] > 0, "unable to allocate cpu for united executor pool: %s(%d)", + Y_ABORT_UNLESS(allocated[pool.PoolId] > 0, "unable to allocate cpu for united executor pool: %s(%d)", pool.PoolName.c_str(), (pool.PoolId)); } } diff --git a/library/cpp/actors/core/cpu_manager.cpp b/library/cpp/actors/core/cpu_manager.cpp index 3ec6cea5a37..df4ea486e44 100644 --- a/library/cpp/actors/core/cpu_manager.cpp +++ b/library/cpp/actors/core/cpu_manager.cpp @@ -17,7 +17,7 @@ namespace NActors { Executors.Reset(setup->Executors.Release()); for (ui32 excIdx = 0; excIdx != ExecutorPoolCount; ++excIdx) { IExecutorPool* pool = Executors[excIdx].Get(); - Y_VERIFY(dynamic_cast<TUnitedExecutorPool*>(pool) == nullptr, + Y_ABORT_UNLESS(dynamic_cast<TUnitedExecutorPool*>(pool) == nullptr, "united executor pool is prohibited in explicit mode of NActors::TCpuManager"); } } else { @@ -103,7 +103,7 @@ namespace NActors { void TCpuManager::Cleanup() { for (ui32 round = 0, done = 0; done < ExecutorPoolCount; ++round) { - Y_VERIFY(round < 10, "actorsystem cleanup could not be completed in 10 rounds"); + Y_ABORT_UNLESS(round < 10, "actorsystem cleanup could not be completed in 10 rounds"); done = 0; for (ui32 excIdx = 0; excIdx != ExecutorPoolCount; ++excIdx) { if (Executors[excIdx]->Cleanup()) { diff --git a/library/cpp/actors/core/event.h b/library/cpp/actors/core/event.h index 67ab5199457..4f6aefc0eeb 100644 --- a/library/cpp/actors/core/event.h +++ b/library/cpp/actors/core/event.h @@ -139,8 +139,8 @@ namespace NActors { } static ui32 MakeFlags(ui32 channel, TEventFlags flags) { - Y_VERIFY(channel < (1 << ChannelBits)); - Y_VERIFY(flags < (1 << ChannelShift)); + Y_ABORT_UNLESS(channel < (1 << ChannelBits)); + Y_ABORT_UNLESS(flags < (1 << ChannelShift)); return (flags | (channel << ChannelShift)); } diff --git a/library/cpp/actors/core/event_load.h b/library/cpp/actors/core/event_load.h index 0062ee40db4..c776026cc48 100644 --- a/library/cpp/actors/core/event_load.h +++ b/library/cpp/actors/core/event_load.h @@ -93,7 +93,7 @@ namespace NActors { } TRope EraseBack(size_t count) { - Y_VERIFY(count <= Rope.GetSize()); + Y_ABORT_UNLESS(count <= Rope.GetSize()); TRope::TIterator iter = Rope.End(); iter -= count; return Rope.Extract(iter, Rope.End()); diff --git a/library/cpp/actors/core/event_pb.cpp b/library/cpp/actors/core/event_pb.cpp index a2bf14aa021..a72c52efc2a 100644 --- a/library/cpp/actors/core/event_pb.cpp +++ b/library/cpp/actors/core/event_pb.cpp @@ -15,7 +15,7 @@ namespace NActors { } void TRopeStream::BackUp(int count) { - Y_VERIFY(count <= TotalByteCount); + Y_ABORT_UNLESS(count <= TotalByteCount); Iter -= count; TotalByteCount -= count; } @@ -39,7 +39,7 @@ namespace NActors { TCoroutineChunkSerializer::~TCoroutineChunkSerializer() { CancelFlag = true; Resume(); - Y_VERIFY(Finished); + Y_ABORT_UNLESS(Finished); } bool TCoroutineChunkSerializer::AllowsAliasing() const { @@ -47,7 +47,7 @@ namespace NActors { } void TCoroutineChunkSerializer::Produce(const void *data, size_t size) { - Y_VERIFY(size <= SizeRemain); + Y_ABORT_UNLESS(size <= SizeRemain); SizeRemain -= size; TotalSerializedDataSize += size; @@ -63,9 +63,9 @@ namespace NActors { } bool TCoroutineChunkSerializer::WriteAliasedRaw(const void* data, int size) { - Y_VERIFY(!CancelFlag); - Y_VERIFY(!AbortFlag); - Y_VERIFY(size >= 0); + Y_ABORT_UNLESS(!CancelFlag); + Y_ABORT_UNLESS(!AbortFlag); + Y_ABORT_UNLESS(size >= 0); while (size) { if (const size_t bytesToAppend = Min<size_t>(size, SizeRemain)) { const void *produce = data; @@ -89,15 +89,15 @@ namespace NActors { } bool TCoroutineChunkSerializer::Next(void** data, int* size) { - Y_VERIFY(!CancelFlag); - Y_VERIFY(!AbortFlag); + Y_ABORT_UNLESS(!CancelFlag); + Y_ABORT_UNLESS(!AbortFlag); if (!SizeRemain) { InnerContext.SwitchTo(BufFeedContext); if (CancelFlag || AbortFlag) { return false; } } - Y_VERIFY(SizeRemain); + Y_ABORT_UNLESS(SizeRemain); *data = BufferPtr; *size = SizeRemain; BufferPtr += SizeRemain; @@ -109,11 +109,11 @@ namespace NActors { if (!count) { return; } - Y_VERIFY(count > 0); - Y_VERIFY(!Chunks.empty()); + Y_ABORT_UNLESS(count > 0); + Y_ABORT_UNLESS(!Chunks.empty()); TChunk& buf = Chunks.back(); - Y_VERIFY((size_t)count <= buf.second); - Y_VERIFY(buf.first + buf.second == BufferPtr, "buf# %p:%zu BufferPtr# %p SizeRemain# %zu NumChunks# %zu", + Y_ABORT_UNLESS((size_t)count <= buf.second); + Y_ABORT_UNLESS(buf.first + buf.second == BufferPtr, "buf# %p:%zu BufferPtr# %p SizeRemain# %zu NumChunks# %zu", buf.first, buf.second, BufferPtr, SizeRemain, Chunks.size()); buf.second -= count; if (!buf.second) { @@ -151,7 +151,7 @@ namespace NActors { Y_VERIFY_DEBUG(size); // transfer control to the coroutine - Y_VERIFY(Event); + Y_ABORT_UNLESS(Event); Chunks.clear(); Resume(); @@ -159,21 +159,21 @@ namespace NActors { } void TCoroutineChunkSerializer::SetSerializingEvent(const IEventBase *event) { - Y_VERIFY(Event == nullptr); + Y_ABORT_UNLESS(Event == nullptr); Event = event; TotalSerializedDataSize = 0; AbortFlag = false; } void TCoroutineChunkSerializer::Abort() { - Y_VERIFY(Event); + Y_ABORT_UNLESS(Event); AbortFlag = true; Resume(); } void TCoroutineChunkSerializer::DoRun() { while (!CancelFlag) { - Y_VERIFY(Event); + Y_ABORT_UNLESS(Event); SerializationSuccess = !AbortFlag && Event->SerializeToArcadiaStream(this); Event = nullptr; if (!CancelFlag) { // cancel flag may have been received during serialization @@ -208,7 +208,7 @@ namespace NActors { } bool TAllocChunkSerializer::WriteAliasedRaw(const void*, int) { - Y_VERIFY(false); + Y_ABORT_UNLESS(false); return false; } diff --git a/library/cpp/actors/core/event_pb.h b/library/cpp/actors/core/event_pb.h index a4fdb33fb4a..b6789df2fca 100644 --- a/library/cpp/actors/core/event_pb.h +++ b/library/cpp/actors/core/event_pb.h @@ -303,7 +303,7 @@ namespace NActors { } const TRope& GetPayload(ui32 id) const { - Y_VERIFY(id < Payload.size()); + Y_ABORT_UNLESS(id < Payload.size()); return Payload[id]; } @@ -352,7 +352,7 @@ namespace NActors { total += section.Size; } size_t serialized = CalculateSerializedSize(); - Y_VERIFY(total == serialized, "total# %zu serialized# %zu byteSize# %zd Payload.size# %zu", total, + Y_ABORT_UNLESS(total == serialized, "total# %zu serialized# %zu byteSize# %zd Payload.size# %zu", total, serialized, byteSize, Payload.size()); #endif } diff --git a/library/cpp/actors/core/events_undelivered.cpp b/library/cpp/actors/core/events_undelivered.cpp index 70b9ea2d711..7804d5c09d1 100644 --- a/library/cpp/actors/core/events_undelivered.cpp +++ b/library/cpp/actors/core/events_undelivered.cpp @@ -7,7 +7,7 @@ namespace NActors { } bool TEvents::TEvUndelivered::SerializeToArcadiaStream(TChunkSerializer *serializer) const { - Y_VERIFY(!Unsure); // these are local-only events generated by Interconnect + Y_ABORT_UNLESS(!Unsure); // these are local-only events generated by Interconnect return serializer->WriteString(&Data); } @@ -31,7 +31,7 @@ namespace NActors { IEventBase* TEvents::TEvUndelivered::Load(TEventSerializedData* bufs) { TString str = bufs->GetString(); - Y_VERIFY(str.size() == (sizeof(ui32) + sizeof(ui32))); + Y_ABORT_UNLESS(str.size() == (sizeof(ui32) + sizeof(ui32))); const char* p = str.data(); const ui64 sourceType = ReadUnaligned<ui32>(p + 0); const ui64 reason = ReadUnaligned<ui32>(p + 4); diff --git a/library/cpp/actors/core/executor_pool_base.cpp b/library/cpp/actors/core/executor_pool_base.cpp index ba7ab0e7bef..3658736a7cb 100644 --- a/library/cpp/actors/core/executor_pool_base.cpp +++ b/library/cpp/actors/core/executor_pool_base.cpp @@ -39,8 +39,8 @@ namespace NActors { } auto accountUsage = [&](ui32 activityType, double usage) { - Y_VERIFY(0 <= usage); - Y_VERIFY(usage <= 1); + Y_ABORT_UNLESS(0 <= usage); + Y_ABORT_UNLESS(usage <= 1); int bin = Min<int>(9, usage * 10); ++stats.UsageByActivity[activityType][bin]; }; @@ -50,7 +50,7 @@ namespace NActors { with_lock (StuckObserverMutex) { for (size_t i = 0; i < Actors.size(); ++i) { IActor *actor = Actors[i]; - Y_VERIFY(actor->StuckIndex == i); + Y_ABORT_UNLESS(actor->StuckIndex == i); const TDuration delta = now - actor->LastReceiveTimestamp; if (delta > TDuration::Seconds(30)) { ++stats.StuckActorsByActivity[actor->GetActivityType()]; @@ -137,7 +137,7 @@ namespace NActors { Y_VERIFY_DEBUG(at < Stats.ActorsAliveByActivity.size()); if (at >= Stats.MaxActivityType()) { at = TActorTypeOperator::GetActorActivityIncorrectIndex(); - Y_VERIFY(at < Stats.ActorsAliveByActivity.size()); + Y_ABORT_UNLESS(at < Stats.ActorsAliveByActivity.size()); } AtomicIncrement(Stats.ActorsAliveByActivity[at]); #endif @@ -179,7 +179,7 @@ namespace NActors { #ifdef ACTORSLIB_COLLECT_EXEC_STATS if (ActorSystem->MonitorStuckActors()) { with_lock (StuckObserverMutex) { - Y_VERIFY(actor->StuckIndex == Max<size_t>()); + Y_ABORT_UNLESS(actor->StuckIndex == Max<size_t>()); actor->StuckIndex = Actors.size(); Actors.push_back(actor); } @@ -236,7 +236,7 @@ namespace NActors { #ifdef ACTORSLIB_COLLECT_EXEC_STATS if (ActorSystem->MonitorStuckActors()) { with_lock (StuckObserverMutex) { - Y_VERIFY(actor->StuckIndex == Max<size_t>()); + Y_ABORT_UNLESS(actor->StuckIndex == Max<size_t>()); actor->StuckIndex = Actors.size(); Actors.push_back(actor); } diff --git a/library/cpp/actors/core/executor_pool_basic.cpp b/library/cpp/actors/core/executor_pool_basic.cpp index 54b6e262685..762ab321904 100644 --- a/library/cpp/actors/core/executor_pool_basic.cpp +++ b/library/cpp/actors/core/executor_pool_basic.cpp @@ -162,7 +162,7 @@ namespace NActors { #endif TAtomic state = AtomicLoad(&threadCtx.WaitingFlag); - Y_VERIFY(state == TThreadCtx::WS_NONE, "WaitingFlag# %d", int(state)); + Y_ABORT_UNLESS(state == TThreadCtx::WS_NONE, "WaitingFlag# %d", int(state)); if (SpinThreshold > 0 && !needToBlock) { // spin configured period diff --git a/library/cpp/actors/core/executor_pool_basic_ut.cpp b/library/cpp/actors/core/executor_pool_basic_ut.cpp index ecc889211f0..516eeda2c68 100644 --- a/library/cpp/actors/core/executor_pool_basic_ut.cpp +++ b/library/cpp/actors/core/executor_pool_basic_ut.cpp @@ -73,7 +73,7 @@ private: Y_UNUSED(ev); Action(); TAtomicBase count = AtomicDecrement(Counter); - Y_VERIFY(count != Max<TAtomicBase>()); + Y_ABORT_UNLESS(count != Max<TAtomicBase>()); if (count) { Send(Receiver, new TEvMsg()); } diff --git a/library/cpp/actors/core/executor_pool_united.cpp b/library/cpp/actors/core/executor_pool_united.cpp index 2e689dec59c..a4a9b262696 100644 --- a/library/cpp/actors/core/executor_pool_united.cpp +++ b/library/cpp/actors/core/executor_pool_united.cpp @@ -258,7 +258,7 @@ namespace NActors { // Set specified pool as current, it requires scan for (Current = 0; Current < Size && pool != Items[Current].GetPoolId(); Current++) {} - Y_VERIFY(Current < Size); + Y_ABORT_UNLESS(Current < Size); } // Account currently running pool till now (ts) @@ -266,7 +266,7 @@ namespace NActors { // Skip time slice for the first run and when time goes backwards (e.g. rdtsc is reset to zero on cpu reset) if (Y_LIKELY(Ts > 0 && Ts <= ts)) { TPoolId pool = CurrentPool(); - Y_VERIFY(pool < MaxPools); + Y_ABORT_UNLESS(pool < MaxPools); Items[Current].Account(MinVRunTs, (ts - Ts) * InvWeights[pool]); } Ts = ts; // propagate time @@ -370,7 +370,7 @@ namespace NActors { // Select pool to execute wctx.PoolId = United->AssignedPool(wctx); - Y_VERIFY(wctx.PoolId != CpuShared); + Y_ABORT_UNLESS(wctx.PoolId != CpuShared); if (United->TryAcquireToken(wctx.PoolId)) { return true; } @@ -1123,7 +1123,7 @@ namespace NActors { // NOTE: leave gaps for not united pools (default-initialized) for (const TUnitedExecutorPoolConfig& cfg : unitedPools) { TPool& pool = Pools[cfg.PoolId]; - Y_VERIFY(cfg.PoolId < MaxPools); + Y_ABORT_UNLESS(cfg.PoolId < MaxPools); pool.PoolId = cfg.PoolId; pool.Concurrency = cfg.Concurrency ? cfg.Concurrency : Config.CpuCount; pool.ExecutorPool = nullptr; // should be set later using SetupPool() @@ -1173,7 +1173,7 @@ namespace NActors { cpu.LocalManager->AddWorker(workerId); // Setup worker - Y_VERIFY(workerId < WorkerCount); + Y_ABORT_UNLESS(workerId < WorkerCount); Workers[workerId].Thread.Reset(new TExecutorThread( workerId, cpu.CpuId, diff --git a/library/cpp/actors/core/executor_pool_united_ut.cpp b/library/cpp/actors/core/executor_pool_united_ut.cpp index 2871e016fe0..df3e2d29d8f 100644 --- a/library/cpp/actors/core/executor_pool_united_ut.cpp +++ b/library/cpp/actors/core/executor_pool_united_ut.cpp @@ -78,7 +78,7 @@ private: Y_UNUSED(ev); Action(); TAtomicBase count = AtomicDecrement(Counter); - Y_VERIFY(count != Max<TAtomicBase>()); + Y_ABORT_UNLESS(count != Max<TAtomicBase>()); if (count) { Send(Receiver, new TEvMsg()); } diff --git a/library/cpp/actors/core/interconnect.cpp b/library/cpp/actors/core/interconnect.cpp index 192fb687696..8671fb2db78 100644 --- a/library/cpp/actors/core/interconnect.cpp +++ b/library/cpp/actors/core/interconnect.cpp @@ -59,14 +59,14 @@ namespace NActors { for (int i = 0, count = descriptor->field_count(); i < count; ++i) { const NProtoBuf::FieldDescriptor *field = descriptor->field(i); if (reflection->HasField(*locp, field)) { - Y_VERIFY(field->type() == NProtoBuf::FieldDescriptor::TYPE_STRING, "Location# %s", makeString().data()); + Y_ABORT_UNLESS(field->type() == NProtoBuf::FieldDescriptor::TYPE_STRING, "Location# %s", makeString().data()); Items.emplace_back(TKeys::E(field->number()), reflection->GetString(*locp, field)); } } const NProtoBuf::UnknownFieldSet& unknown = locp->unknown_fields(); for (int i = 0, count = unknown.field_count(); i < count; ++i) { const NProtoBuf::UnknownField& field = unknown.field(i); - Y_VERIFY(field.type() == NProtoBuf::UnknownField::TYPE_LENGTH_DELIMITED, "Location# %s", makeString().data()); + Y_ABORT_UNLESS(field.type() == NProtoBuf::UnknownField::TYPE_LENGTH_DELIMITED, "Location# %s", makeString().data()); Items.emplace_back(TKeys::E(field.number()), field.length_delimited()); } std::sort(Items.begin(), Items.end()); @@ -86,7 +86,7 @@ namespace NActors { NActorsInterconnect::TNodeLocation TNodeLocation::ParseLocation(const TString& s) { NActorsInterconnect::TNodeLocation res; const bool success = res.ParseFromString(s); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); return res; } @@ -134,7 +134,7 @@ namespace NActors { Serialize(&pb, false); TString s; const bool success = pb.SerializeToString(&s); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); return s; } @@ -153,7 +153,7 @@ namespace NActors { case TKeys::Module: { const bool success = TryFromString(value, moduleId); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); break; } @@ -166,7 +166,7 @@ namespace NActors { case TKeys::Unit: { const bool success = TryFromString(value, unitId); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); break; } diff --git a/library/cpp/actors/core/invoke.h b/library/cpp/actors/core/invoke.h index e22d5008532..6151c32bfaf 100644 --- a/library/cpp/actors/core/invoke.h +++ b/library/cpp/actors/core/invoke.h @@ -50,7 +50,7 @@ namespace NActors { if constexpr (std::is_same_v<TArg, std::exception_ptr>) { std::rethrow_exception(arg); } else if constexpr (std::is_void_v<T>) { - Y_VERIFY(!arg.has_value()); + Y_ABORT_UNLESS(!arg.has_value()); } else if (auto *value = std::any_cast<T>(&arg)) { return std::move(*value); } else { @@ -122,7 +122,7 @@ namespace NActors { } void StateFunc(STFUNC_SIG) { - Y_VERIFY(ev->GetTypeRewrite() == TEvents::TSystem::Wakeup); + Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvents::TSystem::Wakeup); auto g = TBase::PassAwayGuard(); Executor(); } diff --git a/library/cpp/actors/core/io_dispatcher.cpp b/library/cpp/actors/core/io_dispatcher.cpp index 6bd753f2e04..c7d28c63e0c 100644 --- a/library/cpp/actors/core/io_dispatcher.cpp +++ b/library/cpp/actors/core/io_dispatcher.cpp @@ -79,7 +79,7 @@ namespace NActors { void StopOne() { with_lock (Mutex) { ++NumThreadsToStop; - Y_VERIFY(NumThreadsToStop); + Y_ABORT_UNLESS(NumThreadsToStop); } CondVar.Signal(); } @@ -144,7 +144,7 @@ namespace NActors { } void StopThread() { - Y_VERIFY(Threads.size()); + Y_ABORT_UNLESS(Threads.size()); TaskQueue.StopOne(); *NumThreads = --NumRunningThreads; ++*ThreadsStopped; @@ -185,7 +185,7 @@ namespace NActors { void HandleThreadStopped(TAutoPtr<IEventHandle> ev) { auto it = Threads.find(ev->Cookie); - Y_VERIFY(it != Threads.end()); + Y_ABORT_UNLESS(it != Threads.end()); it->second->Join(); Threads.erase(it); } diff --git a/library/cpp/actors/core/log.cpp b/library/cpp/actors/core/log.cpp index 71b5d46c22c..18f43a2fed8 100644 --- a/library/cpp/actors/core/log.cpp +++ b/library/cpp/actors/core/log.cpp @@ -529,7 +529,7 @@ namespace NActors { struct tm localTime; time.LocalTime(&localTime); int r = strftime(buf, TimeBufSize, "%Y-%m-%d-%H-%M-%S", &localTime); - Y_VERIFY(r != 0); + Y_ABORT_UNLESS(r != 0); return buf; } @@ -671,7 +671,7 @@ namespace NActors { } void Pop(const TLogContextGuard& context) { - Y_VERIFY(Stack.size() && Stack.back().GetId() == context.GetId()); + Y_ABORT_UNLESS(Stack.size() && Stack.back().GetId() == context.GetId()); Stack.pop_back(); } diff --git a/library/cpp/actors/core/log_settings.cpp b/library/cpp/actors/core/log_settings.cpp index 321af18d71e..fafaf892ebb 100644 --- a/library/cpp/actors/core/log_settings.cpp +++ b/library/cpp/actors/core/log_settings.cpp @@ -51,8 +51,8 @@ namespace NActors { } void TSettings::Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func) { - Y_VERIFY(minVal >= 0, "NLog::TSettings: minVal must be non-negative"); - Y_VERIFY(maxVal > minVal, "NLog::TSettings: maxVal must be greater than minVal"); + Y_ABORT_UNLESS(minVal >= 0, "NLog::TSettings: minVal must be non-negative"); + Y_ABORT_UNLESS(maxVal > minVal, "NLog::TSettings: maxVal must be greater than minVal"); // update bounds if (!MaxVal || minVal < MinVal) { @@ -83,7 +83,7 @@ namespace NActors { // assign new names but validate if newly added members were not used before for (int i = minVal; i <= maxVal; i++) { - Y_VERIFY(!ComponentNames[i], "component name at %d already set: %s", + Y_ABORT_UNLESS(!ComponentNames[i], "component name at %d already set: %s", i, ComponentNames[i].data()); ComponentNames[i] = func(i); } diff --git a/library/cpp/actors/core/mailbox.cpp b/library/cpp/actors/core/mailbox.cpp index b28fdc07717..de746f0ecb8 100644 --- a/library/cpp/actors/core/mailbox.cpp +++ b/library/cpp/actors/core/mailbox.cpp @@ -45,7 +45,7 @@ namespace NActors { const ui32 sx = TMailbox::AlignedSize(); for (ui8* x = begin; x + sx <= end; x += sx) { TMailbox* mailbox = reinterpret_cast<TMailbox*>(x); - Y_VERIFY(IsGoodForCleanup(mailbox)); + Y_ABORT_UNLESS(IsGoodForCleanup(mailbox)); mailbox->ExecutionState = Max<ui32>(); mailbox->~TMailbox(); } @@ -57,7 +57,7 @@ namespace NActors { bool done = true; for (ui8* x = begin; x + sx <= end; x += sx) { TMailbox* mailbox = reinterpret_cast<TMailbox*>(x); - Y_VERIFY(IsGoodForCleanup(mailbox)); + Y_ABORT_UNLESS(IsGoodForCleanup(mailbox)); done &= mailbox->CleanupActors() && mailbox->CleanupEvents(); } return done; @@ -138,7 +138,7 @@ namespace NActors { const ui32 lineIndex = (hint & LineIndexMask) >> LineIndexShift; const ui32 lineHint = hint & LineHintMask; - Y_VERIFY((lineIndex < MaxLines) && (lineHint < LineSize / 64)); + Y_ABORT_UNLESS((lineIndex < MaxLines) && (lineHint < LineSize / 64)); if (lineHint == 0) return nullptr; @@ -172,7 +172,7 @@ namespace NActors { const ui32 lineIndex = (hint & LineIndexMask) >> LineIndexShift; const ui32 lineHint = hint & LineHintMask; - Y_VERIFY((lineIndex < MaxLines) && (lineHint < LineSize / 64)); + Y_ABORT_UNLESS((lineIndex < MaxLines) && (lineHint < LineSize / 64)); if (lineHint == 0) return false; diff --git a/library/cpp/actors/core/mailbox.h b/library/cpp/actors/core/mailbox.h index 0f1c3abc105..0daafa83ac7 100644 --- a/library/cpp/actors/core/mailbox.h +++ b/library/cpp/actors/core/mailbox.h @@ -222,7 +222,7 @@ namespace NActors { switch (ActorPack) { case TMailboxActorPack::Simple: { - Y_VERIFY(ActorsInfo.Simple.ActorId == localActorId); + Y_ABORT_UNLESS(ActorsInfo.Simple.ActorId == localActorId); actorToDestruct = ActorsInfo.Simple.Actor; ActorsInfo.Simple.ActorId = 0; @@ -231,7 +231,7 @@ namespace NActors { } case TMailboxActorPack::Map: { TActorMap::iterator it = ActorsInfo.Map.ActorsMap->find(localActorId); - Y_VERIFY(it != ActorsInfo.Map.ActorsMap->end()); + Y_ABORT_UNLESS(it != ActorsInfo.Map.ActorsMap->end()); actorToDestruct = it->second; ActorsInfo.Map.ActorsMap->erase(it); @@ -260,7 +260,7 @@ namespace NActors { break; } } - Y_VERIFY(found); + Y_ABORT_UNLESS(found); if (ActorsInfo.Array.ActorsCount == 1) { const TActorPair Actor = ActorsInfo.Array.ActorsArray->Actors[0]; diff --git a/library/cpp/actors/core/mailbox_queue_revolving.h b/library/cpp/actors/core/mailbox_queue_revolving.h index b0e78a18db9..22b03320955 100644 --- a/library/cpp/actors/core/mailbox_queue_revolving.h +++ b/library/cpp/actors/core/mailbox_queue_revolving.h @@ -173,7 +173,7 @@ namespace NActors { } bool TryPush(T x) { - Y_VERIFY(x != 0); + Y_ABORT_UNLESS(x != 0); for (ui32 i = 0; i != TWriteConcurrency; ++i) { if (RelaxedLoad(&WriteTo[i]) != nullptr) { diff --git a/library/cpp/actors/core/mon.h b/library/cpp/actors/core/mon.h index ca2001e5f6b..ba5debbd177 100644 --- a/library/cpp/actors/core/mon.h +++ b/library/cpp/actors/core/mon.h @@ -96,7 +96,7 @@ namespace NActors { static TString MakeSerializedQuery(const NActorsProto::TRemoteHttpInfo& info) { TString s(1, '\0'); const bool success = info.AppendToString(&s); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); return s; } @@ -158,7 +158,7 @@ namespace NActors { res->Query = s; res->ExtendedQuery.emplace(); const bool success = res->ExtendedQuery->ParseFromZeroCopyStream(&stream); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); return res.release(); } else { return new TEvRemoteHttpInfo(s); diff --git a/library/cpp/actors/core/mon_ut.cpp b/library/cpp/actors/core/mon_ut.cpp index a2991e8a10c..fa5dbbe71ee 100644 --- a/library/cpp/actors/core/mon_ut.cpp +++ b/library/cpp/actors/core/mon_ut.cpp @@ -16,7 +16,7 @@ Y_UNIT_TEST_SUITE(ActorSystemMon) { TAllocChunkSerializer ser; const bool success = ev->SerializeToArcadiaStream(&ser); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); auto buffer = ser.Release(ev->CreateSerializationInfo()); std::unique_ptr<TEvRemoteHttpInfo> restored(dynamic_cast<TEvRemoteHttpInfo*>(TEvRemoteHttpInfo::Load(buffer.Get()))); UNIT_ASSERT(restored->Query == ev->Query); diff --git a/library/cpp/actors/core/performance_ut.cpp b/library/cpp/actors/core/performance_ut.cpp index 51d10a5e80a..3c1a0ed1433 100644 --- a/library/cpp/actors/core/performance_ut.cpp +++ b/library/cpp/actors/core/performance_ut.cpp @@ -100,7 +100,7 @@ Y_UNIT_TEST_SUITE(ActorSystemPerformance) { switch (ev->GetTypeRewrite()) { HFunc(TEventLocalDolbilkaOld, Handle); default: - Y_VERIFY(false); + Y_ABORT_UNLESS(false); } } @@ -162,13 +162,13 @@ Y_UNIT_TEST_SUITE(ActorSystemPerformance) { while (dNew->GetDurationInProgress() < TDuration::Seconds(1000) && !dNew->IsFinished()) { Sleep(TDuration::Seconds(1)); } - Y_VERIFY(dNew->IsFinished()); + Y_ABORT_UNLESS(dNew->IsFinished()); TDolbilkaOld* dOld = new TDolbilkaOld; runtime->Register(dOld); while (dOld->GetDurationInProgress() < TDuration::Seconds(1000) && !dOld->IsFinished()) { Sleep(TDuration::Seconds(1)); } - Y_VERIFY(dOld->IsFinished()); + Y_ABORT_UNLESS(dOld->IsFinished()); std::unique_ptr<TDolbilkaSimple> dSimple(new TDolbilkaSimple); IDolbilkaSimple* dSimpleIface = dSimple.get(); while (dSimpleIface->ProcessEvent()) { diff --git a/library/cpp/actors/core/scheduler_actor.cpp b/library/cpp/actors/core/scheduler_actor.cpp index db2bcf2791b..513505b5d7e 100644 --- a/library/cpp/actors/core/scheduler_actor.cpp +++ b/library/cpp/actors/core/scheduler_actor.cpp @@ -21,7 +21,7 @@ namespace NActors { TTimerDescriptor() : Descriptor(timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK)) { - Y_VERIFY(Descriptor != -1, "timerfd_create() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(Descriptor != -1, "timerfd_create() failed with %s", strerror(errno)); } ~TTimerDescriptor() override { @@ -92,9 +92,9 @@ namespace NActors { new_time.it_value.tv_nsec = Cfg.ResolutionMicroseconds * 1000; new_time.it_interval.tv_nsec = Cfg.ResolutionMicroseconds * 1000; int ret = timerfd_settime(TimerDescriptor->GetDescriptor(), 0, &new_time, NULL); - Y_VERIFY(ret != -1, "timerfd_settime() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(ret != -1, "timerfd_settime() failed with %s", strerror(errno)); const bool success = ctx.Send(PollerActor, new TEvPollerRegister(TimerDescriptor, SelfId(), {})); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); RealTime = RelaxedLoad(CurrentTimestamp); MonotonicTime = RelaxedLoad(CurrentMonotonic); @@ -141,7 +141,7 @@ namespace NActors { continue; } } - Y_VERIFY(bytesRead == sizeof(expired), "Error while reading from timerfd, strerror# %s", strerror(errno)); + Y_ABORT_UNLESS(bytesRead == sizeof(expired), "Error while reading from timerfd, strerror# %s", strerror(errno)); UpdateTime(); ui32 eventsGottenFromQueues = 0; diff --git a/library/cpp/actors/core/scheduler_basic.cpp b/library/cpp/actors/core/scheduler_basic.cpp index 020f640ac0c..3b4e0a08c1b 100644 --- a/library/cpp/actors/core/scheduler_basic.cpp +++ b/library/cpp/actors/core/scheduler_basic.cpp @@ -43,11 +43,11 @@ namespace NActors { , StopFlag(false) , ScheduleMap(3600) { - Y_VERIFY(!Config.UseSchedulerActor, "Cannot create scheduler thread because Config.UseSchedulerActor# true"); + Y_ABORT_UNLESS(!Config.UseSchedulerActor, "Cannot create scheduler thread because Config.UseSchedulerActor# true"); } TBasicSchedulerThread::~TBasicSchedulerThread() { - Y_VERIFY(!MainCycle); + Y_ABORT_UNLESS(!MainCycle); } void TBasicSchedulerThread::CycleFunc() { @@ -220,7 +220,7 @@ namespace NActors { } void TBasicSchedulerThread::PrepareSchedules(NSchedulerQueue::TReader** readers, ui32 scheduleReadersCount) { - Y_VERIFY(scheduleReadersCount > 0); + Y_ABORT_UNLESS(scheduleReadersCount > 0); TotalReaders = scheduleReadersCount; Readers.Reset(new NSchedulerQueue::TReader*[scheduleReadersCount]); Copy(readers, readers + scheduleReadersCount, Readers.Get()); diff --git a/library/cpp/actors/cppcoro/corobenchmark/main.cpp b/library/cpp/actors/cppcoro/corobenchmark/main.cpp index 20b4d632439..49504e7105e 100644 --- a/library/cpp/actors/cppcoro/corobenchmark/main.cpp +++ b/library/cpp/actors/cppcoro/corobenchmark/main.cpp @@ -62,7 +62,7 @@ Y_CPU_BENCHMARK(TaskCalls, iface) { AwaitThenCallback(IterateTaskValues(iface.Iterations()), [&]{ finished = true; }); - Y_VERIFY(finished); + Y_ABORT_UNLESS(finished); } Y_CPU_BENCHMARK(CoroAwaits, iface) { diff --git a/library/cpp/actors/cppcoro/task_actor.cpp b/library/cpp/actors/cppcoro/task_actor.cpp index d55db4eb04d..8a9451c8e52 100644 --- a/library/cpp/actors/cppcoro/task_actor.cpp +++ b/library/cpp/actors/cppcoro/task_actor.cpp @@ -11,7 +11,7 @@ namespace NActors { struct TCurrentTaskActorGuard { TCurrentTaskActorGuard(TTaskActorImpl* current) noexcept { - Y_VERIFY(TlsCurrentTaskActor == nullptr); + Y_ABORT_UNLESS(TlsCurrentTaskActor == nullptr); TlsCurrentTaskActor = current; } @@ -56,7 +56,7 @@ namespace NActors { : TActor(&TThis::StateBoot) , Task(std::move(task)) { - Y_VERIFY(Task); + Y_ABORT_UNLESS(Task); } ~TTaskActorImpl() { @@ -74,7 +74,7 @@ namespace NActors { } STATEFN(StateBoot) { - Y_VERIFY(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap, "Expected bootstrap event"); + Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvents::TSystem::Bootstrap, "Expected bootstrap event"); TCurrentTaskActorGuard guard(this); Become(&TThis::StateWork); AwaitThenCallback(std::move(Task).WhenDone(), @@ -94,7 +94,7 @@ namespace NActors { switch (ev->GetTypeRewrite()) { hFunc(TEvResumeTask, Handle); default: - Y_VERIFY(EventAwaiter); + Y_ABORT_UNLESS(EventAwaiter); Event.reset(ev.Release()); std::exchange(EventAwaiter, {}).resume(); } @@ -109,17 +109,17 @@ namespace NActors { bool Check() { if (Result->Finished) { - Y_VERIFY(!EventAwaiter, "Task terminated while waiting for the next event"); + Y_ABORT_UNLESS(!EventAwaiter, "Task terminated while waiting for the next event"); PassAway(); return false; } - Y_VERIFY(EventAwaiter, "Task suspended without waiting for the next event"); + Y_ABORT_UNLESS(EventAwaiter, "Task suspended without waiting for the next event"); return true; } void WaitForEvent(std::coroutine_handle<> h) noexcept { - Y_VERIFY(!EventAwaiter, "Task cannot have multiple awaiters for the next event"); + Y_ABORT_UNLESS(!EventAwaiter, "Task cannot have multiple awaiters for the next event"); EventAwaiter = h; } @@ -127,7 +127,7 @@ namespace NActors { if (Stopped) { throw TTaskCancelled(); } - Y_VERIFY(Event, "Task does not have current event"); + Y_ABORT_UNLESS(Event, "Task does not have current event"); return std::move(Event); } @@ -141,12 +141,12 @@ namespace NActors { }; void TTaskActorNextEvent::await_suspend(std::coroutine_handle<> h) noexcept { - Y_VERIFY(TlsCurrentTaskActor, "Not in a task actor context"); + Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); TlsCurrentTaskActor->WaitForEvent(h); } std::unique_ptr<IEventHandle> TTaskActorNextEvent::await_resume() { - Y_VERIFY(TlsCurrentTaskActor, "Not in a task actor context"); + Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); return TlsCurrentTaskActor->FinishWaitForEvent(); } @@ -155,17 +155,17 @@ namespace NActors { } TActorIdentity TTaskActor::SelfId() noexcept { - Y_VERIFY(TlsCurrentTaskActor, "Not in a task actor context"); + Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); return TlsCurrentTaskActor->SelfId(); } TActorId TTaskActor::ParentId() noexcept { - Y_VERIFY(TlsCurrentTaskActor, "Not in a task actor context"); + Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); return TlsCurrentTaskActor->ParentId; } void TAfterAwaiter::await_suspend(std::coroutine_handle<> h) noexcept { - Y_VERIFY(TlsCurrentTaskActor, "Not in a task actor context"); + Y_ABORT_UNLESS(TlsCurrentTaskActor, "Not in a task actor context"); TlsCurrentTaskActor->Schedule(Duration, new TEvResumeTask(h, &Result)); } diff --git a/library/cpp/actors/cppcoro/task_actor_ut.cpp b/library/cpp/actors/cppcoro/task_actor_ut.cpp index 8037dd418dc..79d68b64c2a 100644 --- a/library/cpp/actors/cppcoro/task_actor_ut.cpp +++ b/library/cpp/actors/cppcoro/task_actor_ut.cpp @@ -27,7 +27,7 @@ Y_UNIT_TEST_SUITE(TaskActor) { TTask<void> SimpleResponder() { for (;;) { auto ev = co_await TTaskActor::NextEvent; - Y_VERIFY(ev->GetTypeRewrite() == TEvRequest::EventType); + Y_ABORT_UNLESS(ev->GetTypeRewrite() == TEvRequest::EventType); auto* msg = ev->Get<TEvRequest>(); Y_UNUSED(msg); TTaskActor::SelfId().Send(ev->Sender, new TEvResponse); diff --git a/library/cpp/actors/cppcoro/task_group.h b/library/cpp/actors/cppcoro/task_group.h index b2496f57eb3..0f7a91262be 100644 --- a/library/cpp/actors/cppcoro/task_group.h +++ b/library/cpp/actors/cppcoro/task_group.h @@ -77,8 +77,8 @@ namespace NActors { // Continuation may wake up on another thread return std::noop_coroutine(); } - Y_VERIFY(currentValue != (void*)MarkerAwaiting, "TaskGroup is suspending with an awaiting marker"); - Y_VERIFY(currentValue != (void*)MarkerDetached, "TaskGroup is suspending with a detached marker"); + Y_ABORT_UNLESS(currentValue != (void*)MarkerAwaiting, "TaskGroup is suspending with an awaiting marker"); + Y_ABORT_UNLESS(currentValue != (void*)MarkerDetached, "TaskGroup is suspending with a detached marker"); // Race: ready queue is not actually empty Continuation = {}; return h; @@ -89,9 +89,9 @@ namespace NActors { std::unique_ptr<TTaskGroupResult<T>> result; if (ReadyQueue == nullptr) { void* headValue = LastReady.exchange(nullptr, std::memory_order_acq_rel); - Y_VERIFY(headValue != (void*)MarkerAwaiting, "TaskGroup is resuming with an awaiting marker"); - Y_VERIFY(headValue != (void*)MarkerDetached, "TaskGroup is resuming with a detached marker"); - Y_VERIFY(headValue, "TaskGroup is resuming with an empty queue"); + Y_ABORT_UNLESS(headValue != (void*)MarkerAwaiting, "TaskGroup is resuming with an awaiting marker"); + Y_ABORT_UNLESS(headValue != (void*)MarkerDetached, "TaskGroup is resuming with a detached marker"); + Y_ABORT_UNLESS(headValue, "TaskGroup is resuming with an empty queue"); TTaskGroupResult<T>* head = reinterpret_cast<TTaskGroupResult<T>*>(headValue); while (head) { auto* next = std::exchange(head->Next, nullptr); @@ -100,7 +100,7 @@ namespace NActors { head = next; } } - Y_VERIFY(ReadyQueue != nullptr); + Y_ABORT_UNLESS(ReadyQueue != nullptr); result.reset(ReadyQueue); ReadyQueue = std::exchange(result->Next, nullptr); return result; @@ -122,8 +122,8 @@ namespace NActors { void Detach() noexcept { // After this exchange all new results will be discarded void* headValue = LastReady.exchange((void*)MarkerDetached, std::memory_order_acq_rel); - Y_VERIFY(headValue != (void*)MarkerAwaiting, "TaskGroup is detaching with an awaiting marker"); - Y_VERIFY(headValue != (void*)MarkerDetached, "TaskGroup is detaching with a detached marker"); + Y_ABORT_UNLESS(headValue != (void*)MarkerAwaiting, "TaskGroup is detaching with an awaiting marker"); + Y_ABORT_UNLESS(headValue != (void*)MarkerDetached, "TaskGroup is detaching with a detached marker"); if (headValue) { Dispose(reinterpret_cast<TTaskGroupResult<T>*>(headValue)); } @@ -270,7 +270,7 @@ namespace NActors { {} bool await_ready() const noexcept { - Y_VERIFY(TaskGroup_.TaskCount_ > 0, "Not enough tasks to await"); + Y_ABORT_UNLESS(TaskGroup_.TaskCount_ > 0, "Not enough tasks to await"); --TaskGroup_.TaskCount_; return TaskGroup_.Sink_->Ready(); } diff --git a/library/cpp/actors/cppcoro/task_ut.cpp b/library/cpp/actors/cppcoro/task_ut.cpp index 24ea9d07009..a1ed5426fcd 100644 --- a/library/cpp/actors/cppcoro/task_ut.cpp +++ b/library/cpp/actors/cppcoro/task_ut.cpp @@ -109,13 +109,13 @@ Y_UNIT_TEST_SUITE(Task) { } void Resume(T result) { - Y_VERIFY(Next && !Next.done()); + Y_ABORT_UNLESS(Next && !Next.done()); NextResult = result; std::exchange(Next, {}).resume(); } void Cancel() { - Y_VERIFY(Next && !Next.done()); + Y_ABORT_UNLESS(Next && !Next.done()); NextResult.reset(); std::exchange(Next, {}).resume(); } diff --git a/library/cpp/actors/dnscachelib/dnscache.cpp b/library/cpp/actors/dnscachelib/dnscache.cpp index b72b0aea266..c24888caa52 100644 --- a/library/cpp/actors/dnscachelib/dnscache.cpp +++ b/library/cpp/actors/dnscachelib/dnscache.cpp @@ -445,7 +445,7 @@ TString TDnsCache::THost::AddrsV6ToString() const { TDnsCache::TAresLibInit::TAresLibInit() { #ifdef _win_ const auto res = ares_library_init(ARES_LIB_INIT_ALL); - Y_VERIFY(res == 0); + Y_ABORT_UNLESS(res == 0); #endif } diff --git a/library/cpp/actors/dnsresolver/dnsresolver.cpp b/library/cpp/actors/dnsresolver/dnsresolver.cpp index fb66be86169..bf88d7a41c6 100644 --- a/library/cpp/actors/dnsresolver/dnsresolver.cpp +++ b/library/cpp/actors/dnsresolver/dnsresolver.cpp @@ -19,7 +19,7 @@ namespace NDnsResolver { protected: TAresLibraryInitBase() noexcept { int status = ares_library_init(ARES_LIB_INIT_ALL); - Y_VERIFY(status == ARES_SUCCESS, "Unexpected failure to initialize c-ares library"); + Y_ABORT_UNLESS(status == ARES_SUCCESS, "Unexpected failure to initialize c-ares library"); } ~TAresLibraryInitBase() noexcept { @@ -31,7 +31,7 @@ namespace NDnsResolver { protected: TCallbackQueueBase() noexcept { int err = SocketPair(Sockets, false, true); - Y_VERIFY(err == 0, "Unexpected failure to create a socket pair"); + Y_ABORT_UNLESS(err == 0, "Unexpected failure to create a socket pair"); SetNonBlock(Sockets[0]); SetNonBlock(Sockets[1]); } @@ -46,7 +46,7 @@ namespace NDnsResolver { using TCallbackQueue = NThreading::THTSwapQueue<TCallback>; void PushCallback(TCallback callback) { - Y_VERIFY(callback, "Cannot push an empty callback"); + Y_ABORT_UNLESS(callback, "Cannot push an empty callback"); CallbackQueue.Push(std::move(callback)); // this is a lockfree queue // Wake up worker thread on the first activation @@ -56,7 +56,7 @@ namespace NDnsResolver { #ifdef _win_ ret = send(SignalSock(), &ch, 1, 0); if (ret == -1) { - Y_VERIFY(WSAGetLastError() == WSAEWOULDBLOCK, "Unexpected send error"); + Y_ABORT_UNLESS(WSAGetLastError() == WSAEWOULDBLOCK, "Unexpected send error"); return; } #else @@ -64,11 +64,11 @@ namespace NDnsResolver { ret = send(SignalSock(), &ch, 1, 0); } while (ret == -1 && errno == EINTR); if (ret == -1) { - Y_VERIFY(errno == EAGAIN || errno == EWOULDBLOCK, "Unexpected send error"); + Y_ABORT_UNLESS(errno == EAGAIN || errno == EWOULDBLOCK, "Unexpected send error"); return; } #endif - Y_VERIFY(ret == 1, "Unexpected send result"); + Y_ABORT_UNLESS(ret == 1, "Unexpected send result"); } } @@ -96,7 +96,7 @@ namespace NDnsResolver { if (errno == EAGAIN || errno == EWOULDBLOCK) { break; } - Y_VERIFY(errno == EINTR, "Unexpected recv error"); + Y_ABORT_UNLESS(errno == EINTR, "Unexpected recv error"); #endif } @@ -105,7 +105,7 @@ namespace NDnsResolver { // It's impossible to get signalled while Activations == 0 // We must set Activations = 0 to receive new signals size_t count = Activations.exchange(0, std::memory_order_acq_rel); - Y_VERIFY(count != 0); + Y_ABORT_UNLESS(count != 0); // N.B. due to the way HTSwap works we may not be able to pop // all callbacks on this activation, however we expect a new @@ -190,7 +190,7 @@ namespace NDnsResolver { } int err = ares_init_options(&AresChannel, &options, optmask); - Y_VERIFY(err == 0, "Unexpected failure to initialize c-ares channel"); + Y_ABORT_UNLESS(err == 0, "Unexpected failure to initialize c-ares channel"); if (Options.Servers) { TStringBuilder csv; @@ -201,7 +201,7 @@ namespace NDnsResolver { csv << server; } err = ares_set_servers_ports_csv(AresChannel, csv.c_str()); - Y_VERIFY(err == 0, "Unexpected failure to set a list of dns servers: %s", ares_strerror(err)); + Y_ABORT_UNLESS(err == 0, "Unexpected failure to set a list of dns servers: %s", ares_strerror(err)); } } @@ -219,7 +219,7 @@ namespace NDnsResolver { }) void Handle(TEvents::TEvPoison::TPtr&) { - Y_VERIFY(!Stopped); + Y_ABORT_UNLESS(!Stopped); PushCallback([this] { // Cancel all current ares requests (will send notifications) diff --git a/library/cpp/actors/dnsresolver/dnsresolver.h b/library/cpp/actors/dnsresolver/dnsresolver.h index 88fc74df7d1..1121c31e51c 100644 --- a/library/cpp/actors/dnsresolver/dnsresolver.h +++ b/library/cpp/actors/dnsresolver/dnsresolver.h @@ -70,13 +70,13 @@ namespace NDnsResolver { const TIPv6Addr& GetAddrV6() const { const TIPv6Addr* p = std::get_if<TIPv6Addr>(&Addr); - Y_VERIFY(p, "Result is not an ipv6 address"); + Y_ABORT_UNLESS(p, "Result is not an ipv6 address"); return *p; } const TIPv4Addr& GetAddrV4() const { const TIPv4Addr* p = std::get_if<TIPv4Addr>(&Addr); - Y_VERIFY(p, "Result is not an ipv4 address"); + Y_ABORT_UNLESS(p, "Result is not an ipv4 address"); return *p; } }; diff --git a/library/cpp/actors/dnsresolver/dnsresolver_caching.cpp b/library/cpp/actors/dnsresolver/dnsresolver_caching.cpp index d16fc28e5f8..bc3e5c3d7e6 100644 --- a/library/cpp/actors/dnsresolver/dnsresolver_caching.cpp +++ b/library/cpp/actors/dnsresolver/dnsresolver_caching.cpp @@ -137,7 +137,7 @@ namespace NDnsResolver { void Handle(TEvDns::TEvGetHostByNameResult::TPtr& ev) { auto waitingIt = WaitingRequests.find(ev->Cookie); - Y_VERIFY(waitingIt != WaitingRequests.end(), "Unexpected reply, reqId=%" PRIu64, ev->Cookie); + Y_ABORT_UNLESS(waitingIt != WaitingRequests.end(), "Unexpected reply, reqId=%" PRIu64, ev->Cookie); auto waitingInfo = waitingIt->second; WaitingRequests.erase(waitingIt); @@ -161,7 +161,7 @@ namespace NDnsResolver { switch (ev->Get()->SourceType) { case TEvDns::TEvGetHostByName::EventType: { auto waitingIt = WaitingRequests.find(ev->Cookie); - Y_VERIFY(waitingIt != WaitingRequests.end(), "Unexpected TEvUndelivered, reqId=%" PRIu64, ev->Cookie); + Y_ABORT_UNLESS(waitingIt != WaitingRequests.end(), "Unexpected TEvUndelivered, reqId=%" PRIu64, ev->Cookie); auto waitingInfo = waitingIt->second; WaitingRequests.erase(waitingIt); @@ -253,7 +253,7 @@ namespace NDnsResolver { EnsureRequest(state, req->Name, family, now); if (state.IsHardExpired(now)) { - Y_VERIFY(state.Waiting); + Y_ABORT_UNLESS(state.Waiting); if (MonCounters) { ++*MonCounters->CacheMisses; } @@ -396,7 +396,7 @@ namespace NDnsResolver { auto& req = WaitingRequests[reqId]; req.Position = NameToState.find(name); req.Family = family; - Y_VERIFY(req.Position != NameToState.end()); + Y_ABORT_UNLESS(req.Position != NameToState.end()); Send(Upstream, new TEvDns::TEvGetHostByName(name, family), IEventHandle::FlagTrackDelivery, reqId); state.Waiting = true; @@ -484,7 +484,7 @@ namespace NDnsResolver { } auto& state = it->second.StateByFamily(family); - Y_VERIFY(state.Waiting, "Got error for a state we are not waiting"); + Y_ABORT_UNLESS(state.Waiting, "Got error for a state we are not waiting"); state.Waiting = false; // When we have a cached positive reply, don't overwrite it with spurious errors @@ -532,7 +532,7 @@ namespace NDnsResolver { } auto& state = it->second.StateByFamily(family); - Y_VERIFY(state.Waiting, "Got reply for a state we are not waiting"); + Y_ABORT_UNLESS(state.Waiting, "Got reply for a state we are not waiting"); state.Waiting = false; state.Status = ARES_SUCCESS; @@ -567,7 +567,7 @@ namespace NDnsResolver { } bool& flag = family.*FamilyToFlag; - Y_VERIFY(flag); + Y_ABORT_UNLESS(flag); heap.pop(); flag = false; diff --git a/library/cpp/actors/dnsresolver/dnsresolver_caching_ut.cpp b/library/cpp/actors/dnsresolver/dnsresolver_caching_ut.cpp index 89a7e9ab368..60a45f6fba0 100644 --- a/library/cpp/actors/dnsresolver/dnsresolver_caching_ut.cpp +++ b/library/cpp/actors/dnsresolver/dnsresolver_caching_ut.cpp @@ -21,14 +21,14 @@ Y_UNIT_TEST_SUITE(CachingDnsResolver) { TString operator()(const struct in6_addr& addr) const { char dst[INET6_ADDRSTRLEN]; auto res = ares_inet_ntop(AF_INET6, &addr, dst, INET6_ADDRSTRLEN); - Y_VERIFY(res, "Cannot convert ipv6 address"); + Y_ABORT_UNLESS(res, "Cannot convert ipv6 address"); return dst; } TString operator()(const struct in_addr& addr) const { char dst[INET_ADDRSTRLEN]; auto res = ares_inet_ntop(AF_INET, &addr, dst, INET_ADDRSTRLEN); - Y_VERIFY(res, "Cannot convert ipv4 address"); + Y_ABORT_UNLESS(res, "Cannot convert ipv4 address"); return dst; } }; @@ -46,7 +46,7 @@ Y_UNIT_TEST_SUITE(CachingDnsResolver) { TVector<struct in_addr> AddrsV4; static TMockReply Error(int status, TDuration delay = DefaultDelay) { - Y_VERIFY(status != 0); + Y_ABORT_UNLESS(status != 0); TMockReply reply; reply.Status = status; reply.Delay = delay; @@ -65,7 +65,7 @@ Y_UNIT_TEST_SUITE(CachingDnsResolver) { for (const TString& addr : addrs) { void* dst = &reply.AddrsV6.emplace_back(); int status = ares_inet_pton(AF_INET6, addr.c_str(), dst); - Y_VERIFY(status == 1, "Invalid ipv6 address: %s", addr.c_str()); + Y_ABORT_UNLESS(status == 1, "Invalid ipv6 address: %s", addr.c_str()); } return reply; } @@ -76,7 +76,7 @@ Y_UNIT_TEST_SUITE(CachingDnsResolver) { for (const TString& addr : addrs) { void* dst = &reply.AddrsV4.emplace_back(); int status = ares_inet_pton(AF_INET, addr.c_str(), dst); - Y_VERIFY(status == 1, "Invalid ipv4 address: %s", addr.c_str()); + Y_ABORT_UNLESS(status == 1, "Invalid ipv4 address: %s", addr.c_str()); } return reply; } @@ -90,7 +90,7 @@ Y_UNIT_TEST_SUITE(CachingDnsResolver) { } friend TMockReply operator+(const TMockReply& a, const TMockReply& b) { - Y_VERIFY(a.Status == b.Status); + Y_ABORT_UNLESS(a.Status == b.Status); TMockReply result; result.Status = a.Status; result.Delay = Max(a.Delay, b.Delay); diff --git a/library/cpp/actors/dnsresolver/dnsresolver_ut.cpp b/library/cpp/actors/dnsresolver/dnsresolver_ut.cpp index 0c343a805ce..93c4b832e27 100644 --- a/library/cpp/actors/dnsresolver/dnsresolver_ut.cpp +++ b/library/cpp/actors/dnsresolver/dnsresolver_ut.cpp @@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(DnsResolver) { TSilentUdpServer() { TSockAddrInet addr("127.0.0.1", 0); int err = Socket.Bind(&addr); - Y_VERIFY(err == 0, "Cannot bind a udp socket"); + Y_ABORT_UNLESS(err == 0, "Cannot bind a udp socket"); Port = addr.GetPort(); } }; diff --git a/library/cpp/actors/examples/01_ping_pong/main.cpp b/library/cpp/actors/examples/01_ping_pong/main.cpp index c9223f78ef3..437f06eadd6 100644 --- a/library/cpp/actors/examples/01_ping_pong/main.cpp +++ b/library/cpp/actors/examples/01_ping_pong/main.cpp @@ -81,8 +81,8 @@ public: }; THolder<TActorSystemSetup> BuildActorSystemSetup(ui32 threads, ui32 pools) { - Y_VERIFY(threads > 0 && threads < 100); - Y_VERIFY(pools > 0 && pools < 10); + Y_ABORT_UNLESS(threads > 0 && threads < 100); + Y_ABORT_UNLESS(pools > 0 && pools < 10); auto setup = MakeHolder<TActorSystemSetup>(); diff --git a/library/cpp/actors/examples/02_discovery/lookup.cpp b/library/cpp/actors/examples/02_discovery/lookup.cpp index bcae477034b..fb136a431c9 100644 --- a/library/cpp/actors/examples/02_discovery/lookup.cpp +++ b/library/cpp/actors/examples/02_discovery/lookup.cpp @@ -106,7 +106,7 @@ public: {} void Bootstrap() { - Y_VERIFY(Config->Replicas.size() > 0); + Y_ABORT_UNLESS(Config->Replicas.size() > 0); TotalReplicas = Config->Replicas.size(); RequestActors.reserve(TotalReplicas); diff --git a/library/cpp/actors/examples/02_discovery/main.cpp b/library/cpp/actors/examples/02_discovery/main.cpp index 379fd6de84d..9dec850c77a 100644 --- a/library/cpp/actors/examples/02_discovery/main.cpp +++ b/library/cpp/actors/examples/02_discovery/main.cpp @@ -31,7 +31,7 @@ void OnTerminate(int) { } THolder<TActorSystemSetup> BuildActorSystemSetup(ui32 nodeId, ui32 threads, NMonitoring::TDynamicCounters &counters) { - Y_VERIFY(threads > 0 && threads < 100); + Y_ABORT_UNLESS(threads > 0 && threads < 100); auto setup = MakeHolder<TActorSystemSetup>(); diff --git a/library/cpp/actors/helpers/activeactors.h b/library/cpp/actors/helpers/activeactors.h index 0fdb0fab108..ec482e93c87 100644 --- a/library/cpp/actors/helpers/activeactors.h +++ b/library/cpp/actors/helpers/activeactors.h @@ -14,7 +14,7 @@ namespace NActors { public: void Insert(const TActorId &aid) { bool inserted = insert(aid).second; - Y_VERIFY(inserted); + Y_ABORT_UNLESS(inserted); } void Insert(const TActiveActors &moreActors) { @@ -25,7 +25,7 @@ namespace NActors { void Erase(const TActorId &aid) { auto num = erase(aid); - Y_VERIFY(num == 1); + Y_ABORT_UNLESS(num == 1); } size_t KillAndClear(const TActorContext &ctx) { diff --git a/library/cpp/actors/helpers/mon_histogram_helper.h b/library/cpp/actors/helpers/mon_histogram_helper.h index a9a57e38238..2c5ef0bbee3 100644 --- a/library/cpp/actors/helpers/mon_histogram_helper.h +++ b/library/cpp/actors/helpers/mon_histogram_helper.h @@ -37,7 +37,7 @@ namespace NActors { void Add(ui64 val) { Y_ASSERT(FirstBucketVal != 0); Y_ASSERT(BucketCount != 0); - Y_VERIFY(val <= (1ULL << 63ULL)); + Y_ABORT_UNLESS(val <= (1ULL << 63ULL)); size_t ind = 0; if (val > FirstBucketVal) { ind = GetValueBitCount((2 * val - 1) / FirstBucketVal) - 1; diff --git a/library/cpp/actors/helpers/pool_stats_collector.h b/library/cpp/actors/helpers/pool_stats_collector.h index 9e6550dacee..1f9a6a1ebb7 100644 --- a/library/cpp/actors/helpers/pool_stats_collector.h +++ b/library/cpp/actors/helpers/pool_stats_collector.h @@ -62,7 +62,7 @@ private: void Set(const TExecutorThreadStats& stats) { for (ui32 i : xrange(stats.MaxActivityType())) { - Y_VERIFY(i < GetActivityTypeCount()); + Y_ABORT_UNLESS(i < GetActivityTypeCount()); ui64 ticks = stats.ElapsedTicksByActivity[i]; ui64 events = stats.ReceivedEventsByActivity[i]; ui64 actors = stats.ActorsAliveByActivity[i]; @@ -91,7 +91,7 @@ private: private: void InitCountersForActivity(ui32 activityType) { - Y_VERIFY(activityType < GetActivityTypeCount()); + Y_ABORT_UNLESS(activityType < GetActivityTypeCount()); auto bucketName = TString(GetActivityTypeName(activityType)); diff --git a/library/cpp/actors/http/http.h b/library/cpp/actors/http/http.h index 8b35de737ee..a2d8004a64b 100644 --- a/library/cpp/actors/http/http.h +++ b/library/cpp/actors/http/http.h @@ -647,7 +647,7 @@ public: Stage = ERenderStage::Error; break; } - Y_VERIFY(size == BufferType::Size()); + Y_ABORT_UNLESS(size == BufferType::Size()); } TStringBuf GetRawData() const { diff --git a/library/cpp/actors/http/http_proxy_acceptor.cpp b/library/cpp/actors/http/http_proxy_acceptor.cpp index 4ff09ec7aa4..f9ee1d8032e 100644 --- a/library/cpp/actors/http/http_proxy_acceptor.cpp +++ b/library/cpp/actors/http/http_proxy_acceptor.cpp @@ -132,7 +132,7 @@ protected: } int err = errno; if (err == EAGAIN || err == EWOULDBLOCK) { // request poller for further connection polling - Y_VERIFY(PollerToken); + Y_ABORT_UNLESS(PollerToken); PollerToken->Request(true, false); } } diff --git a/library/cpp/actors/http/http_proxy_incoming.cpp b/library/cpp/actors/http/http_proxy_incoming.cpp index f6d26ec3ebb..68bd5f6ecb0 100644 --- a/library/cpp/actors/http/http_proxy_incoming.cpp +++ b/library/cpp/actors/http/http_proxy_incoming.cpp @@ -222,7 +222,7 @@ protected: while (CurrentResponse != nullptr) { size_t size = CurrentResponse->Size(); if (size == 0) { - Y_VERIFY(Requests.front() == CurrentResponse->GetRequest()); + Y_ABORT_UNLESS(Requests.front() == CurrentResponse->GetRequest()); bool close = CurrentResponse->IsConnectionClose(); Requests.pop_front(); CleanupResponse(CurrentResponse); diff --git a/library/cpp/actors/interconnect/channel_scheduler.h b/library/cpp/actors/interconnect/channel_scheduler.h index 1528810d0d8..3040601ef2f 100644 --- a/library/cpp/actors/interconnect/channel_scheduler.h +++ b/library/cpp/actors/interconnect/channel_scheduler.h @@ -43,7 +43,7 @@ namespace NActors { } TEventOutputChannel *PickChannelWithLeastConsumedWeight() { - Y_VERIFY(!Heap.empty()); + Y_ABORT_UNLESS(!Heap.empty()); return Heap.front().Channel; } diff --git a/library/cpp/actors/interconnect/event_holder_pool.h b/library/cpp/actors/interconnect/event_holder_pool.h index 59df9bd4c8b..0afa1d7a7ce 100644 --- a/library/cpp/actors/interconnect/event_holder_pool.h +++ b/library/cpp/actors/interconnect/event_holder_pool.h @@ -17,12 +17,12 @@ namespace NActors { ~TEvFreeItems() { if (Counter) { TAtomicBase res = Counter->fetch_sub(NumBytes) - NumBytes; - Y_VERIFY(res >= 0); + Y_ABORT_UNLESS(res >= 0); } } bool GetInLineForDestruction(const TIntrusivePtr<TInterconnectProxyCommon>& common) { - Y_VERIFY(!Counter); + Y_ABORT_UNLESS(!Counter); const auto& counter = common->DestructorQueueSize; const auto& max = common->MaxDestructorQueueSize; if (counter && (TAtomicBase)(counter->fetch_add(NumBytes) + NumBytes) > max) { diff --git a/library/cpp/actors/interconnect/handshake_broker.h b/library/cpp/actors/interconnect/handshake_broker.h index d2e1b8b6ac4..d657e7dd516 100644 --- a/library/cpp/actors/interconnect/handshake_broker.h +++ b/library/cpp/actors/interconnect/handshake_broker.h @@ -77,7 +77,7 @@ namespace NActors { } const size_t n = WaiterLookup.erase(waiter); - Y_VERIFY(n == 1); + Y_ABORT_UNLESS(n == 1); Send(waiter, new TEvHandshakeBrokerPermit()); PermittedLeases.insert(waiter); @@ -105,7 +105,7 @@ namespace NActors { } else { const auto [it, inserted] = WaiterLookup.try_emplace(sender, Waiters.insert(Waiters.end(), sender)); - Y_VERIFY(inserted); + Y_ABORT_UNLESS(inserted); } } @@ -114,7 +114,7 @@ namespace NActors { if (!PermittedLeases.erase(sender)) { // Lease was not permitted yet, remove sender from Waiters queue const auto it = WaiterLookup.find(sender); - Y_VERIFY(it != WaiterLookup.end()); + Y_ABORT_UNLESS(it != WaiterLookup.end()); Waiters.erase(it->second); WaiterLookup.erase(it); } diff --git a/library/cpp/actors/interconnect/interconnect_address.cpp b/library/cpp/actors/interconnect/interconnect_address.cpp index d6adb8098d8..124cd613253 100644 --- a/library/cpp/actors/interconnect/interconnect_address.cpp +++ b/library/cpp/actors/interconnect/interconnect_address.cpp @@ -15,7 +15,7 @@ namespace NInterconnect { TAddress::TAddress(NAddr::IRemoteAddr& addr) { socklen_t len = addr.Len(); - Y_VERIFY(len <= sizeof(Addr)); + Y_ABORT_UNLESS(len <= sizeof(Addr)); memcpy(&Addr.Generic, addr.Addr(), len); } diff --git a/library/cpp/actors/interconnect/interconnect_channel.cpp b/library/cpp/actors/interconnect/interconnect_channel.cpp index 6987c344de0..ab6af8f8d4b 100644 --- a/library/cpp/actors/interconnect/interconnect_channel.cpp +++ b/library/cpp/actors/interconnect/interconnect_channel.cpp @@ -20,7 +20,7 @@ namespace NActors { auto traceId = event.Span.GetTraceId(); event.Span.EndOk(); - Y_VERIFY(SerializationInfo); + Y_ABORT_UNLESS(SerializationInfo); const ui32 flags = (event.Descr.Flags & ~IEventHandle::FlagForwardOnNondelivery) | (SerializationInfo->IsExtendedFormat ? IEventHandle::FlagExtendedFormat : 0); @@ -65,7 +65,7 @@ namespace NActors { bool TEventOutputChannel::FeedBuf(TTcpPacketOutTask& task, ui64 serial, ui64 *weightConsumed) { for (;;) { - Y_VERIFY(!Queue.empty()); + Y_ABORT_UNLESS(!Queue.empty()); TEventHolder& event = Queue.front(); switch (State) { @@ -125,7 +125,7 @@ namespace NActors { for (const auto& section : SerializationInfo->Sections) { totalSectionSize += section.Size; } - Y_VERIFY(totalSectionSize == event.EventSerializedSize); + Y_ABORT_UNLESS(totalSectionSize == event.EventSerializedSize); } while (SectionIndex != SerializationInfo->Sections.size()) { @@ -142,7 +142,7 @@ namespace NActors { if (section.IsInline && Params.UseXdcShuffle) { type = static_cast<ui8>(EXdcCommand::DECLARE_SECTION_INLINE); } - Y_VERIFY(p <= std::end(sectionInfo)); + Y_ABORT_UNLESS(p <= std::end(sectionInfo)); const size_t declareLen = p - sectionInfo; if (sizeof(TChannelPart) + XdcData.size() + declareLen <= task.GetInternalFreeAmount() && @@ -209,7 +209,7 @@ namespace NActors { } complete = Chunker.IsComplete(); if (complete) { - Y_VERIFY(Chunker.IsSuccessfull()); + Y_ABORT_UNLESS(Chunker.IsSuccessfull()); } } } else if (event.Buffer) { @@ -223,7 +223,7 @@ namespace NActors { } else { Y_FAIL(); } - Y_VERIFY(!complete || event.EventActuallySerialized == event.EventSerializedSize, + Y_ABORT_UNLESS(!complete || event.EventActuallySerialized == event.EventSerializedSize, "EventActuallySerialized# %" PRIu32 " EventSerializedSize# %" PRIu32 " Type# 0x%08" PRIx32, event.EventActuallySerialized, event.EventSerializedSize, event.Descr.Type); @@ -244,7 +244,7 @@ namespace NActors { IsPartInline = false; PartLenRemain = Max<size_t>(); } else { - Y_VERIFY(SectionIndex < sections.size()); + Y_ABORT_UNLESS(SectionIndex < sections.size()); IsPartInline = sections[SectionIndex].IsInline; while (SectionIndex < sections.size() && IsPartInline == sections[SectionIndex].IsInline) { PartLenRemain += sections[SectionIndex].Size; @@ -276,7 +276,7 @@ namespace NActors { const bool complete = SerializeEvent<false>(task, event, &bytesSerialized); Y_VERIFY_DEBUG(bytesSerialized); - Y_VERIFY(bytesSerialized <= Max<ui16>()); + Y_ABORT_UNLESS(bytesSerialized <= Max<ui16>()); TChannelPart part{ .ChannelFlags = ChannelId, @@ -304,7 +304,7 @@ namespace NActors { size_t bytesSerialized = 0; const bool complete = SerializeEvent<true>(task, event, &bytesSerialized); - Y_VERIFY(0 < bytesSerialized && bytesSerialized <= Max<ui16>()); + Y_ABORT_UNLESS(0 < bytesSerialized && bytesSerialized <= Max<ui16>()); char buffer[partSize]; TChannelPart *part = reinterpret_cast<TChannelPart*>(buffer); @@ -338,12 +338,12 @@ namespace NActors { void TEventOutputChannel::NotifyUndelivered() { LOG_DEBUG_IC_SESSION("ICOCH89", "Notyfying about Undelivered messages! NotYetConfirmed size: %zu, Queue size: %zu", NotYetConfirmed.size(), Queue.size()); if (State == EState::BODY && Queue.front().Event) { - Y_VERIFY(!Chunker.IsComplete()); // chunk must have an event being serialized - Y_VERIFY(!Queue.empty()); // this event must be the first event in queue + Y_ABORT_UNLESS(!Chunker.IsComplete()); // chunk must have an event being serialized + Y_ABORT_UNLESS(!Queue.empty()); // this event must be the first event in queue TEventHolder& event = Queue.front(); - Y_VERIFY(Chunker.GetCurrentEvent() == event.Event.Get()); // ensure the event is valid + Y_ABORT_UNLESS(Chunker.GetCurrentEvent() == event.Event.Get()); // ensure the event is valid Chunker.Abort(); // stop serializing current event - Y_VERIFY(Chunker.IsComplete()); + Y_ABORT_UNLESS(Chunker.IsComplete()); } for (auto& item : NotYetConfirmed) { if (item.Descr.Flags & IEventHandle::FlagGenerateUnsureUndelivered) { // notify only when unsure flag is set diff --git a/library/cpp/actors/interconnect/interconnect_counters.cpp b/library/cpp/actors/interconnect/interconnect_counters.cpp index 3278160aef7..1c55eab650a 100644 --- a/library/cpp/actors/interconnect/interconnect_counters.cpp +++ b/library/cpp/actors/interconnect/interconnect_counters.cpp @@ -312,7 +312,7 @@ namespace { } const TOutputChannel& GetOutputChannel(ui16 index) const { - Y_VERIFY(Initialized); + Y_ABORT_UNLESS(Initialized); const auto it = OutputChannels.find(index); return it != OutputChannels.end() ? it->second : OtherOutputChannel; } @@ -642,7 +642,7 @@ namespace { } const TOutputChannel& GetOutputChannel(ui16 index) const { - Y_VERIFY(Initialized_); + Y_ABORT_UNLESS(Initialized_); const auto it = OutputChannels_.find(index); return it != OutputChannels_.end() ? it->second : OtherOutputChannel_; } diff --git a/library/cpp/actors/interconnect/interconnect_handshake.cpp b/library/cpp/actors/interconnect/interconnect_handshake.cpp index cb4788a33c0..3c1e90115ae 100644 --- a/library/cpp/actors/interconnect/interconnect_handshake.cpp +++ b/library/cpp/actors/interconnect/interconnect_handshake.cpp @@ -154,13 +154,13 @@ namespace NActors { } void RegisterInPoller() { - Y_VERIFY(!PollerToken); + Y_ABORT_UNLESS(!PollerToken); const bool success = Actor->Send(MakePollerActorId(), new TEvPollerRegister(Socket, Actor->SelfActorId, Actor->SelfActorId)); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); auto result = Actor->WaitForSpecificEvent<TEvPollerRegisterResult>("RegisterPoller"); PollerToken = std::move(result->Get()->PollerToken); - Y_VERIFY(PollerToken); - Y_VERIFY(PollerToken->RefCount() == 1); // ensure exclusive ownership + Y_ABORT_UNLESS(PollerToken); + Y_ABORT_UNLESS(PollerToken->RefCount() == 1); // ensure exclusive ownership } void WaitPoller(bool read, bool write, TString state) { @@ -170,7 +170,7 @@ namespace NActors { template <typename TDataPtr, typename TSendRecvFunc> void Process(TDataPtr buffer, size_t len, TSendRecvFunc&& sendRecv, bool read, bool write, TString state) { - Y_VERIFY(Socket); + Y_ABORT_UNLESS(Socket); NInterconnect::TStreamSocket* sock = Socket.Get(); ssize_t (NInterconnect::TStreamSocket::*pfn)(TDataPtr, size_t, TString*) const = sendRecv; size_t processed = 0; @@ -208,7 +208,7 @@ namespace NActors { void ResetPollerToken() { if (PollerToken) { - Y_VERIFY(PollerToken->RefCount() == 1); + Y_ABORT_UNLESS(PollerToken->RefCount() == 1); PollerToken.Reset(); // ensure we are going to destroy poller token here as we will re-register the socket within other actor } } @@ -255,9 +255,9 @@ namespace NActors { , HandshakeKind("outgoing handshake") , Params(std::move(params)) { - Y_VERIFY(SelfVirtualId); - Y_VERIFY(SelfVirtualId.NodeId()); - Y_VERIFY(PeerNodeId); + Y_ABORT_UNLESS(SelfVirtualId); + Y_ABORT_UNLESS(SelfVirtualId.NodeId()); + Y_ABORT_UNLESS(PeerNodeId); HandshakeBroker = MakeHandshakeBrokerOutId(); // generate random handshake id @@ -272,7 +272,7 @@ namespace NActors { , ExternalDataChannel(this, nullptr) , HandshakeKind("incoming handshake") { - Y_VERIFY(MainChannel); + Y_ABORT_UNLESS(MainChannel); PeerAddr = TString::Uninitialized(1024); if (GetRemoteAddr(*MainChannel.GetSocketRef(), PeerAddr.Detach(), PeerAddr.size())) { PeerAddr.resize(strlen(PeerAddr.data())); @@ -342,7 +342,7 @@ namespace NActors { if (ProgramInfo) { if (Params.UseExternalDataChannel) { if (incoming) { - Y_VERIFY(SubscribedForConnection); + Y_ABORT_UNLESS(SubscribedForConnection); auto ev = WaitForSpecificEvent<TEvReportConnection>("WaitInboundXdcStream"); SubscribedForConnection = false; if (ev->Get()->HandshakeId != *HandshakeId) { @@ -370,10 +370,10 @@ namespace NActors { if (ProgramInfo) { LOG_LOG_IC_X(NActorsServices::INTERCONNECT, "ICH04", NLog::PRI_INFO, "handshake succeeded"); - Y_VERIFY(NextPacketFromPeer); + Y_ABORT_UNLESS(NextPacketFromPeer); MainChannel.ResetPollerToken(); ExternalDataChannel.ResetPollerToken(); - Y_VERIFY(!ExternalDataChannel == !Params.UseExternalDataChannel); + Y_ABORT_UNLESS(!ExternalDataChannel == !Params.UseExternalDataChannel); SendToProxy(MakeHolder<TEvHandshakeDone>(std::move(MainChannel.GetSocketRef()), PeerVirtualId, SelfVirtualId, *NextPacketFromPeer, ProgramInfo->Release(), std::move(Params), std::move(ExternalDataChannel.GetSocketRef()))); } @@ -837,7 +837,7 @@ namespace NActors { } addresses.emplace_back(r.GetAddress(), static_cast<ui16>(r.GetPort())); } else { - Y_VERIFY(ev->GetTypeRewrite() == ui32(ENetwork::ResolveError)); + Y_ABORT_UNLESS(ev->GetTypeRewrite() == ui32(ENetwork::ResolveError)); Fail(TEvHandshakeFail::HANDSHAKE_FAIL_PERMANENT, "DNS resolve error: " + ev->Get<TEvResolveError>()->Explain + ", Unresolved host# " + ev->Get<TEvResolveError>()->Host, true); } @@ -1072,7 +1072,7 @@ namespace NActors { if (auto ev = reply->CastAsLocal<TEvHandshakeReplyOK>()) { // issue successful reply to the peer auto& record = ev->Record; - Y_VERIFY(record.HasSuccess()); + Y_ABORT_UNLESS(record.HasSuccess()); auto& success = *record.MutableSuccess(); SetupClusterUUID(success); SetupCompatibilityInfo(success); @@ -1106,7 +1106,7 @@ namespace NActors { void SendExBlock(TConnection& connection, const T& proto, const char* what) { TString data; Y_PROTOBUF_SUPPRESS_NODISCARD proto.SerializeToString(&data); - Y_VERIFY(data.size() <= TExHeader::MaxSize); + Y_ABORT_UNLESS(data.size() <= TExHeader::MaxSize); ReportProto(proto, Sprintf("SendExBlock %s", what).data()); @@ -1137,7 +1137,7 @@ namespace NActors { private: void SendToProxy(THolder<IEventBase> ev) { - Y_VERIFY(PeerNodeId); + Y_ABORT_UNLESS(PeerNodeId); Send(GetActorSystem()->InterconnectProxy(PeerNodeId), ev.Release()); } @@ -1204,7 +1204,7 @@ namespace NActors { } THolder<TEvInterconnect::TNodeInfo> GetPeerNodeInfo() { - Y_VERIFY(PeerNodeId); + Y_ABORT_UNLESS(PeerNodeId); Send(Common->NameserviceId, new TEvInterconnect::TEvGetNode(PeerNodeId, TActivationContext::Now() + (Deadline - TActivationContext::Monotonic()))); auto response = WaitForSpecificEvent<TEvInterconnect::TEvNodeInfo>("GetPeerNodeInfo"); diff --git a/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp b/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp index 1a563454df3..867b4b5d397 100644 --- a/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp +++ b/library/cpp/actors/interconnect/interconnect_nameserver_dynamic.cpp @@ -96,7 +96,7 @@ namespace NActors { , NodeTable(setup->StaticNodeTable) , PendingPeriod(pendingPeriod) { - Y_VERIFY(setup->IsEntriesUnique()); + Y_ABORT_UNLESS(setup->IsEntriesUnique()); } STFUNC(StateFunc) { diff --git a/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp b/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp index e5507b9838e..ac565f6f8ca 100644 --- a/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp +++ b/library/cpp/actors/interconnect/interconnect_nameserver_table.cpp @@ -21,7 +21,7 @@ namespace NActors { : TInterconnectNameserverBase<TInterconnectNameserverTable>(&TInterconnectNameserverTable::StateFunc, setup->StaticNodeTable) , Config(setup) { - Y_VERIFY(Config->IsEntriesUnique()); + Y_ABORT_UNLESS(Config->IsEntriesUnique()); } STFUNC(StateFunc) { diff --git a/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp b/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp index 0692cea963b..2c02c632c2e 100644 --- a/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp +++ b/library/cpp/actors/interconnect/interconnect_proxy_wrapper.cpp @@ -30,7 +30,7 @@ namespace NActors { if (Mock) { Proxy = actor; } - Y_VERIFY(Proxy); + Y_ABORT_UNLESS(Proxy); } InvokeOtherActor(*Proxy, &IActor::Receive, ev); } diff --git a/library/cpp/actors/interconnect/interconnect_stream.cpp b/library/cpp/actors/interconnect/interconnect_stream.cpp index 3082e08a78e..51a23923af7 100644 --- a/library/cpp/actors/interconnect/interconnect_stream.cpp +++ b/library/cpp/actors/interconnect/interconnect_stream.cpp @@ -97,7 +97,7 @@ namespace NInterconnect { const SOCKET res = ::socket(domain, SOCK_STREAM | SOCK_NONBLOCK, 0); if (res == -1) { const int err = LastSocketError(); - Y_VERIFY(err != EMFILE && err != ENFILE); + Y_ABORT_UNLESS(err != EMFILE && err != ENFILE); if (error) { *error = err; } @@ -224,7 +224,7 @@ namespace NInterconnect { const SOCKET res = ::socket(domain, SOCK_DGRAM, 0); if (res == -1) { const int err = LastSocketError(); - Y_VERIFY(err != EMFILE && err != ENFILE); + Y_ABORT_UNLESS(err != EMFILE && err != ENFILE); } return std::make_shared<TDatagramSocket>(res); } @@ -283,14 +283,14 @@ namespace NInterconnect { InitOpenSSL(); #if OPENSSL_VERSION_NUMBER < 0x10100000L Ctx.reset(SSL_CTX_new(TLSv1_2_method())); - Y_VERIFY(Ctx, "SSL_CTX_new() failed"); + Y_ABORT_UNLESS(Ctx, "SSL_CTX_new() failed"); #else Ctx.reset(SSL_CTX_new(TLS_method())); - Y_VERIFY(Ctx, "SSL_CTX_new() failed"); + Y_ABORT_UNLESS(Ctx, "SSL_CTX_new() failed"); ret = SSL_CTX_set_min_proto_version(Ctx.get(), TLS1_2_VERSION); - Y_VERIFY(ret == 1, "failed to set min proto version"); + Y_ABORT_UNLESS(ret == 1, "failed to set min proto version"); ret = SSL_CTX_set_max_proto_version(Ctx.get(), TLS1_2_VERSION); - Y_VERIFY(ret == 1, "failed to set max proto version"); + Y_ABORT_UNLESS(ret == 1, "failed to set max proto version"); #endif SSL_CTX_set_verify(Ctx.get(), SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, &Verify); SSL_CTX_set_mode(*this, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); @@ -298,13 +298,13 @@ namespace NInterconnect { // apply certificates in SSL context if (certificate) { std::unique_ptr<BIO, TDeleter> bio(BIO_new_mem_buf(certificate.data(), certificate.size())); - Y_VERIFY(bio); + Y_ABORT_UNLESS(bio); // first certificate in the chain is expected to be a leaf std::unique_ptr<X509, TDeleter> cert(PEM_read_bio_X509(bio.get(), nullptr, nullptr, nullptr)); - Y_VERIFY(cert, "failed to parse certificate"); + Y_ABORT_UNLESS(cert, "failed to parse certificate"); ret = SSL_CTX_use_certificate(Ctx.get(), cert.get()); - Y_VERIFY(ret == 1); + Y_ABORT_UNLESS(ret == 1); // loading additional certificates in the chain, if any while(true) { @@ -313,25 +313,25 @@ namespace NInterconnect { break; } ret = SSL_CTX_add0_chain_cert(Ctx.get(), ca); - Y_VERIFY(ret == 1); + Y_ABORT_UNLESS(ret == 1); // we must not free memory if certificate was added successfully by SSL_CTX_add0_chain_cert } } if (privateKey) { std::unique_ptr<BIO, TDeleter> bio(BIO_new_mem_buf(privateKey.data(), privateKey.size())); - Y_VERIFY(bio); + Y_ABORT_UNLESS(bio); std::unique_ptr<RSA, TDeleter> pkey(PEM_read_bio_RSAPrivateKey(bio.get(), nullptr, nullptr, nullptr)); - Y_VERIFY(pkey); + Y_ABORT_UNLESS(pkey); ret = SSL_CTX_use_RSAPrivateKey(Ctx.get(), pkey.get()); - Y_VERIFY(ret == 1); + Y_ABORT_UNLESS(ret == 1); } if (caFilePath) { ret = SSL_CTX_load_verify_locations(Ctx.get(), caFilePath.data(), nullptr); - Y_VERIFY(ret == 1); + Y_ABORT_UNLESS(ret == 1); } int success = SSL_CTX_set_cipher_list(Ctx.get(), ciphers ? ciphers.data() : "AES128-GCM-SHA256"); - Y_VERIFY(success, "failed to set cipher list"); + Y_ABORT_UNLESS(success, "failed to set cipher list"); } operator SSL_CTX*() const { @@ -386,7 +386,7 @@ namespace NInterconnect { TImpl(SSL_CTX *ctx, int fd) : Ssl(SSL_new(ctx)) { - Y_VERIFY(Ssl, "SSL_new() failed"); + Y_ABORT_UNLESS(Ssl, "SSL_new() failed"); SSL_set_fd(Ssl, fd); SSL_set_ex_data(Ssl, TSecureSocketContext::TImpl::GetExIndex(), &ErrorDescription); } @@ -490,7 +490,7 @@ namespace NInterconnect { if (BlockedSend && BlockedSend->first == msg && BlockedSend->second < len) { len = BlockedSend->second; } - Y_VERIFY(!BlockedSend || *BlockedSend == std::make_pair(msg, len)); + Y_ABORT_UNLESS(!BlockedSend || *BlockedSend == std::make_pair(msg, len)); const ssize_t res = Operate(msg, len, &SSL_write_ex, err); if (res == -EAGAIN) { BlockedSend.emplace(msg, len); @@ -510,7 +510,7 @@ namespace NInterconnect { if (BlockedReceive && BlockedReceive->first == msg && BlockedReceive->second < len) { len = BlockedReceive->second; } - Y_VERIFY(!BlockedReceive || *BlockedReceive == std::make_pair(msg, len)); + Y_ABORT_UNLESS(!BlockedReceive || *BlockedReceive == std::make_pair(msg, len)); const ssize_t res = Operate(msg, len, &SSL_read_ex, err); if (res == -EAGAIN) { BlockedReceive.emplace(msg, len); diff --git a/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp b/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp index 3b428843553..41fd36a8245 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp @@ -18,7 +18,7 @@ namespace NActors { void TReceiveContext::TPerChannelContext::ApplyCatchBuffer() { if (auto buffer = std::exchange(XdcCatchBuffer, {})) { - Y_VERIFY(XdcCatchBytesRead >= buffer.size()); + Y_ABORT_UNLESS(XdcCatchBytesRead >= buffer.size()); const size_t offset = XdcCatchBytesRead % buffer.size(); const char *begin = buffer.data(); @@ -109,10 +109,10 @@ namespace NActors { , Metrics(std::move(metrics)) , DeadPeerTimeout(deadPeerTimeout) { - Y_VERIFY(Context); - Y_VERIFY(Socket); - Y_VERIFY(SessionId); - Y_VERIFY(!Params.UseExternalDataChannel == !XdcSocket); + Y_ABORT_UNLESS(Context); + Y_ABORT_UNLESS(Socket); + Y_ABORT_UNLESS(SessionId); + Y_ABORT_UNLESS(!Params.UseExternalDataChannel == !XdcSocket); Metrics->SetClockSkewMicrosec(0); @@ -120,7 +120,7 @@ namespace NActors { // ensure that we do not spawn new session while the previous one is still alive TAtomicBase sessions = AtomicIncrement(Context->NumInputSessions); - Y_VERIFY(sessions == 1, "sessions# %" PRIu64, ui64(sessions)); + Y_ABORT_UNLESS(sessions == 1, "sessions# %" PRIu64, ui64(sessions)); // calculate number of bytes to catch for (auto& context : Context->ChannelArray) { @@ -270,7 +270,7 @@ namespace NActors { if (!UpdateFromInputSession) { UpdateFromInputSession = MakeHolder<TEvUpdateFromInputSession>(ConfirmedByInput, numDataBytes, ping); } else { - Y_VERIFY(ConfirmedByInput >= UpdateFromInputSession->ConfirmedByInput); + Y_ABORT_UNLESS(ConfirmedByInput >= UpdateFromInputSession->ConfirmedByInput); UpdateFromInputSession->ConfirmedByInput = ConfirmedByInput; UpdateFromInputSession->NumDataBytes += numDataBytes; UpdateFromInputSession->Ping = Min(UpdateFromInputSession->Ping, ping); @@ -303,7 +303,7 @@ namespace NActors { break; case EUpdateState::INFLIGHT_AND_PENDING: - Y_VERIFY(UpdateFromInputSession); + Y_ABORT_UNLESS(UpdateFromInputSession); break; default: @@ -328,7 +328,7 @@ namespace NActors { void TInputSessionTCP::ProcessHeader() { TTcpPacketHeader_v2 header; const bool success = IncomingData.ExtractFrontPlain(&header, sizeof(header)); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); PayloadSize = header.PayloadLength; const ui64 serial = header.Serial; const ui64 confirm = header.Confirm; @@ -444,7 +444,7 @@ namespace NActors { if (part.IsXdc()) { // external data channel command packet XdcCommands.resize(part.Size); const bool success = Payload.ExtractFrontPlain(XdcCommands.data(), XdcCommands.size()); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); ProcessXdcCommand(channel, context); } else if (IgnorePayload) { // throw payload out Payload.EraseFront(part.Size); @@ -459,7 +459,7 @@ namespace NActors { } const bool success = Payload.ExtractFrontPlain(&v2, sizeof(v2)); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); pendingEvent.EventData = TEventData{ v2.Type, @@ -511,7 +511,7 @@ namespace NActors { numXdcBytesRead -= n; if (front.XdcUnreadBytes) { // we haven't finished this packet yet - Y_VERIFY(!numXdcBytesRead); + Y_ABORT_UNLESS(!numXdcBytesRead); break; } @@ -548,7 +548,7 @@ namespace NActors { pendingEvent.SerializationInfo.Sections.push_back(TEventSectionInfo{headroom, size, tailroom, alignment, isInline}); - Y_VERIFY(!isInline || Params.UseXdcShuffle); + Y_ABORT_UNLESS(!isInline || Params.UseXdcShuffle); if (!isInline) { // allocate buffer and push it into the payload auto buffer = TRcBuf::Uninitialized(size, headroom, tailroom); @@ -653,7 +653,7 @@ namespace NActors { rope.ExtractFront(rope.size(), &payload); } // and ensure there is no unprocessed external payload - Y_VERIFY(!pendingEvent.ExternalPayload); + Y_ABORT_UNLESS(!pendingEvent.ExternalPayload); #if IC_FORCE_HARDENED_PACKET_CHECKS if (descr.Len != payload.GetSize()) { @@ -703,7 +703,7 @@ namespace NActors { return; case EUpdateState::CONFIRMING: - Y_VERIFY(UpdateFromInputSession); + Y_ABORT_UNLESS(UpdateFromInputSession); if (Context->UpdateState.compare_exchange_weak(state, EUpdateState::INFLIGHT)) { Send(SessionId, UpdateFromInputSession.Release()); return; @@ -776,14 +776,14 @@ namespace NActors { return false; } - Y_VERIFY(recvres > 0); + Y_ABORT_UNLESS(recvres > 0); Metrics->AddTotalBytesRead(recvres); BytesReadFromSocket += recvres; size_t numBuffersCovered = 0; while (recvres) { - Y_VERIFY(!Buffers.empty()); + Y_ABORT_UNLESS(!Buffers.empty()); auto& buffer = Buffers.front(); const size_t bytes = Min<size_t>(recvres, buffer.size()); recvres -= bytes; @@ -949,14 +949,14 @@ namespace NActors { } } - Y_VERIFY(recvres > 0); + Y_ABORT_UNLESS(recvres > 0); Metrics->AddTotalBytesRead(recvres); *numDataBytes += recvres; BytesReadFromXdcSocket += recvres; // cut the XdcInputQ deque for (size_t bytesToCut = recvres; bytesToCut; ) { - Y_VERIFY(!XdcInputQ.empty()); + Y_ABORT_UNLESS(!XdcInputQ.empty()); auto& [channel, span] = XdcInputQ.front(); size_t n = Min(bytesToCut, span.size()); bytesToCut -= n; @@ -964,7 +964,7 @@ namespace NActors { XdcInputQ.pop_front(); } else { span = span.SubSpan(n, Max<size_t>()); - Y_VERIFY(!bytesToCut); + Y_ABORT_UNLESS(!bytesToCut); } Y_VERIFY_DEBUG(n); diff --git a/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp b/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp index 13f2f2dd838..c1994b2d715 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp @@ -28,10 +28,10 @@ namespace NActors { , SecureContext(new NInterconnect::TSecureSocketContext(Common->Settings.Certificate, Common->Settings.PrivateKey, Common->Settings.CaFilePath, Common->Settings.CipherList)) { - Y_VERIFY(Common); - Y_VERIFY(Common->NameserviceId); + Y_ABORT_UNLESS(Common); + Y_ABORT_UNLESS(Common->NameserviceId); if (DynamicPtr) { - Y_VERIFY(!*DynamicPtr); + Y_ABORT_UNLESS(!*DynamicPtr); *DynamicPtr = this; } } @@ -63,7 +63,7 @@ namespace NActors { void TInterconnectProxyTCP::RequestNodeInfo(STATEFN_SIG) { ICPROXY_PROFILED; - Y_VERIFY(!IncomingHandshakeActor && !OutgoingHandshakeActor && !PendingIncomingHandshakeEvents && !PendingSessionEvents); + Y_ABORT_UNLESS(!IncomingHandshakeActor && !OutgoingHandshakeActor && !PendingIncomingHandshakeEvents && !PendingSessionEvents); EnqueueSessionEvent(ev); StartConfiguring(); } @@ -72,7 +72,7 @@ namespace NActors { ICPROXY_PROFILED; if (!Terminated) { - Y_VERIFY(!IncomingHandshakeActor && !OutgoingHandshakeActor && !PendingIncomingHandshakeEvents && !PendingSessionEvents); + Y_ABORT_UNLESS(!IncomingHandshakeActor && !OutgoingHandshakeActor && !PendingIncomingHandshakeEvents && !PendingSessionEvents); EnqueueIncomingHandshakeEvent(ev); StartConfiguring(); } @@ -85,7 +85,7 @@ namespace NActors { void TInterconnectProxyTCP::StartConfiguring() { ICPROXY_PROFILED; - Y_VERIFY(!IncomingHandshakeActor && !OutgoingHandshakeActor); + Y_ABORT_UNLESS(!IncomingHandshakeActor && !OutgoingHandshakeActor); // issue node info request Send(Common->NameserviceId, new TEvInterconnect::TEvGetNode(PeerNodeId)); @@ -99,7 +99,7 @@ namespace NActors { void TInterconnectProxyTCP::Configure(TEvInterconnect::TEvNodeInfo::TPtr& ev) { ICPROXY_PROFILED; - Y_VERIFY(!IncomingHandshakeActor && !OutgoingHandshakeActor && !Session); + Y_ABORT_UNLESS(!IncomingHandshakeActor && !OutgoingHandshakeActor && !Session); if (!ev->Get()->Node) { TransitToErrorState("cannot get node info"); @@ -170,11 +170,11 @@ namespace NActors { DropOutgoingHandshake(); // ensure that we have session - Y_VERIFY(Session); + Y_ABORT_UNLESS(Session); // ensure that we have both virtual ids - Y_VERIFY(SessionVirtualId); - Y_VERIFY(RemoteSessionVirtualId); + Y_ABORT_UNLESS(SessionVirtualId); + Y_ABORT_UNLESS(RemoteSessionVirtualId); // create and register handshake actor OutgoingHandshakeActor = Register(CreateOutgoingHandshakeActor(Common, SessionVirtualId, @@ -187,10 +187,10 @@ namespace NActors { THolder<IEventBase> event) { ICPROXY_PROFILED; - Y_VERIFY(!IncomingHandshakeActor); + Y_ABORT_UNLESS(!IncomingHandshakeActor); IncomingHandshakeActor = handshakeId; IncomingHandshakeActorFilledIn = TActivationContext::Now(); - Y_VERIFY(!LastSerialFromIncomingHandshake || *LastSerialFromIncomingHandshake <= peerLocalId); + Y_ABORT_UNLESS(!LastSerialFromIncomingHandshake || *LastSerialFromIncomingHandshake <= peerLocalId); LastSerialFromIncomingHandshake = peerLocalId; if (OutgoingHandshakeActor && SelfId().NodeId() < PeerNodeId) { @@ -201,12 +201,12 @@ namespace NActors { // Check that we are in one of acceptable states that would properly handle handshake statuses. const auto state = CurrentStateFunc(); - Y_VERIFY(state == &TThis::PendingConnection || state == &TThis::StateWork, "invalid handshake request in state# %s", State); + Y_ABORT_UNLESS(state == &TThis::PendingConnection || state == &TThis::StateWork, "invalid handshake request in state# %s", State); } else { LOG_DEBUG_IC("ICP07", "issued incoming handshake reply"); // No race, so we can send reply immediately. - Y_VERIFY(!HeldHandshakeReply); + Y_ABORT_UNLESS(!HeldHandshakeReply); Send(IncomingHandshakeActor, event.Release()); // Start waiting for handshake reply, if not yet started; also, if session is already created, then we don't @@ -215,7 +215,7 @@ namespace NActors { LOG_INFO_IC("ICP08", "No active sessions, becoming PendingConnection"); SwitchToState(__LINE__, "PendingConnection", &TThis::PendingConnection); } else { - Y_VERIFY(CurrentStateFunc() == &TThis::StateWork); + Y_ABORT_UNLESS(CurrentStateFunc() == &TThis::StateWork); } } } @@ -342,15 +342,15 @@ namespace NActors { // drop any pending XDC subscriptions ConnectionSubscriptions.clear(); - Y_VERIFY(!IncomingHandshakeActor && !OutgoingHandshakeActor); + Y_ABORT_UNLESS(!IncomingHandshakeActor && !OutgoingHandshakeActor); SwitchToState(__LINE__, "StateWork", &TThis::StateWork); if (Session) { // this is continuation request, check that virtual ids match - Y_VERIFY(SessionVirtualId == msg->Self && RemoteSessionVirtualId == msg->Peer); + Y_ABORT_UNLESS(SessionVirtualId == msg->Self && RemoteSessionVirtualId == msg->Peer); } else { // this is initial request, check that we have virtual ids not filled in - Y_VERIFY(!SessionVirtualId && !RemoteSessionVirtualId); + Y_ABORT_UNLESS(!SessionVirtualId && !RemoteSessionVirtualId); } auto error = [&](const char* description) { @@ -374,7 +374,7 @@ namespace NActors { } // ensure that we have session local/peer virtual ids - Y_VERIFY(Session && SessionVirtualId && RemoteSessionVirtualId); + Y_ABORT_UNLESS(Session && SessionVirtualId && RemoteSessionVirtualId); // Set up new connection for the session. IActor::InvokeOtherActor(*Session, &TInterconnectSessionTCP::SetNewConnection, ev); @@ -405,7 +405,7 @@ namespace NActors { DropOutgoingHandshake(false); if (IEventBase* reply = HeldHandshakeReply.Release()) { - Y_VERIFY(IncomingHandshakeActor); + Y_ABORT_UNLESS(IncomingHandshakeActor); LOG_DEBUG_IC("ICP26", "sent held handshake reply to %s", IncomingHandshakeActor.ToString().data()); Send(IncomingHandshakeActor, reply); } @@ -532,7 +532,7 @@ namespace NActors { void TInterconnectProxyTCP::UnregisterSession(TInterconnectSessionTCP* session) { ICPROXY_PROFILED; - Y_VERIFY(Session && Session == session && SessionID); + Y_ABORT_UNLESS(Session && Session == session && SessionID); LOG_INFO_IC("ICP30", "unregister session Session# %s VirtualId# %s", SessionID.ToString().data(), SessionVirtualId.ToString().data()); @@ -606,7 +606,7 @@ namespace NActors { void TInterconnectProxyTCP::ForwardSessionEventToSession(STATEFN_SIG) { ICPROXY_PROFILED; - Y_VERIFY(Session && SessionID); + Y_ABORT_UNLESS(Session && SessionID); ValidateEvent(ev, "ForwardSessionEventToSession"); InvokeOtherActor(*Session, &TInterconnectSessionTCP::Receive, ev); } @@ -753,8 +753,8 @@ namespace NActors { UpdateErrorStateLog(TActivationContext::Now(), "permanent conclusive", explanation); } - Y_VERIFY(Session == nullptr); - Y_VERIFY(!SessionID); + Y_ABORT_UNLESS(Session == nullptr); + Y_ABORT_UNLESS(!SessionID); // recalculate wakeup timeout -- if this is the first failure, then we sleep for default timeout; otherwise we // sleep N times longer than the previous try, but not longer than desired number of seconds @@ -825,7 +825,7 @@ namespace NActors { void TInterconnectProxyTCP::HandleCleanupEventQueue() { ICPROXY_PROFILED; - Y_VERIFY(CleanupEventQueueScheduled); + Y_ABORT_UNLESS(CleanupEventQueueScheduled); CleanupEventQueueScheduled = false; CleanupEventQueue(); ScheduleCleanupEventQueue(); @@ -935,7 +935,7 @@ namespace NActors { IActor::InvokeOtherActor(*Session, &TInterconnectSessionTCP::Terminate, TDisconnectReason()); } if (DynamicPtr) { - Y_VERIFY(*DynamicPtr == this); + Y_ABORT_UNLESS(*DynamicPtr == this); *DynamicPtr = nullptr; } // TODO: unregister actor mon page diff --git a/library/cpp/actors/interconnect/interconnect_tcp_proxy.h b/library/cpp/actors/interconnect/interconnect_tcp_proxy.h index 009d5f1c21a..b03b406195d 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_proxy.h +++ b/library/cpp/actors/interconnect/interconnect_tcp_proxy.h @@ -153,15 +153,15 @@ namespace NActors { void Ignore(TEvHandshakeDone::TPtr& ev) { ICPROXY_PROFILED; - Y_VERIFY(ev->Sender != IncomingHandshakeActor); - Y_VERIFY(ev->Sender != OutgoingHandshakeActor); + Y_ABORT_UNLESS(ev->Sender != IncomingHandshakeActor); + Y_ABORT_UNLESS(ev->Sender != OutgoingHandshakeActor); } void Ignore(TEvHandshakeFail::TPtr& ev) { ICPROXY_PROFILED; - Y_VERIFY(ev->Sender != IncomingHandshakeActor); - Y_VERIFY(ev->Sender != OutgoingHandshakeActor); + Y_ABORT_UNLESS(ev->Sender != IncomingHandshakeActor); + Y_ABORT_UNLESS(ev->Sender != OutgoingHandshakeActor); LogHandshakeFail(ev, true); } @@ -176,7 +176,7 @@ namespace NActors { State = name; StateSwitchTime = TActivationContext::Now(); Become(std::forward<TArgs>(args)...); - Y_VERIFY(!Terminated || CurrentStateFunc() == &TThis::HoldByError); // ensure we never escape this state + Y_ABORT_UNLESS(!Terminated || CurrentStateFunc() == &TThis::HoldByError); // ensure we never escape this state if (CurrentStateFunc() != &TThis::PendingActivation) { PassAwayTimestamp = TMonotonic::Max(); } else if (DynamicPtr) { @@ -195,14 +195,14 @@ namespace NActors { void SwitchToInitialState() { ICPROXY_PROFILED; - Y_VERIFY(!PendingSessionEvents && !PendingIncomingHandshakeEvents, "%s PendingSessionEvents# %zu" + Y_ABORT_UNLESS(!PendingSessionEvents && !PendingIncomingHandshakeEvents, "%s PendingSessionEvents# %zu" " PendingIncomingHandshakeEvents# %zu State# %s", LogPrefix.data(), PendingSessionEvents.size(), PendingIncomingHandshakeEvents.size(), State); SwitchToState(__LINE__, "PendingActivation", &TThis::PendingActivation); } void HandlePassAwayIfNeeded() { - Y_VERIFY(PassAwayScheduled); + Y_ABORT_UNLESS(PassAwayScheduled); const TMonotonic now = TActivationContext::Monotonic(); if (now >= PassAwayTimestamp) { PassAway(); @@ -367,7 +367,7 @@ namespace NActors { Y_VERIFY_DEBUG(false, "%s", msg.data()); } - Y_VERIFY(ev->GetTypeRewrite() != TEvInterconnect::EvForward || ev->Recipient.NodeId() == PeerNodeId, + Y_ABORT_UNLESS(ev->GetTypeRewrite() != TEvInterconnect::EvForward || ev->Recipient.NodeId() == PeerNodeId, "Recipient/Proxy NodeId mismatch Recipient# %s Type# 0x%08" PRIx32 " PeerNodeId# %" PRIu32 " Func# %s", ev->Recipient.ToString().data(), ev->Type, PeerNodeId, func); } @@ -482,7 +482,7 @@ namespace NActors { } // ensure we have no current session - Y_VERIFY(!Session); + Y_ABORT_UNLESS(!Session); // switch to pending connection state -- we wait for handshakes, we want more handshakes! SwitchToState(__LINE__, "PendingConnection", &TThis::PendingConnection); diff --git a/library/cpp/actors/interconnect/interconnect_tcp_server.cpp b/library/cpp/actors/interconnect/interconnect_tcp_server.cpp index ede35b0b8b0..09c5987e81f 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_server.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_server.cpp @@ -85,7 +85,7 @@ namespace NActors { callback(Port, TlsActivationContext->ExecutorThread.ActorSystem); } const bool success = ctx.Send(MakePollerActorId(), new TEvPollerRegister(Listener, SelfId(), {})); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); Become(&TThis::Listen); } @@ -104,7 +104,7 @@ namespace NActors { ctx.Register(CreateIncomingHandshakeActor(ProxyCommonCtx, std::move(socket))); continue; } else if (-r != EAGAIN && -r != EWOULDBLOCK) { - Y_VERIFY(-r != ENFILE && -r != EMFILE && !ExternalSocket); + Y_ABORT_UNLESS(-r != ENFILE && -r != EMFILE && !ExternalSocket); LOG_ERROR_IC("ICL06", "Listen failed: %s (%s:%u)", strerror(-r), Address.data(), Port); Listener.Reset(); PollerToken.Reset(); diff --git a/library/cpp/actors/interconnect/interconnect_tcp_session.cpp b/library/cpp/actors/interconnect/interconnect_tcp_session.cpp index b58ca345a9a..3644706e519 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_session.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_session.cpp @@ -238,10 +238,10 @@ namespace NActors { // register our socket in poller actor LOG_DEBUG_IC_SESSION("ICS11", "registering socket in PollerActor"); const bool success = Send(MakePollerActorId(), new TEvPollerRegister(Socket, ReceiverId, SelfId())); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); if (XdcSocket) { const bool success = Send(MakePollerActorId(), new TEvPollerRegister(XdcSocket, ReceiverId, SelfId())); - Y_VERIFY(success); + Y_ABORT_UNLESS(success); } LostConnectionWatchdog.Disarm(); @@ -273,7 +273,7 @@ namespace NActors { ForcedWriteLength = 0; const ui64 serial = OutputCounter - SendQueue.size() + 1; - Y_VERIFY(serial > LastConfirmed, "%s serial# %" PRIu64 " LastConfirmed# %" PRIu64, LogPrefix.data(), serial, LastConfirmed); + Y_ABORT_UNLESS(serial > LastConfirmed, "%s serial# %" PRIu64 " LastConfirmed# %" PRIu64, LogPrefix.data(), serial, LastConfirmed); LOG_DEBUG_IC_SESSION("ICS06", "rewind SendQueue size# %zu LastConfirmed# %" PRIu64 " NextSerial# %" PRIu64, SendQueue.size(), LastConfirmed, serial); @@ -677,7 +677,7 @@ namespace NActors { TStackVec<TConstIoVec, iovLimit> wbuffers; stream.ProduceIoVec(wbuffers, maxElementsInIOV, maxBytes); - Y_VERIFY(!wbuffers.empty()); + Y_ABORT_UNLESS(!wbuffers.empty()); TString err; ssize_t r = 0; @@ -784,11 +784,11 @@ namespace NActors { serial = ++OutputCounter; // fill the data packet - Y_VERIFY(NumEventsInQueue); + Y_ABORT_UNLESS(NumEventsInQueue); LWPROBE_IF_TOO_LONG(SlowICFillSendingBuffer, Proxy->PeerNodeId, ms) { FillSendingBuffer(packet, serial); } - Y_VERIFY(!packet.IsEmpty()); + Y_ABORT_UNLESS(!packet.IsEmpty()); InflightDataAmount += packet.GetDataSize(); Proxy->Metrics->AddInflightDataAmount(packet.GetDataSize()); @@ -818,7 +818,7 @@ namespace NActors { const size_t outgoingStreamSizeAfter = stream.CalculateOutgoingSize(); const size_t xdcStreamSizeAfter = XdcStream.CalculateOutgoingSize(); - Y_VERIFY(outgoingStreamSizeAfter == outgoingStreamSizeBefore + packetSize && + Y_ABORT_UNLESS(outgoingStreamSizeAfter == outgoingStreamSizeBefore + packetSize && xdcStreamSizeAfter == xdcStreamSizeBefore + packet.GetExternalSize(), "outgoingStreamSizeBefore# %zu outgoingStreamSizeAfter# %zu packetSize# %zu" " xdcStreamSizeBefore# %zu xdcStreamSizeAfter# %zu externalSize# %" PRIu32, @@ -848,7 +848,7 @@ namespace NActors { void TInterconnectSessionTCP::DropConfirmed(ui64 confirm) { LOG_DEBUG_IC_SESSION("ICS23", "confirm count: %" PRIu64, confirm); - Y_VERIFY(LastConfirmed <= confirm && confirm <= OutputCounter, + Y_ABORT_UNLESS(LastConfirmed <= confirm && confirm <= OutputCounter, "%s confirm# %" PRIu64 " LastConfirmed# %" PRIu64 " OutputCounter# %" PRIu64, LogPrefix.data(), confirm, LastConfirmed, OutputCounter); LastConfirmed = confirm; @@ -907,7 +907,7 @@ namespace NActors { void TInterconnectSessionTCP::FillSendingBuffer(TTcpPacketOutTask& task, ui64 serial) { ui32 bytesGenerated = 0; - Y_VERIFY(NumEventsInQueue); + Y_ABORT_UNLESS(NumEventsInQueue); while (NumEventsInQueue) { TEventOutputChannel *channel = ChannelScheduler->PickChannelWithLeastConsumedWeight(); Y_VERIFY_DEBUG(!channel->IsEmpty()); @@ -934,7 +934,7 @@ namespace NActors { if (eventDone) { ++MessagesWrittenToBuffer; - Y_VERIFY(NumEventsInQueue); + Y_ABORT_UNLESS(NumEventsInQueue); --NumEventsInQueue; if (!NumEventsInQueue) { @@ -947,7 +947,7 @@ namespace NActors { } } - Y_VERIFY(bytesGenerated); // ensure we are not stalled in serialization + Y_ABORT_UNLESS(bytesGenerated); // ensure we are not stalled in serialization } ui32 TInterconnectSessionTCP::CalculateQueueUtilization() { diff --git a/library/cpp/actors/interconnect/mock/ic_mock.cpp b/library/cpp/actors/interconnect/mock/ic_mock.cpp index 875f4ff5536..9178e52da8f 100644 --- a/library/cpp/actors/interconnect/mock/ic_mock.cpp +++ b/library/cpp/actors/interconnect/mock/ic_mock.cpp @@ -46,7 +46,7 @@ namespace NActors { void Attach(ui32 nodeId, TActorSystem *as, const TActorId& actorId) { TPeerInfo *peer = GetPeer(nodeId); auto guard = TWriteGuard(peer->Mutex); - Y_VERIFY(!peer->ActorSystem); + Y_ABORT_UNLESS(!peer->ActorSystem); peer->ActorSystem = as; peer->ProxyId = actorId; as->DeferPreStop([peer] { @@ -119,7 +119,7 @@ namespace NActors { for (const auto& kv : Subscribers) { Send(kv.first, new TEvInterconnect::TEvNodeDisconnected(Proxy->PeerNodeId), 0, kv.second); } - Y_VERIFY(Proxy->Session == this); + Y_ABORT_UNLESS(Proxy->Session == this); Proxy->Session = nullptr; PassAway(); } @@ -242,7 +242,7 @@ namespace NActors { } void HandleNodeInfo(TEvInterconnect::TEvNodeInfo::TPtr ev) { - Y_VERIFY(IsWaitingForNodeInfo); + Y_ABORT_UNLESS(IsWaitingForNodeInfo); if (!ev->Get()->Node) { PeerNodeStatus = EPeerNodeStatus::MISSING; } else { @@ -339,7 +339,7 @@ namespace NActors { } void PeerInject(std::deque<std::unique_ptr<IEventHandle>>&& messages) { - Y_VERIFY(Session); + Y_ABORT_UNLESS(Session); return State.Inject(PeerNodeId, std::move(messages), Common->LocalScopeId, Session->SessionId); } @@ -362,9 +362,9 @@ namespace NActors { public: IActor *CreateProxyMock(ui32 nodeId, ui32 peerNodeId, TInterconnectProxyCommon::TPtr common) { - Y_VERIFY(nodeId != peerNodeId); - Y_VERIFY(nodeId); - Y_VERIFY(peerNodeId); + Y_ABORT_UNLESS(nodeId != peerNodeId); + Y_ABORT_UNLESS(nodeId); + Y_ABORT_UNLESS(peerNodeId); const ui64 key = std::min(nodeId, peerNodeId) | ui64(std::max(nodeId, peerNodeId)) << 32; auto it = States.try_emplace(key, key).first; return new TProxyMockActor(nodeId, peerNodeId, it->second, std::move(common)); diff --git a/library/cpp/actors/interconnect/outgoing_stream.h b/library/cpp/actors/interconnect/outgoing_stream.h index 197b9219c29..23982c4a3ec 100644 --- a/library/cpp/actors/interconnect/outgoing_stream.h +++ b/library/cpp/actors/interconnect/outgoing_stream.h @@ -57,7 +57,7 @@ namespace NInterconnect { for (auto it = SendQueue.begin() + SendQueuePos; it != SendQueue.end(); ++it) { res += it->Span.size(); } - Y_VERIFY(UnsentBytes == res - SendOffset); + Y_ABORT_UNLESS(UnsentBytes == res - SendOffset); #endif return UnsentBytes; } @@ -70,7 +70,7 @@ namespace NInterconnect { if (maxLen && AppendOffset == BufferSize) { // we have no free buffer, allocate one Buffers.emplace_back(static_cast<TBuffer*>(malloc(sizeof(TBuffer)))); AppendBuffer = Buffers.back().get(); - Y_VERIFY(AppendBuffer); + Y_ABORT_UNLESS(AppendBuffer); AppendBuffer->RefCount = 1; // through AppendBuffer pointer AppendBuffer->Index = Buffers.size() - 1; AppendOffset = 0; diff --git a/library/cpp/actors/interconnect/packet.h b/library/cpp/actors/interconnect/packet.h index df0bf0a8c7d..105cc41ce3d 100644 --- a/library/cpp/actors/interconnect/packet.h +++ b/library/cpp/actors/interconnect/packet.h @@ -224,7 +224,7 @@ struct TTcpPacketOutTask : TNonCopyable { } void Finish(ui64 serial, ui64 confirm) { - Y_VERIFY(InternalSize <= Max<ui16>()); + Y_ABORT_UNLESS(InternalSize <= Max<ui16>()); TTcpPacketHeader_v2 header{ confirm, diff --git a/library/cpp/actors/interconnect/poller_actor.cpp b/library/cpp/actors/interconnect/poller_actor.cpp index 9dbd9838aa6..e3ddbe8b983 100644 --- a/library/cpp/actors/interconnect/poller_actor.cpp +++ b/library/cpp/actors/interconnect/poller_actor.cpp @@ -137,7 +137,7 @@ namespace NActors { Y_FAIL("WriteEnd.Write() failed with %s", strerror(err)); } } else { - Y_VERIFY(nwritten); + Y_ABORT_UNLESS(nwritten); break; } } @@ -160,13 +160,13 @@ namespace NActors { Y_FAIL("read() failed with %s", strerror(errno)); } } else { - Y_VERIFY(n); + Y_ABORT_UNLESS(n); } } } bool ProcessSyncOpQueue() { - Y_VERIFY(!SyncOperationsQ.IsEmpty()); + Y_ABORT_UNLESS(!SyncOperationsQ.IsEmpty()); do { TPollerSyncOperationWrapper *op = SyncOperationsQ.Top(); if (auto *unregister = std::get_if<TPollerUnregisterSocket>(&op->Operation)) { diff --git a/library/cpp/actors/interconnect/poller_actor_darwin.h b/library/cpp/actors/interconnect/poller_actor_darwin.h index 31c1144794e..f0919725028 100644 --- a/library/cpp/actors/interconnect/poller_actor_darwin.h +++ b/library/cpp/actors/interconnect/poller_actor_darwin.h @@ -13,7 +13,7 @@ namespace NActors { do { rc = kevent(KqDescriptor, ev, size, nullptr, 0, nullptr); } while (rc == -1 && errno == EINTR); - Y_VERIFY(rc != -1, "kevent() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(rc != -1, "kevent() failed with %s", strerror(errno)); } public: @@ -22,14 +22,14 @@ namespace NActors { { // create kqueue KqDescriptor = kqueue(); - Y_VERIFY(KqDescriptor != -1, "kqueue() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(KqDescriptor != -1, "kqueue() failed with %s", strerror(errno)); // set close-on-exit flag { int flags = fcntl(KqDescriptor, F_GETFD); - Y_VERIFY(flags >= 0, "fcntl(F_GETFD) failed with %s", strerror(errno)); + Y_ABORT_UNLESS(flags >= 0, "fcntl(F_GETFD) failed with %s", strerror(errno)); int rc = fcntl(KqDescriptor, F_SETFD, flags | FD_CLOEXEC); - Y_VERIFY(rc != -1, "fcntl(F_SETFD, +FD_CLOEXEC) failed with %s", strerror(errno)); + Y_ABORT_UNLESS(rc != -1, "fcntl(F_SETFD, +FD_CLOEXEC) failed with %s", strerror(errno)); } // register pipe's read end in poller diff --git a/library/cpp/actors/interconnect/poller_actor_linux.h b/library/cpp/actors/interconnect/poller_actor_linux.h index 6bd2cc258fd..f19f53f7302 100644 --- a/library/cpp/actors/interconnect/poller_actor_linux.h +++ b/library/cpp/actors/interconnect/poller_actor_linux.h @@ -13,7 +13,7 @@ namespace NActors { : TPollerThreadBase(actorSystem) { EpollDescriptor = epoll_create1(EPOLL_CLOEXEC); - Y_VERIFY(EpollDescriptor != -1, "epoll_create1() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(EpollDescriptor != -1, "epoll_create1() failed with %s", strerror(errno)); epoll_event event; event.data.ptr = nullptr; diff --git a/library/cpp/actors/interconnect/poller_actor_win.h b/library/cpp/actors/interconnect/poller_actor_win.h index e593cbafd10..9666c32be72 100644 --- a/library/cpp/actors/interconnect/poller_actor_win.h +++ b/library/cpp/actors/interconnect/poller_actor_win.h @@ -97,7 +97,7 @@ namespace NActors { void Request(const TIntrusivePtr<TSocketRecord>& record, bool read, bool write) { with_lock (Mutex) { const auto it = Descriptors.find(record->Socket->GetDescriptor()); - Y_VERIFY(it != Descriptors.end()); + Y_ABORT_UNLESS(it != Descriptors.end()); it->second->Flags |= (read ? READ : 0) | (write ? WRITE : 0); } ExecuteSyncOperation(TPollerWakeup()); diff --git a/library/cpp/actors/interconnect/profiler.h b/library/cpp/actors/interconnect/profiler.h index 77a59e31794..11dac077eac 100644 --- a/library/cpp/actors/interconnect/profiler.h +++ b/library/cpp/actors/interconnect/profiler.h @@ -67,7 +67,7 @@ namespace NActors { TString Format() const { TDeque<TItem>::iterator it = Items.begin(); TString res = FormatLevel(it); - Y_VERIFY(it == Items.end()); + Y_ABORT_UNLESS(it == Items.end()); return res; } @@ -85,13 +85,13 @@ namespace NActors { TVector<TRecord> records; while (it != Items.end() && it->Type != EType::EXIT) { - Y_VERIFY(it->Type == EType::ENTRY); + Y_ABORT_UNLESS(it->Type == EType::ENTRY); const TString marker = Sprintf("%s:%d", it->Marker, it->Line); const ui64 begin = it->Timestamp; ++it; const TString interior = FormatLevel(it); - Y_VERIFY(it != Items.end()); - Y_VERIFY(it->Type == EType::EXIT); + Y_ABORT_UNLESS(it != Items.end()); + Y_ABORT_UNLESS(it->Type == EType::EXIT); const ui64 end = it->Timestamp; records.push_back(TRecord{marker, end - begin, interior}); ++it; diff --git a/library/cpp/actors/interconnect/ut/channel_scheduler_ut.cpp b/library/cpp/actors/interconnect/ut/channel_scheduler_ut.cpp index 2f8e575cb03..98e81d7781f 100644 --- a/library/cpp/actors/interconnect/ut/channel_scheduler_ut.cpp +++ b/library/cpp/actors/interconnect/ut/channel_scheduler_ut.cpp @@ -62,7 +62,7 @@ Y_UNIT_TEST_SUITE(ChannelScheduler) { ui64 weightConsumed = 0; numEvents -= channel->FeedBuf(task, 0, &weightConsumed); ui32 after = task.GetDataSize(); - Y_VERIFY(after >= before); + Y_ABORT_UNLESS(after >= before); scheduler.FinishPick(weightConsumed, 0); const ui32 bytesAdded = after - before; if (!bytesAdded) { diff --git a/library/cpp/actors/interconnect/ut/dynamic_proxy_ut.cpp b/library/cpp/actors/interconnect/ut/dynamic_proxy_ut.cpp index 3c474979dce..4cc6a3cc993 100644 --- a/library/cpp/actors/interconnect/ut/dynamic_proxy_ut.cpp +++ b/library/cpp/actors/interconnect/ut/dynamic_proxy_ut.cpp @@ -50,11 +50,11 @@ public: for (const auto& [queueId, st] : state) { ui32 expected = 0; for (const ui32 index : st.Ok) { - Y_VERIFY(index == expected); + Y_ABORT_UNLESS(index == expected); ++expected; } for (const ui32 index : st.Error) { - Y_VERIFY(index == expected); + Y_ABORT_UNLESS(index == expected); ++expected; } if (st.Error.size()) { @@ -158,7 +158,7 @@ void RaceTestIter(ui32 numThreads, ui32 count) { } for (THPTimer timer; !arriveQueue.Done(); TDuration::MilliSeconds(10)) { - Y_VERIFY(timer.Passed() < 10); + Y_ABORT_UNLESS(timer.Passed() < 10); } nodes.clear(); diff --git a/library/cpp/actors/interconnect/ut/interconnect_ut.cpp b/library/cpp/actors/interconnect/ut/interconnect_ut.cpp index 3596bffd5ac..8d1b47c0c69 100644 --- a/library/cpp/actors/interconnect/ut/interconnect_ut.cpp +++ b/library/cpp/actors/interconnect/ut/interconnect_ut.cpp @@ -27,7 +27,7 @@ public: void Subscribe() { Cerr << (TStringBuilder() << "Subscribe" << Endl); - Y_VERIFY(!SubscribeInFlight); + Y_ABORT_UNLESS(!SubscribeInFlight); SubscribeInFlight = true; Send(TActivationContext::InterconnectProxy(Recipient.NodeId()), new TEvents::TEvSubscribe); } @@ -57,11 +57,11 @@ public: // Cerr << (TStringBuilder() << "Receive# " << ev->Cookie << Endl); if (const auto it = InFlight.find(ev->Cookie); it != InFlight.end()) { auto& [s2cIt, hash] = it->second; - Y_VERIFY(hash == ev->GetChainBuffer()->GetString()); + Y_ABORT_UNLESS(hash == ev->GetChainBuffer()->GetString()); SessionToCookie.erase(s2cIt); InFlight.erase(it); } else if (const auto it = Tentative.find(ev->Cookie); it != Tentative.end()) { - Y_VERIFY(it->second == ev->GetChainBuffer()->GetString()); + Y_ABORT_UNLESS(it->second == ev->GetChainBuffer()->GetString()); Tentative.erase(it); } else { Y_FAIL("Cookie# %" PRIu64, ev->Cookie); @@ -71,9 +71,9 @@ public: void Handle(TEvInterconnect::TEvNodeConnected::TPtr ev) { Cerr << (TStringBuilder() << "TEvNodeConnected" << Endl); - Y_VERIFY(SubscribeInFlight); + Y_ABORT_UNLESS(SubscribeInFlight); SubscribeInFlight = false; - Y_VERIFY(!SessionId); + Y_ABORT_UNLESS(!SessionId); SessionId = ev->Sender; IssueQueries(); } @@ -82,11 +82,11 @@ public: Cerr << (TStringBuilder() << "TEvNodeDisconnected" << Endl); SubscribeInFlight = false; if (SessionId) { - Y_VERIFY(SessionId == ev->Sender); + Y_ABORT_UNLESS(SessionId == ev->Sender); auto r = SessionToCookie.equal_range(SessionId); for (auto it = r.first; it != r.second; ++it) { const auto inFlightIt = InFlight.find(it->second); - Y_VERIFY(inFlightIt != InFlight.end()); + Y_ABORT_UNLESS(inFlightIt != InFlight.end()); Tentative.emplace(inFlightIt->first, inFlightIt->second.second); InFlight.erase(it->second); } diff --git a/library/cpp/actors/interconnect/ut/large.cpp b/library/cpp/actors/interconnect/ut/large.cpp index 192d7333251..725238242a9 100644 --- a/library/cpp/actors/interconnect/ut/large.cpp +++ b/library/cpp/actors/interconnect/ut/large.cpp @@ -57,10 +57,10 @@ Y_UNIT_TEST_SUITE(LargeMessage) { const auto& record = ev->Get()->Record; Cerr << "RECEIVED TEvTest\n"; if (record.GetSequenceNumber() == 1) { - Y_VERIFY(!SessionId); + Y_ABORT_UNLESS(!SessionId); SessionId = ev->InterconnectSession; } else if (record.GetSequenceNumber() == 3) { - Y_VERIFY(SessionId != ev->InterconnectSession); + Y_ABORT_UNLESS(SessionId != ev->InterconnectSession); Done.Signal(); } else { Y_FAIL("incorrect sequence number"); diff --git a/library/cpp/actors/interconnect/ut/lib/interrupter.h b/library/cpp/actors/interconnect/ut/lib/interrupter.h index 48851de2c52..b00985573a2 100644 --- a/library/cpp/actors/interconnect/ut/lib/interrupter.h +++ b/library/cpp/actors/interconnect/ut/lib/interrupter.h @@ -86,8 +86,8 @@ public: { SetReuseAddressAndPort(ListenSocket); TSockAddrInet6 addr(Address.data(), listenPort); - Y_VERIFY(ListenSocket.Bind(&addr) == 0); - Y_VERIFY(ListenSocket.Listen(5) == 0); + Y_ABORT_UNLESS(ListenSocket.Bind(&addr) == 0); + Y_ABORT_UNLESS(ListenSocket.Listen(5) == 0); DelayTraffic = (Bandwidth == 0.0) ? false : true; diff --git a/library/cpp/actors/interconnect/ut/poller_actor_ut.cpp b/library/cpp/actors/interconnect/ut/poller_actor_ut.cpp index 23d846a2fd8..67921ef9bcd 100644 --- a/library/cpp/actors/interconnect/ut/poller_actor_ut.cpp +++ b/library/cpp/actors/interconnect/ut/poller_actor_ut.cpp @@ -36,7 +36,7 @@ std::pair<TTestSocketPtr, TTestSocketPtr> NonBlockSockets() { std::pair<TTestSocketPtr, TTestSocketPtr> TcpSockets() { // create server (listening) socket SOCKET server = socket(AF_INET, SOCK_STREAM, 0); - Y_VERIFY(server != -1, "socket() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(server != -1, "socket() failed with %s", strerror(errno)); // bind it to local address with automatically picked port sockaddr_in addr; @@ -57,7 +57,7 @@ std::pair<TTestSocketPtr, TTestSocketPtr> TcpSockets() { // create client socket SOCKET client = socket(AF_INET, SOCK_STREAM, 0); - Y_VERIFY(client != -1, "socket() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(client != -1, "socket() failed with %s", strerror(errno)); // connect to server if (connect(client, (sockaddr*)&addr, len) == -1) { @@ -66,7 +66,7 @@ std::pair<TTestSocketPtr, TTestSocketPtr> TcpSockets() { // accept connection from the other side SOCKET accepted = accept(server, nullptr, nullptr); - Y_VERIFY(accepted != -1, "accept() failed with %s", strerror(errno)); + Y_ABORT_UNLESS(accepted != -1, "accept() failed with %s", strerror(errno)); // close server socket closesocket(server); diff --git a/library/cpp/actors/interconnect/ut/sticking_ut.cpp b/library/cpp/actors/interconnect/ut/sticking_ut.cpp index 510baa3a1fe..2fa3d0933e8 100644 --- a/library/cpp/actors/interconnect/ut/sticking_ut.cpp +++ b/library/cpp/actors/interconnect/ut/sticking_ut.cpp @@ -71,7 +71,7 @@ public: if (MaxRTT < rtt) { MaxRTT = rtt; Cerr << "Updated MaxRTT# " << MaxRTT << Endl; - Y_VERIFY(MaxRTT <= TDuration::MilliSeconds(500)); + Y_ABORT_UNLESS(MaxRTT <= TDuration::MilliSeconds(500)); } --PingInFlight; Action(); diff --git a/library/cpp/actors/interconnect/ut_fat/main.cpp b/library/cpp/actors/interconnect/ut_fat/main.cpp index c9c77300bb1..abd1cd289af 100644 --- a/library/cpp/actors/interconnect/ut_fat/main.cpp +++ b/library/cpp/actors/interconnect/ut_fat/main.cpp @@ -52,21 +52,21 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { SendMessage(ctx); } } else { - Y_VERIFY(record != InFly.end()); + Y_ABORT_UNLESS(record != InFly.end()); } } void Handle(TEvTestResponse::TPtr& ev, const TActorContext& ctx) override { - Y_VERIFY(InFly); + Y_ABORT_UNLESS(InFly); const NInterconnectTest::TEvTestResponse& record = ev->Get()->Record; - Y_VERIFY(record.HasConfirmedSequenceNumber()); + Y_ABORT_UNLESS(record.HasConfirmedSequenceNumber()); if (!(SendFlags & IEventHandle::FlagGenerateUnsureUndelivered)) { while (record.GetConfirmedSequenceNumber() != InFly.front()) { InFly.pop_front(); --InFlySize; } } - Y_VERIFY(record.GetConfirmedSequenceNumber() == InFly.front(), "got# %" PRIu64 " expected# %" PRIu64, + Y_ABORT_UNLESS(record.GetConfirmedSequenceNumber() == InFly.front(), "got# %" PRIu64 " expected# %" PRIu64, record.GetConfirmedSequenceNumber(), InFly.front()); InFly.pop_front(); --InFlySize; @@ -87,8 +87,8 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { void Handle(TEvTest::TPtr& ev, const TActorContext& /*ctx*/) override { const NInterconnectTest::TEvTest& m = ev->Get()->Record; - Y_VERIFY(m.HasSequenceNumber()); - Y_VERIFY(m.GetSequenceNumber() >= ReceivedCount, "got #%" PRIu64 " expected at least #%" PRIu64, + Y_ABORT_UNLESS(m.HasSequenceNumber()); + Y_ABORT_UNLESS(m.GetSequenceNumber() >= ReceivedCount, "got #%" PRIu64 " expected at least #%" PRIu64, m.GetSequenceNumber(), ReceivedCount); ++ReceivedCount; SenderNode->Send(ev->Sender, new TEvTestResponse(m.GetSequenceNumber())); diff --git a/library/cpp/actors/memory_log/memlog.cpp b/library/cpp/actors/memory_log/memlog.cpp index 17a52847d78..263c5c5079e 100644 --- a/library/cpp/actors/memory_log/memlog.cpp +++ b/library/cpp/actors/memory_log/memlog.cpp @@ -66,7 +66,7 @@ unsigned TMemoryLog::GetSelfCpu() noexcept { unsigned cpu; if (Y_LIKELY(FastGetCpu != nullptr)) { auto result = FastGetCpu(&cpu, nullptr, nullptr); - Y_VERIFY(result == 0); + Y_ABORT_UNLESS(result == 0); return cpu; } else { return 0; @@ -110,7 +110,7 @@ TMemoryLog::TMemoryLog(size_t totalSize, size_t grainSize) , FreeGrains(DEFAULT_TOTAL_SIZE / DEFAULT_GRAIN_SIZE * 2) , Buf(totalSize) { - Y_VERIFY(DEFAULT_TOTAL_SIZE % DEFAULT_GRAIN_SIZE == 0); + Y_ABORT_UNLESS(DEFAULT_TOTAL_SIZE % DEFAULT_GRAIN_SIZE == 0); NumberOfGrains = DEFAULT_TOTAL_SIZE / DEFAULT_GRAIN_SIZE; for (size_t i = 0; i < NumberOfGrains; ++i) { @@ -118,7 +118,7 @@ TMemoryLog::TMemoryLog(size_t totalSize, size_t grainSize) } NumberOfCpus = NSystemInfo::NumberOfCpus(); - Y_VERIFY(NumberOfGrains > NumberOfCpus); + Y_ABORT_UNLESS(NumberOfGrains > NumberOfCpus); ActiveGrains.Reset(new TGrain*[NumberOfCpus]); for (size_t i = 0; i < NumberOfCpus; ++i) { ActiveGrains[i] = GetGrain(i); @@ -267,7 +267,7 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept { // check for format for snprintf constexpr size_t prologSize = 48; alignas(TMemoryLog::MemcpyAlignment) char prolog[prologSize + 1]; - Y_VERIFY(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog); + Y_ABORT_UNLESS(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog); int snprintfResult = snprintf(prolog, prologSize + 1, "TS %020" PRIu64 " TI %020" PRIu64 " ", GetCycleCountFast(), threadId); @@ -275,7 +275,7 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept { if (snprintfResult < 0) { return false; } - Y_VERIFY(snprintfResult == prologSize); + Y_ABORT_UNLESS(snprintfResult == prologSize); amount += prologSize; if (addLF) { @@ -336,7 +336,7 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { // alignment required by NoCacheMemcpy alignas(TMemoryLog::MemcpyAlignment) char buf[TMemoryLog::MAX_MESSAGE_SIZE]; - Y_VERIFY(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf); + Y_ABORT_UNLESS(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf); int prologSize = snprintf(buf, TMemoryLog::MAX_MESSAGE_SIZE - 2, @@ -347,7 +347,7 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { if (Y_UNLIKELY(prologSize < 0)) { return false; } - Y_VERIFY((ui32)prologSize <= TMemoryLog::MAX_MESSAGE_SIZE); + Y_ABORT_UNLESS((ui32)prologSize <= TMemoryLog::MAX_MESSAGE_SIZE); int add = vsnprintf( &buf[prologSize], @@ -357,11 +357,11 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { if (Y_UNLIKELY(add < 0)) { return false; } - Y_VERIFY(add >= 0); + Y_ABORT_UNLESS(add >= 0); auto totalSize = prologSize + add; buf[totalSize++] = '\n'; - Y_VERIFY((ui32)totalSize <= TMemoryLog::MAX_MESSAGE_SIZE); + Y_ABORT_UNLESS((ui32)totalSize <= TMemoryLog::MAX_MESSAGE_SIZE); return BareMemLogWrite(buf, totalSize) != nullptr; } diff --git a/library/cpp/actors/memory_log/mmap.cpp b/library/cpp/actors/memory_log/mmap.cpp index 201998d3433..1fe734235ea 100644 --- a/library/cpp/actors/memory_log/mmap.cpp +++ b/library/cpp/actors/memory_log/mmap.cpp @@ -9,7 +9,7 @@ #endif void TMemoryLog::TMMapArea::MMap(size_t amount) { - Y_VERIFY(amount > 0); + Y_ABORT_UNLESS(amount > 0); #if defined(_unix_) constexpr int mmapProt = PROT_READ | PROT_WRITE; @@ -46,14 +46,14 @@ void TMemoryLog::TMMapArea::MUnmap() { #if defined(_unix_) int result = ::munmap(BufPtr, Size); - Y_VERIFY(result == 0); + Y_ABORT_UNLESS(result == 0); #elif defined(_win_) BOOL result = ::UnmapViewOfFile(BufPtr); - Y_VERIFY(result != 0); + Y_ABORT_UNLESS(result != 0); result = ::CloseHandle(Mapping); - Y_VERIFY(result != 0); + Y_ABORT_UNLESS(result != 0); Mapping = 0; #endif diff --git a/library/cpp/actors/prof/tag.cpp b/library/cpp/actors/prof/tag.cpp index e755ed8ca96..99248a135f0 100644 --- a/library/cpp/actors/prof/tag.cpp +++ b/library/cpp/actors/prof/tag.cpp @@ -30,21 +30,21 @@ namespace NProfiling { } ui32 MakeTag(const char* s) { - Y_VERIFY(s); + Y_ABORT_UNLESS(s); with_lock (Mutex) { return Tags.string_to_atom(s); } } ui32 MakeTags(const TVector<const char*>& ss) { - Y_VERIFY(ss); + Y_ABORT_UNLESS(ss); with_lock (Mutex) { ui32 baseTag = Tags.string_to_atom(ss[0]); ui32 nextTag = baseTag + 1; for (auto i = ss.begin() + 1; i != ss.end(); ++i, ++nextTag) { - Y_VERIFY(*i); + Y_ABORT_UNLESS(*i); ui32 ctag = Tags.string_to_atom(*i); - Y_VERIFY(ctag == nextTag); + Y_ABORT_UNLESS(ctag == nextTag); } return baseTag; } diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index dad62ca6978..256116ce323 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -67,7 +67,7 @@ namespace NActors { if (MailboxTable) { for (ui32 round = 0; !MailboxTable->Cleanup(); ++round) - Y_VERIFY(round < 10, "cyclic event/actor spawn while trying to shutdown actorsystem stub"); + Y_ABORT_UNLESS(round < 10, "cyclic event/actor spawn while trying to shutdown actorsystem stub"); } if (ActorSystem) @@ -108,7 +108,7 @@ namespace NActors { if (!Runtime->EventFilterFunc(*Runtime, ev)) { ui32 nodeId = ev->GetRecipientRewrite().NodeId(); - Y_VERIFY(nodeId != 0); + Y_ABORT_UNLESS(nodeId != 0); ui32 mailboxHint = ev->GetRecipientRewrite().Hint(); Runtime->GetMailbox(nodeId, mailboxHint).Send(ev); Runtime->MailboxesHasEvents.Signal(); @@ -127,7 +127,7 @@ namespace NActors { void TEventMailBox::Send(TAutoPtr<IEventHandle> ev) { IEventHandle* ptr = ev.Get(); - Y_VERIFY(ptr); + Y_ABORT_UNLESS(ptr); #ifdef DEBUG_ORDER_EVENTS ui64 counter = NextToSend++; TrackSent[ptr] = counter; @@ -141,7 +141,7 @@ namespace NActors { #ifdef DEBUG_ORDER_EVENTS auto it = TrackSent.find(result.Get()); if (it != TrackSent.end()) { - Y_VERIFY(ExpectedReceive == it->second); + Y_ABORT_UNLESS(ExpectedReceive == it->second); TrackSent.erase(result.Get()); ++ExpectedReceive; } @@ -378,7 +378,7 @@ namespace NActors { if (!Runtime->EventFilterFunc(*Runtime, ev)) { ui32 nodeId = ev->GetRecipientRewrite().NodeId(); - Y_VERIFY(nodeId != 0); + Y_ABORT_UNLESS(nodeId != 0); TNodeDataBase* node = Runtime->Nodes[nodeId].Get(); if (!AllowSendFrom(node, ev)) { @@ -752,8 +752,8 @@ namespace NActors { } void TTestActorRuntimeBase::AddLocalService(const TActorId& actorId, TActorSetupCmd cmd, ui32 nodeIndex) { - Y_VERIFY(!IsInitialized); - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(!IsInitialized); + Y_ABORT_UNLESS(nodeIndex < NodeCount); auto node = Nodes[nodeIndex + FirstNodeId]; if (!node) { node = GetNodeFactory().CreateNode(); @@ -766,7 +766,7 @@ namespace NActors { void TTestActorRuntimeBase::InitNodes() { NextNodeId += NodeCount; - Y_VERIFY(NodeCount > 0); + Y_ABORT_UNLESS(NodeCount > 0); for (ui32 nodeIndex = 0; nodeIndex < NodeCount; ++nodeIndex) { auto nodeIt = Nodes.emplace(FirstNodeId + nodeIndex, GetNodeFactory().CreateNode()).first; @@ -800,7 +800,7 @@ namespace NActors { } void TTestActorRuntimeBase::SetLogBackend(const TAutoPtr<TLogBackend> logBackend) { - Y_VERIFY(!IsInitialized); + Y_ABORT_UNLESS(!IsInitialized); TGuard<TMutex> guard(Mutex); LogBackend = logBackend; } @@ -819,13 +819,13 @@ namespace NActors { TInstant TTestActorRuntimeBase::GetCurrentTime() const { TGuard<TMutex> guard(Mutex); - Y_VERIFY(!UseRealThreads); + Y_ABORT_UNLESS(!UseRealThreads); return TInstant::MicroSeconds(CurrentTimestamp); } TMonotonic TTestActorRuntimeBase::GetCurrentMonotonicTime() const { TGuard<TMutex> guard(Mutex); - Y_VERIFY(!UseRealThreads); + Y_ABORT_UNLESS(!UseRealThreads); return TMonotonic::MicroSeconds(CurrentTimestamp); } @@ -836,7 +836,7 @@ namespace NActors { Cerr << "UpdateCurrentTime(" << counter << "," << newTime << ")\n"; } TGuard<TMutex> guard(Mutex); - Y_VERIFY(!UseRealThreads); + Y_ABORT_UNLESS(!UseRealThreads); if (newTime.MicroSeconds() > CurrentTimestamp) { CurrentTimestamp = newTime.MicroSeconds(); for (auto& kv : Nodes) { @@ -851,17 +851,17 @@ namespace NActors { } TIntrusivePtr<ITimeProvider> TTestActorRuntimeBase::GetTimeProvider() { - Y_VERIFY(!UseRealThreads); + Y_ABORT_UNLESS(!UseRealThreads); return TimeProvider; } TIntrusivePtr<IMonotonicTimeProvider> TTestActorRuntimeBase::GetMonotonicTimeProvider() { - Y_VERIFY(!UseRealThreads); + Y_ABORT_UNLESS(!UseRealThreads); return MonotonicTimeProvider; } ui32 TTestActorRuntimeBase::GetNodeId(ui32 index) const { - Y_VERIFY(index < NodeCount); + Y_ABORT_UNLESS(index < NodeCount); return FirstNodeId + index; } @@ -896,11 +896,11 @@ namespace NActors { TActorId TTestActorRuntimeBase::Register(IActor* actor, ui32 nodeIndex, ui32 poolId, TMailboxType::EType mailboxType, ui64 revolvingCounter, const TActorId& parentId) { - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); TGuard<TMutex> guard(Mutex); TNodeDataBase* node = Nodes[FirstNodeId + nodeIndex].Get(); if (UseRealThreads) { - Y_VERIFY(poolId < node->ExecutorPools.size()); + Y_ABORT_UNLESS(poolId < node->ExecutorPools.size()); return node->ExecutorPools[poolId]->Register(actor, mailboxType, revolvingCounter, parentId); } @@ -964,11 +964,11 @@ namespace NActors { TActorId TTestActorRuntimeBase::Register(IActor *actor, ui32 nodeIndex, ui32 poolId, TMailboxHeader *mailbox, ui32 hint, const TActorId& parentId) { - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); TGuard<TMutex> guard(Mutex); TNodeDataBase* node = Nodes[FirstNodeId + nodeIndex].Get(); if (UseRealThreads) { - Y_VERIFY(poolId < node->ExecutorPools.size()); + Y_ABORT_UNLESS(poolId < node->ExecutorPools.size()); return node->ExecutorPools[poolId]->Register(actor, mailbox, hint, parentId); } @@ -988,7 +988,7 @@ namespace NActors { TActorId TTestActorRuntimeBase::RegisterService(const TActorId& serviceId, const TActorId& actorId, ui32 nodeIndex) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); TNodeDataBase* node = Nodes[FirstNodeId + nodeIndex].Get(); if (!UseRealThreads) { IActor* actor = FindActor(actorId, node); @@ -1001,7 +1001,7 @@ namespace NActors { TActorId TTestActorRuntimeBase::AllocateEdgeActor(ui32 nodeIndex) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); TActorId edgeActor = Register(new TEdgeActor(this), nodeIndex); EdgeActors.insert(edgeActor); EdgeActorByMailbox[TEventMailboxId(edgeActor.NodeId(), edgeActor.Hint())] = edgeActor; @@ -1020,7 +1020,7 @@ namespace NActors { TEventsList TTestActorRuntimeBase::CaptureMailboxEvents(ui32 hint, ui32 nodeId) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeId >= FirstNodeId && nodeId < FirstNodeId + NodeCount); + Y_ABORT_UNLESS(nodeId >= FirstNodeId && nodeId < FirstNodeId + NodeCount); TEventsList result; GetMailbox(nodeId, hint).Capture(result); return result; @@ -1029,7 +1029,7 @@ namespace NActors { void TTestActorRuntimeBase::PushFront(TAutoPtr<IEventHandle>& ev) { TGuard<TMutex> guard(Mutex); ui32 nodeId = ev->GetRecipientRewrite().NodeId(); - Y_VERIFY(nodeId != 0); + Y_ABORT_UNLESS(nodeId != 0); GetMailbox(nodeId, ev->GetRecipientRewrite().Hint()).PushFront(ev); } @@ -1039,7 +1039,7 @@ namespace NActors { if (*rit) { auto& ev = *rit; ui32 nodeId = ev->GetRecipientRewrite().NodeId(); - Y_VERIFY(nodeId != 0); + Y_ABORT_UNLESS(nodeId != 0); GetMailbox(nodeId, ev->GetRecipientRewrite().Hint()).PushFront(ev); } } @@ -1049,7 +1049,7 @@ namespace NActors { void TTestActorRuntimeBase::PushMailboxEventsFront(ui32 hint, ui32 nodeId, TEventsList& events) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeId >= FirstNodeId && nodeId < FirstNodeId + NodeCount); + Y_ABORT_UNLESS(nodeId >= FirstNodeId && nodeId < FirstNodeId + NodeCount); TEventsList result; GetMailbox(nodeId, hint).PushFront(events); events.clear(); @@ -1118,7 +1118,7 @@ namespace NActors { Runtime.GetMailbox(edgeActor.NodeId(), edgeActor.Hint()).Capture(events); auto mboxId = TEventMailboxId(edgeActor.NodeId(), edgeActor.Hint()); auto storeIt = Store.find(mboxId); - Y_VERIFY(storeIt == Store.end()); + Y_ABORT_UNLESS(storeIt == Store.end()); storeIt = Store.insert(std::make_pair(mboxId, new TEventMailBox)).first; storeIt->second->PushFront(events); if (!events.empty()) @@ -1256,7 +1256,7 @@ namespace NActors { } } - Y_VERIFY(mboxIt != currentMailboxes.end()); + Y_ABORT_UNLESS(mboxIt != currentMailboxes.end()); if (!isIgnored && !CurrentDispatchContext->PrevContext && !restrictedMailboxes && mboxIt->second->IsEmpty() && mboxIt->second->IsScheduledEmpty() && @@ -1267,7 +1267,7 @@ namespace NActors { if (mboxIt == currentMailboxes.end()) { mboxIt = currentMailboxes.begin(); } - Y_VERIFY(endWithMboxIt != currentMailboxes.end()); + Y_ABORT_UNLESS(endWithMboxIt != currentMailboxes.end()); if (mboxIt == endWithMboxIt) { break; } @@ -1425,7 +1425,7 @@ namespace NActors { void TTestActorRuntimeBase::Send(TAutoPtr<IEventHandle> ev, ui32 senderNodeIndex, bool viaActorSystem) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(senderNodeIndex < NodeCount, "senderNodeIndex# %" PRIu32 " < NodeCount# %" PRIu32, + Y_ABORT_UNLESS(senderNodeIndex < NodeCount, "senderNodeIndex# %" PRIu32 " < NodeCount# %" PRIu32, senderNodeIndex, NodeCount); SendInternal(ev, senderNodeIndex, viaActorSystem); } @@ -1436,7 +1436,7 @@ namespace NActors { void TTestActorRuntimeBase::Schedule(TAutoPtr<IEventHandle> ev, const TDuration& duration, ui32 nodeIndex) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); ui32 nodeId = FirstNodeId + nodeIndex; ui32 mailboxHint = ev->GetRecipientRewrite().Hint(); TInstant deadline = TInstant::MicroSeconds(CurrentTimestamp) + duration; @@ -1461,7 +1461,7 @@ namespace NActors { TActorId TTestActorRuntimeBase::GetLocalServiceId(const TActorId& serviceId, ui32 nodeIndex) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); TNodeDataBase* node = Nodes[FirstNodeId + nodeIndex].Get(); return node->ActorSystem->LookupLocalService(serviceId); } @@ -1471,7 +1471,7 @@ namespace NActors { ui32 dispatchCount = 0; if (!edgeFilter.empty()) { for (auto edgeActor : edgeFilter) { - Y_VERIFY(EdgeActors.contains(edgeActor), "%s is not an edge actor", ToString(edgeActor).data()); + Y_ABORT_UNLESS(EdgeActors.contains(edgeActor), "%s is not an edge actor", ToString(edgeActor).data()); } } const TSet<TActorId>& edgeActors = edgeFilter.empty() ? EdgeActors : edgeFilter; @@ -1501,15 +1501,15 @@ namespace NActors { } } - Y_VERIFY(dispatchCount < 1000, "Hard limit to prevent endless loop"); + Y_ABORT_UNLESS(dispatchCount < 1000, "Hard limit to prevent endless loop"); } } TActorId TTestActorRuntimeBase::GetInterconnectProxy(ui32 nodeIndexFrom, ui32 nodeIndexTo) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeIndexFrom < NodeCount); - Y_VERIFY(nodeIndexTo < NodeCount); - Y_VERIFY(nodeIndexFrom != nodeIndexTo); + Y_ABORT_UNLESS(nodeIndexFrom < NodeCount); + Y_ABORT_UNLESS(nodeIndexTo < NodeCount); + Y_ABORT_UNLESS(nodeIndexFrom != nodeIndexTo); TNodeDataBase* node = Nodes[FirstNodeId + nodeIndexFrom].Get(); return node->ActorSystem->InterconnectProxy(FirstNodeId + nodeIndexTo); } @@ -1528,13 +1528,13 @@ namespace NActors { IActor* TTestActorRuntimeBase::FindActor(const TActorId& actorId, ui32 nodeIndex) const { TGuard<TMutex> guard(Mutex); if (nodeIndex == Max<ui32>()) { - Y_VERIFY(actorId.NodeId()); + Y_ABORT_UNLESS(actorId.NodeId()); nodeIndex = actorId.NodeId() - FirstNodeId; } - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); auto nodeIt = Nodes.find(FirstNodeId + nodeIndex); - Y_VERIFY(nodeIt != Nodes.end()); + Y_ABORT_UNLESS(nodeIt != Nodes.end()); TNodeDataBase* node = nodeIt->second.Get(); return FindActor(actorId, node); } @@ -1561,7 +1561,7 @@ namespace NActors { TIntrusivePtr<NMonitoring::TDynamicCounters> TTestActorRuntimeBase::GetDynamicCounters(ui32 nodeIndex) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); ui32 nodeId = FirstNodeId + nodeIndex; TNodeDataBase* node = Nodes[nodeId].Get(); return node->DynamicCounters; @@ -1572,7 +1572,7 @@ namespace NActors { } void TTestActorRuntimeBase::SendInternal(TAutoPtr<IEventHandle> ev, ui32 nodeIndex, bool viaActorSystem) { - Y_VERIFY(nodeIndex < NodeCount); + Y_ABORT_UNLESS(nodeIndex < NodeCount); ui32 nodeId = FirstNodeId + nodeIndex; TNodeDataBase* node = Nodes[nodeId].Get(); ui32 targetNode = ev->GetRecipientRewrite().NodeId(); @@ -1581,7 +1581,7 @@ namespace NActors { targetNodeIndex = nodeIndex; } else { targetNodeIndex = targetNode - FirstNodeId; - Y_VERIFY(targetNodeIndex < NodeCount); + Y_ABORT_UNLESS(targetNodeIndex < NodeCount); } if (viaActorSystem || UseRealThreads || ev->GetRecipientRewrite().IsService() || (targetNodeIndex != nodeIndex)) { @@ -1589,7 +1589,7 @@ namespace NActors { return; } - Y_VERIFY(!ev->GetRecipientRewrite().IsService() && (targetNodeIndex == nodeIndex)); + Y_ABORT_UNLESS(!ev->GetRecipientRewrite().IsService() && (targetNodeIndex == nodeIndex)); if (!AllowSendFrom(node, ev)) { return; @@ -1744,7 +1744,7 @@ namespace NActors { } TActorSystem* TTestActorRuntimeBase::SingleSys() const { - Y_VERIFY(Nodes.size() == 1, "Works only for single system env"); + Y_ABORT_UNLESS(Nodes.size() == 1, "Works only for single system env"); return Nodes.begin()->second->ActorSystem.Get(); } @@ -1758,7 +1758,7 @@ namespace NActors { TActorSystem* TTestActorRuntimeBase::GetActorSystem(ui32 nodeId) { auto it = Nodes.find(GetNodeId(nodeId)); - Y_VERIFY(it != Nodes.end()); + Y_ABORT_UNLESS(it != Nodes.end()); return it->second->ActorSystem.Get(); } @@ -1833,7 +1833,7 @@ namespace NActors { , ReplyChecker(createReplyChecker()) { if (IsSync) { - Y_VERIFY(!runtime->IsRealThreads()); + Y_ABORT_UNLESS(!runtime->IsRealThreads()); } } @@ -1859,7 +1859,7 @@ namespace NActors { } STFUNC(Reply) { - Y_VERIFY(!HasReply); + Y_ABORT_UNLESS(!HasReply); IEventHandle *requestEv = Context->Queue->Head(); TActorId originalSender = requestEv->Sender; HasReply = !ReplyChecker->IsWaitingForMoreResponses(ev.Get()); diff --git a/library/cpp/actors/testlib/test_runtime.h b/library/cpp/actors/testlib/test_runtime.h index 12c99ba8e64..80853e357c2 100644 --- a/library/cpp/actors/testlib/test_runtime.h +++ b/library/cpp/actors/testlib/test_runtime.h @@ -298,7 +298,7 @@ namespace NActors { template<typename T> void AppendToLogSettings(NLog::EComponent minVal, NLog::EComponent maxVal, T func) { - Y_VERIFY(!IsInitialized); + Y_ABORT_UNLESS(!IsInitialized); for (const auto& pair : Nodes) { pair.second->LogSettings->Append(minVal, maxVal, func); @@ -332,7 +332,7 @@ namespace NActors { }, {}, simTimeout); if (simTimeout == TDuration::Max()) - Y_VERIFY(handle); + Y_ABORT_UNLESS(handle); if (handle) { return handle->Get<TEvent>(); @@ -364,7 +364,7 @@ namespace NActors { }, edgeFilter, simTimeout); if (simTimeout == TDuration::Max()) - Y_VERIFY(handle); + Y_ABORT_UNLESS(handle); return handle; } @@ -419,7 +419,7 @@ namespace NActors { return true; }, {}, simTimeout); if (simTimeout == TDuration::Max()) - Y_VERIFY(handle); + Y_ABORT_UNLESS(handle); if (handle) { return std::make_tuple(handle->Type == TEvents::EventType ? handle->Get<TEvents>() diff --git a/library/cpp/actors/util/cpu_load_log.h b/library/cpp/actors/util/cpu_load_log.h index e4ae6122465..225f7148da1 100644 --- a/library/cpp/actors/util/cpu_load_log.h +++ b/library/cpp/actors/util/cpu_load_log.h @@ -147,7 +147,7 @@ struct TMinusOneCpuEstimator { ui64 Delay[BitsSize]; ui64 MaxLatencyIncreaseWithOneLessCpu(TCpuLoadLog<DataSize>** logs, i64 logCount, ui64 timeNs, ui64 periodNs) { - Y_VERIFY(logCount > 0); + Y_ABORT_UNLESS(logCount > 0); ui64 endTimeNs = timeNs; ui64 lastTimeNs = timeNs; diff --git a/library/cpp/actors/util/local_process_key.h b/library/cpp/actors/util/local_process_key.h index 077de8cddc2..bff8bef81b7 100644 --- a/library/cpp/actors/util/local_process_key.h +++ b/library/cpp/actors/util/local_process_key.h @@ -40,7 +40,7 @@ public: } TStringBuf GetNameByIndex(size_t index) const { - Y_VERIFY(index < Names.size()); + Y_ABORT_UNLESS(index < Names.size()); return Names[index]; } @@ -64,7 +64,7 @@ public: const ui32 index = TLocalProcessKeyStateIndexConstructor<T>::BuildCurrentIndex(name, Names.size()); auto x = Map.emplace(name, index); if (x.second) { - Y_VERIFY(index < Names.size(), "a lot of actors or tags for memory monitoring"); + Y_ABORT_UNLESS(index < Names.size(), "a lot of actors or tags for memory monitoring"); Names[index] = name; } @@ -131,7 +131,7 @@ public: static size_t GetIndex(const EnumT key) { ui32 index = static_cast<ui32>(key); - Y_VERIFY(index < Enum2Index.size()); + Y_ABORT_UNLESS(index < Enum2Index.size()); return Enum2Index[index]; } diff --git a/library/cpp/actors/util/rc_buf.h b/library/cpp/actors/util/rc_buf.h index 7b6c68d269c..638a410f6b0 100644 --- a/library/cpp/actors/util/rc_buf.h +++ b/library/cpp/actors/util/rc_buf.h @@ -718,7 +718,7 @@ class TRcBuf { explicit TRcBuf(TInternalBackend s, const char *data, size_t size) : Backend(std::move(s)) { - Y_VERIFY(Backend.GetData().data() == nullptr || + Y_ABORT_UNLESS(Backend.GetData().data() == nullptr || (Backend.GetCookies() && Backend.GetCookies()->Begin == data && Backend.GetCookies()->End == data + size)); Begin = data; End = data + size; @@ -735,9 +735,9 @@ class TRcBuf { TRcBuf(TOwnedPiece, const char *data, size_t size, const TRcBuf& from) : TRcBuf(from.Backend, {data, size}) { - Y_VERIFY(data >= from.GetData()); - Y_VERIFY(data < from.GetData() + from.GetSize()); - Y_VERIFY(data + size <= from.GetData() + from.GetSize()); + Y_ABORT_UNLESS(data >= from.GetData()); + Y_ABORT_UNLESS(data < from.GetData() + from.GetSize()); + Y_ABORT_UNLESS(data + size <= from.GetData() + from.GetSize()); Backend.UpdateCookiesUnsafe(Begin, End); } @@ -794,9 +794,9 @@ public: TRcBuf(TPiece, const char *data, size_t size, const TRcBuf& from) : TRcBuf(from.Backend, {data, size}) { - Y_VERIFY(data >= from.GetData()); - Y_VERIFY(data < from.GetData() + from.GetSize()); - Y_VERIFY(data + size <= from.GetData() + from.GetSize()); + Y_ABORT_UNLESS(data >= from.GetData()); + Y_ABORT_UNLESS(data < from.GetData() + from.GetSize()); + Y_ABORT_UNLESS(data + size <= from.GetData() + from.GetSize()); } TRcBuf(TPiece, const char *begin, const char *end, const TRcBuf& from) @@ -1068,12 +1068,12 @@ public: } void TrimBack(size_t size) { - Y_VERIFY(size <= GetSize()); + Y_ABORT_UNLESS(size <= GetSize()); End = End - (GetSize() - size); } void TrimFront(size_t size) { - Y_VERIFY(size <= GetSize()); + Y_ABORT_UNLESS(size <= GetSize()); Begin = Begin + (GetSize() - size); } diff --git a/library/cpp/actors/util/recentwnd.h b/library/cpp/actors/util/recentwnd.h index ba1ede6f292..0f5ee17fa0b 100644 --- a/library/cpp/actors/util/recentwnd.h +++ b/library/cpp/actors/util/recentwnd.h @@ -53,7 +53,7 @@ public: } void ResetWnd(ui32 wndSize) { - Y_VERIFY(wndSize != 0); + Y_ABORT_UNLESS(wndSize != 0); MaxWndSize_ = wndSize; if (Window_.size() > MaxWndSize_) { Window_.erase(Window_.begin(), diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h index 201ce06f0d4..d1385f6b754 100644 --- a/library/cpp/actors/util/rope.h +++ b/library/cpp/actors/util/rope.h @@ -30,7 +30,7 @@ class TRopeAlignedBuffer : public IContiguousChunk { , Capacity(size) , Offset((Alignment - reinterpret_cast<uintptr_t>(Data)) & (Alignment - 1)) { - Y_VERIFY(Offset <= Alignment - MallocAlignment); + Y_ABORT_UNLESS(Offset <= Alignment - MallocAlignment); } public: @@ -153,8 +153,8 @@ private: void CheckValid() const { #ifndef NDEBUG - Y_VERIFY(ValidityToken == Rope->GetValidityToken()); - Y_VERIFY(Iter == Rope->Chain.end() || Iter->Backend); + Y_ABORT_UNLESS(ValidityToken == Rope->GetValidityToken()); + Y_ABORT_UNLESS(Iter == Rope->Chain.end() || Iter->Backend); #endif } @@ -505,7 +505,7 @@ public: } void ExtractFront(size_t num, TRope *dest) { - Y_VERIFY(Size >= num); + Y_ABORT_UNLESS(Size >= num); if (num == Size && !*dest) { *dest = std::move(*this); return; diff --git a/library/cpp/actors/util/shared_data_ut.cpp b/library/cpp/actors/util/shared_data_ut.cpp index af38fc8f0c8..2f7dc2ccc80 100644 --- a/library/cpp/actors/util/shared_data_ut.cpp +++ b/library/cpp/actors/util/shared_data_ut.cpp @@ -83,12 +83,12 @@ namespace NActors { header->RefCount = 1; header->Owner = this; char* data = raw + sizeof(THeader); - Y_VERIFY(Allocated_.insert(data).second); + Y_ABORT_UNLESS(Allocated_.insert(data).second); return TSharedData::AttachUnsafe(data, size); } void Deallocate(char* data) noexcept { - Y_VERIFY(Allocated_.erase(data) > 0); + Y_ABORT_UNLESS(Allocated_.erase(data) > 0); char* raw = data - sizeof(THeader); y_deallocate(raw); Deallocated_.push_back(data); diff --git a/library/cpp/actors/util/thread_load_log.h b/library/cpp/actors/util/thread_load_log.h index b4b34d47bb5..132e99a52d0 100644 --- a/library/cpp/actors/util/thread_load_log.h +++ b/library/cpp/actors/util/thread_load_log.h @@ -279,7 +279,7 @@ private: public: template <typename T> ui64 MaxLatencyIncreaseWithOneLessCpu(T **threadLoads, ui32 threadCount, ui64 timeNs, ui64 periodNs) { - Y_VERIFY(threadCount > 0); + Y_ABORT_UNLESS(threadCount > 0); struct TTimeSlotData { typename T::TimeSlotType Load; @@ -329,7 +329,7 @@ public: auto timeSlotShiftCount = slotIndex - firstThreadLoadData.Index; maxTimeSlotShiftCount = std::max(maxTimeSlotShiftCount, timeSlotShiftCount); auto res = firstThreadLoadDataQueue.pop(); - Y_VERIFY(res); + Y_ABORT_UNLESS(res); } } @@ -347,7 +347,7 @@ public: // The current load of the first thread can be later // processed by the following time slots of other threads auto res = firstThreadLoadDataQueue.push({firstThreadTimeSlotValue, slotIndex}); - Y_VERIFY(res); + Y_ABORT_UNLESS(res); } } } diff --git a/library/cpp/actors/util/timerfd.h b/library/cpp/actors/util/timerfd.h index 3189e2a672a..78ae27e2ee6 100644 --- a/library/cpp/actors/util/timerfd.h +++ b/library/cpp/actors/util/timerfd.h @@ -15,7 +15,7 @@ struct TTimerFd: public TNonCopyable { TTimerFd() { Fd = timerfd_create(CLOCK_MONOTONIC, 0); - Y_VERIFY(Fd != -1, "timerfd_create(CLOCK_MONOTONIC, 0) -> -1; errno:%d: %s", int(errno), strerror(errno)); + Y_ABORT_UNLESS(Fd != -1, "timerfd_create(CLOCK_MONOTONIC, 0) -> -1; errno:%d: %s", int(errno), strerror(errno)); } ~TTimerFd() { @@ -34,7 +34,7 @@ struct TTimerFd: public TNonCopyable { void Wait() { ui64 expirations; ssize_t s = read(Fd, &expirations, sizeof(ui64)); - Y_UNUSED(s); // Y_VERIFY(s == sizeof(ui64)); + Y_UNUSED(s); // Y_ABORT_UNLESS(s == sizeof(ui64)); } void Wake() { @@ -48,7 +48,7 @@ private: spec.it_interval.tv_sec = 0; spec.it_interval.tv_nsec = 0; int ret = timerfd_settime(Fd, 0, &spec, nullptr); - Y_VERIFY(ret != -1, "timerfd_settime(%d, 0, %" PRIu64 "ns, 0) -> %d; errno:%d: %s", Fd, ns, ret, int(errno), strerror(errno)); + Y_ABORT_UNLESS(ret != -1, "timerfd_settime(%d, 0, %" PRIu64 "ns, 0) -> %d; errno:%d: %s", Fd, ns, ret, int(errno), strerror(errno)); } }; diff --git a/library/cpp/actors/util/unordered_cache.h b/library/cpp/actors/util/unordered_cache.h index 76f036c0cf0..0ab1a3d220d 100644 --- a/library/cpp/actors/util/unordered_cache.h +++ b/library/cpp/actors/util/unordered_cache.h @@ -127,7 +127,7 @@ public: } ~TUnorderedCache() { - Y_VERIFY(!Pop(0)); + Y_ABORT_UNLESS(!Pop(0)); for (ui64 i = 0; i < Concurrency; ++i) { if (ReadSlots[i].ReadFrom) { diff --git a/library/cpp/actors/wilson/wilson_profile_span.cpp b/library/cpp/actors/wilson/wilson_profile_span.cpp index 3939be3c94d..e908ed2b8ac 100644 --- a/library/cpp/actors/wilson/wilson_profile_span.cpp +++ b/library/cpp/actors/wilson/wilson_profile_span.cpp @@ -148,9 +148,9 @@ TProfileSpan::TGuard::~TGuard() { if (!Owner.Enabled) { return; } - Y_VERIFY(CurrentNodeDuration->IsDouble()); + Y_ABORT_UNLESS(CurrentNodeDuration->IsDouble()); CurrentNodeDuration->SetValue((Now() - Start).MicroSeconds() * 0.000001 + CurrentNodeDuration->GetDoubleRobust()); - Y_VERIFY(Owner.CurrentJsonPath.size()); + Y_ABORT_UNLESS(Owner.CurrentJsonPath.size()); Owner.CurrentJsonPath.pop_back(); if (Owner.CurrentJsonPath.empty()) { Owner.LastNoGuards = Now(); diff --git a/library/cpp/actors/wilson/wilson_trace.h b/library/cpp/actors/wilson/wilson_trace.h index 668d32e3068..1675250566b 100644 --- a/library/cpp/actors/wilson/wilson_trace.h +++ b/library/cpp/actors/wilson/wilson_trace.h @@ -34,8 +34,8 @@ namespace NWilson { if (timeToLive == Max<ui32>()) { timeToLive = 4095; } - Y_VERIFY(verbosity <= 15); - Y_VERIFY(timeToLive <= 4095); + Y_ABORT_UNLESS(verbosity <= 15); + Y_ABORT_UNLESS(timeToLive <= 4095); SpanId = spanId; Verbosity = verbosity; TimeToLive = timeToLive; diff --git a/library/cpp/actors/wilson/wilson_uploader.cpp b/library/cpp/actors/wilson/wilson_uploader.cpp index 2390d5a3762..13fca19015b 100644 --- a/library/cpp/actors/wilson/wilson_uploader.cpp +++ b/library/cpp/actors/wilson/wilson_uploader.cpp @@ -172,7 +172,7 @@ namespace NWilson { } void HandleWakeup() { - Y_VERIFY(WakeupScheduled); + Y_ABORT_UNLESS(WakeupScheduled); WakeupScheduled = false; CheckIfDone(); TryToSend(); |