diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-16 20:19:28 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-16 20:52:22 +0300 |
commit | 23b4cd86157da8b9f0f8acd5ef46acfab39669db (patch) | |
tree | 09572627315c6029e0434702e8330c557476ff06 /library/cpp/actors | |
parent | 05d934cd8bfcf7ce4b6241d6bd2914cc776877f9 (diff) | |
download | ydb-23b4cd86157da8b9f0f8acd5ef46acfab39669db.tar.gz |
Y_VERIFY_DEBUG->Y_DEBUG_ABORT_UNLESS at '-v ydb'
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/actors')
52 files changed, 187 insertions, 187 deletions
diff --git a/library/cpp/actors/core/actor.cpp b/library/cpp/actors/core/actor.cpp index 4f7d4c1493..ddd849d285 100644 --- a/library/cpp/actors/core/actor.cpp +++ b/library/cpp/actors/core/actor.cpp @@ -101,7 +101,7 @@ namespace NActors { } TActorId TActivationContext::RegisterWithSameMailbox(IActor* actor, TActorId parentId) { - Y_VERIFY_DEBUG(parentId); + Y_DEBUG_ABORT_UNLESS(parentId); auto& ctx = *TlsActivationContext; return ctx.ExecutorThread.RegisterActor(actor, &ctx.Mailbox, parentId.Hint(), parentId); } diff --git a/library/cpp/actors/core/actor.h b/library/cpp/actors/core/actor.h index d151425680..c807227c43 100644 --- a/library/cpp/actors/core/actor.h +++ b/library/cpp/actors/core/actor.h @@ -694,7 +694,7 @@ namespace NActors { #define STFUNC(funcName) void funcName(TAutoPtr<::NActors::IEventHandle>& ev) #define STATEFN(funcName) void funcName(TAutoPtr<::NActors::IEventHandle>& ev) -#define STFUNC_STRICT_UNHANDLED_MSG_HANDLER Y_VERIFY_DEBUG(false, "%s: unexpected message type 0x%08" PRIx32, __func__, etype); +#define STFUNC_STRICT_UNHANDLED_MSG_HANDLER Y_DEBUG_ABORT_UNLESS(false, "%s: unexpected message type 0x%08" PRIx32, __func__, etype); #define STFUNC_BODY(HANDLERS, UNHANDLED_MSG_HANDLER) \ switch (const ui32 etype = ev->GetTypeRewrite()) { \ diff --git a/library/cpp/actors/core/actor_virtual.h b/library/cpp/actors/core/actor_virtual.h index 9b02660c65..5598312952 100644 --- a/library/cpp/actors/core/actor_virtual.h +++ b/library/cpp/actors/core/actor_virtual.h @@ -19,7 +19,7 @@ public: TEventContext(std::unique_ptr<IEventHandle> handle) : Handle(std::move(handle)) { - Y_VERIFY_DEBUG(dynamic_cast<TEvent*>(Handle->GetBase())); + Y_DEBUG_ABORT_UNLESS(dynamic_cast<TEvent*>(Handle->GetBase())); Event = static_cast<TEvent*>(Handle->GetBase()); Y_ABORT_UNLESS(Event); } @@ -29,7 +29,7 @@ template <class TEvent, class TExpectedActor> class IEventForActor: public IEventBase { protected: virtual bool DoExecute(IActor* actor, std::unique_ptr<IEventHandle> eventPtr) override { - Y_VERIFY_DEBUG(dynamic_cast<TExpectedActor*>(actor)); + Y_DEBUG_ABORT_UNLESS(dynamic_cast<TExpectedActor*>(actor)); auto* actorCorrect = static_cast<TExpectedActor*>(actor); TEventContext<TEvent> context(std::move(eventPtr)); actorCorrect->ProcessEvent(context); diff --git a/library/cpp/actors/core/actorid.h b/library/cpp/actors/core/actorid.h index df1cac1c4e..4e9a7bc3c3 100644 --- a/library/cpp/actors/core/actorid.h +++ b/library/cpp/actors/core/actorid.h @@ -43,7 +43,7 @@ namespace NActors { } explicit TActorId(ui32 nodeId, ui32 poolId, ui64 localId, ui32 hint) noexcept { - Y_VERIFY_DEBUG(poolId <= MaxPoolID); + Y_DEBUG_ABORT_UNLESS(poolId <= MaxPoolID); Raw.N.LocalId = localId; Raw.N.Hint = hint; Raw.N.NodeId = nodeId | (poolId << PoolIndexShift); @@ -83,7 +83,7 @@ namespace NActors { } TStringBuf ServiceId() const noexcept { - Y_VERIFY_DEBUG(IsService()); + Y_DEBUG_ABORT_UNLESS(IsService()); return TStringBuf((const char*)Raw.Buf, MaxServiceIDLength); } @@ -166,7 +166,7 @@ namespace NActors { struct TOrderedCmp { bool operator()(const TActorId &left, const TActorId &right) const noexcept { - Y_VERIFY_DEBUG(!left.IsService() && !right.IsService(), "ordered compare works for plain actorids only"); + Y_DEBUG_ABORT_UNLESS(!left.IsService() && !right.IsService(), "ordered compare works for plain actorids only"); const ui32 n1 = left.NodeId(); const ui32 n2 = right.NodeId(); diff --git a/library/cpp/actors/core/actorsystem.cpp b/library/cpp/actors/core/actorsystem.cpp index b73c545134..c09a208ef5 100644 --- a/library/cpp/actors/core/actorsystem.cpp +++ b/library/cpp/actors/core/actorsystem.cpp @@ -105,7 +105,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_DEBUG_ABORT_UNLESS(!ev->HasEvent() || ev->GetBase()->IsSerializable()); Y_ABORT_UNLESS(ev->Recipient == recipient, "Event rewrite from %s to %s would be lost via interconnect", ev->Recipient.ToString().c_str(), @@ -134,7 +134,7 @@ namespace NActors { ev->Rewrite(ev->GetTypeRewrite(), recipient); } - Y_VERIFY_DEBUG(recipient == ev->GetRecipientRewrite()); + Y_DEBUG_ABORT_UNLESS(recipient == ev->GetRecipientRewrite()); const ui32 recpPool = recipient.PoolID(); if (recipient && recpPool < ExecutorPoolCount) { if ((CpuManager->GetExecutorPool(recpPool)->*EPSpecificSend)(ev)) { @@ -200,7 +200,7 @@ namespace NActors { } ui64 TActorSystem::AllocateIDSpace(ui64 count) { - Y_VERIFY_DEBUG(count < Max<ui32>() / 65536); + Y_DEBUG_ABORT_UNLESS(count < Max<ui32>() / 65536); static_assert(sizeof(TAtomic) == sizeof(ui64), "expect sizeof(TAtomic) == sizeof(ui64)"); diff --git a/library/cpp/actors/core/buffer.cpp b/library/cpp/actors/core/buffer.cpp index 48128d76ef..91ff4dde68 100644 --- a/library/cpp/actors/core/buffer.cpp +++ b/library/cpp/actors/core/buffer.cpp @@ -41,14 +41,14 @@ void TBufferBaseT<PointerType>::Assign(PointerType data, size_t size) noexcept { template <> void TBufferBaseT<void*>::Cut(size_t offset) noexcept { - Y_VERIFY_DEBUG(offset <= Size); + Y_DEBUG_ABORT_UNLESS(offset <= Size); Data = static_cast<char*>(Data) + offset; TBufferBase::Size -= offset; } template <> void TBufferBaseT<const void*>::Cut(size_t offset) noexcept { - Y_VERIFY_DEBUG(offset <= Size); + Y_DEBUG_ABORT_UNLESS(offset <= Size); Data = static_cast<const char*>(Data) + offset; TBufferBase::Size -= offset; } diff --git a/library/cpp/actors/core/cpu_state.h b/library/cpp/actors/core/cpu_state.h index b8030149a7..3f779d5623 100644 --- a/library/cpp/actors/core/cpu_state.h +++ b/library/cpp/actors/core/cpu_state.h @@ -97,7 +97,7 @@ namespace NActors { if (Y_UNLIKELY(current == CpuStopped)) { return false; } - Y_VERIFY_DEBUG(current < MaxPools, "unexpected already waiting state of cpu (%d)", (int)current); + Y_DEBUG_ABORT_UNLESS(current < MaxPools, "unexpected already waiting state of cpu (%d)", (int)current); if (AtomicCas(&State, (state & ~CurrentMask) | CpuSpinning, state)) { // successfully marked as spinning return true; } diff --git a/library/cpp/actors/core/event.h b/library/cpp/actors/core/event.h index 4f6aefc0ee..e7f561338f 100644 --- a/library/cpp/actors/core/event.h +++ b/library/cpp/actors/core/event.h @@ -24,7 +24,7 @@ namespace NActors { protected: // for compatibility with virtual actors virtual bool DoExecute(IActor* /*actor*/, std::unique_ptr<IEventHandle> /*eventPtr*/) { - Y_VERIFY_DEBUG(false); + Y_DEBUG_ABORT_UNLESS(false); return false; } public: diff --git a/library/cpp/actors/core/event_pb.cpp b/library/cpp/actors/core/event_pb.cpp index a72c52efc2..e6a863c44e 100644 --- a/library/cpp/actors/core/event_pb.cpp +++ b/library/cpp/actors/core/event_pb.cpp @@ -148,7 +148,7 @@ namespace NActors { // fill in base params BufferPtr = static_cast<char*>(data); SizeRemain = size; - Y_VERIFY_DEBUG(size); + Y_DEBUG_ABORT_UNLESS(size); // transfer control to the coroutine Y_ABORT_UNLESS(Event); diff --git a/library/cpp/actors/core/event_pb.h b/library/cpp/actors/core/event_pb.h index b6789df2fc..d3b422f1dc 100644 --- a/library/cpp/actors/core/event_pb.h +++ b/library/cpp/actors/core/event_pb.h @@ -647,7 +647,7 @@ namespace NActors { } inline void ActorIdToProto(const TActorId& src, NActorsProto::TActorId* dest) { - Y_VERIFY_DEBUG(dest); + Y_DEBUG_ABORT_UNLESS(dest); dest->SetRawX1(src.RawX1()); dest->SetRawX2(src.RawX2()); } diff --git a/library/cpp/actors/core/executor_pool_base.cpp b/library/cpp/actors/core/executor_pool_base.cpp index 3658736a7c..d58cd6ce08 100644 --- a/library/cpp/actors/core/executor_pool_base.cpp +++ b/library/cpp/actors/core/executor_pool_base.cpp @@ -90,7 +90,7 @@ namespace NActors { } bool TExecutorPoolBaseMailboxed::Send(TAutoPtr<IEventHandle>& ev) { - Y_VERIFY_DEBUG(ev->GetRecipientRewrite().PoolID() == PoolId); + Y_DEBUG_ABORT_UNLESS(ev->GetRecipientRewrite().PoolID() == PoolId); #ifdef ACTORSLIB_COLLECT_EXEC_STATS RelaxedStore(&ev->SendTime, (::NHPTimer::STime)GetCycleCountFast()); #endif @@ -98,7 +98,7 @@ namespace NActors { } bool TExecutorPoolBaseMailboxed::SpecificSend(TAutoPtr<IEventHandle>& ev) { - Y_VERIFY_DEBUG(ev->GetRecipientRewrite().PoolID() == PoolId); + Y_DEBUG_ABORT_UNLESS(ev->GetRecipientRewrite().PoolID() == PoolId); #ifdef ACTORSLIB_COLLECT_EXEC_STATS RelaxedStore(&ev->SendTime, (::NHPTimer::STime)GetCycleCountFast()); #endif @@ -134,7 +134,7 @@ namespace NActors { NHPTimer::STime hpstart = GetCycleCountFast(); #ifdef ACTORSLIB_COLLECT_EXEC_STATS ui32 at = actor->GetActivityType(); - Y_VERIFY_DEBUG(at < Stats.ActorsAliveByActivity.size()); + Y_DEBUG_ABORT_UNLESS(at < Stats.ActorsAliveByActivity.size()); if (at >= Stats.MaxActivityType()) { at = TActorTypeOperator::GetActorActivityIncorrectIndex(); Y_ABORT_UNLESS(at < Stats.ActorsAliveByActivity.size()); diff --git a/library/cpp/actors/core/executor_pool_basic.cpp b/library/cpp/actors/core/executor_pool_basic.cpp index 762ab32190..f9ea74a920 100644 --- a/library/cpp/actors/core/executor_pool_basic.cpp +++ b/library/cpp/actors/core/executor_pool_basic.cpp @@ -183,7 +183,7 @@ namespace NActors { } } - Y_VERIFY_DEBUG(AtomicLoad(&StopFlag) || AtomicLoad(&threadCtx.WaitingFlag) == TThreadCtx::WS_NONE); + Y_DEBUG_ABORT_UNLESS(AtomicLoad(&StopFlag) || AtomicLoad(&threadCtx.WaitingFlag) == TThreadCtx::WS_NONE); #if defined ACTORSLIB_COLLECT_EXEC_STATS if (AtomicDecrement(ThreadUtilization) == 0) { @@ -242,7 +242,7 @@ namespace NActors { ui32 TBasicExecutorPool::GetReadyActivationCommon(TWorkerContext& wctx, ui64 revolvingCounter) { TWorkerId workerId = wctx.WorkerId; - Y_VERIFY_DEBUG(workerId < PoolThreads); + Y_DEBUG_ABORT_UNLESS(workerId < PoolThreads); TTimers timers; @@ -303,7 +303,7 @@ namespace NActors { ui32 TBasicExecutorPool::GetReadyActivationLocalQueue(TWorkerContext& wctx, ui64 revolvingCounter) { TWorkerId workerId = wctx.WorkerId; - Y_VERIFY_DEBUG(workerId < static_cast<i32>(PoolThreads)); + Y_DEBUG_ABORT_UNLESS(workerId < static_cast<i32>(PoolThreads)); if (workerId >= 0 && LocalQueues[workerId].size()) { ui32 activation = LocalQueues[workerId].front(); @@ -500,13 +500,13 @@ namespace NActors { } void TBasicExecutorPool::Schedule(TInstant deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) { - Y_VERIFY_DEBUG(workerId < PoolThreads); + Y_DEBUG_ABORT_UNLESS(workerId < PoolThreads); Schedule(deadline - ActorSystem->Timestamp(), ev, cookie, workerId); } void TBasicExecutorPool::Schedule(TMonotonic deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) { - Y_VERIFY_DEBUG(workerId < PoolThreads); + Y_DEBUG_ABORT_UNLESS(workerId < PoolThreads); const auto current = ActorSystem->Monotonic(); if (deadline < current) @@ -516,7 +516,7 @@ namespace NActors { } void TBasicExecutorPool::Schedule(TDuration delta, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) { - Y_VERIFY_DEBUG(workerId < PoolThreads); + Y_DEBUG_ABORT_UNLESS(workerId < PoolThreads); const auto deadline = ActorSystem->Monotonic() + delta; ScheduleWriters[workerId].Push(deadline.MicroSeconds(), ev.Release(), cookie); diff --git a/library/cpp/actors/core/executor_pool_io.cpp b/library/cpp/actors/core/executor_pool_io.cpp index f315effe0c..78e1d8e1ea 100644 --- a/library/cpp/actors/core/executor_pool_io.cpp +++ b/library/cpp/actors/core/executor_pool_io.cpp @@ -28,7 +28,7 @@ namespace NActors { ui32 TIOExecutorPool::GetReadyActivation(TWorkerContext& wctx, ui64 revolvingCounter) { i16 workerId = wctx.WorkerId; - Y_VERIFY_DEBUG(workerId < PoolThreads); + Y_DEBUG_ABORT_UNLESS(workerId < PoolThreads); NHPTimer::STime elapsed = 0; NHPTimer::STime parked = 0; diff --git a/library/cpp/actors/core/executor_pool_united.cpp b/library/cpp/actors/core/executor_pool_united.cpp index a4a9b26269..a21fd2d1a7 100644 --- a/library/cpp/actors/core/executor_pool_united.cpp +++ b/library/cpp/actors/core/executor_pool_united.cpp @@ -1429,7 +1429,7 @@ namespace NActors { } void TUnitedExecutorPool::Schedule(TMonotonic deadline, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) { - Y_VERIFY_DEBUG(workerId < United->GetWorkerCount()); + Y_DEBUG_ABORT_UNLESS(workerId < United->GetWorkerCount()); const auto current = ActorSystem->Monotonic(); if (deadline < current) { deadline = current; @@ -1438,7 +1438,7 @@ namespace NActors { } void TUnitedExecutorPool::Schedule(TDuration delta, TAutoPtr<IEventHandle> ev, ISchedulerCookie* cookie, TWorkerId workerId) { - Y_VERIFY_DEBUG(workerId < United->GetWorkerCount()); + Y_DEBUG_ABORT_UNLESS(workerId < United->GetWorkerCount()); const auto deadline = ActorSystem->Monotonic() + delta; United->GetScheduleWriter(workerId)->Push(deadline.MicroSeconds(), ev.Release(), cookie); } diff --git a/library/cpp/actors/core/executor_thread.cpp b/library/cpp/actors/core/executor_thread.cpp index 2cdb54a874..deddb0a97e 100644 --- a/library/cpp/actors/core/executor_thread.cpp +++ b/library/cpp/actors/core/executor_thread.cpp @@ -76,7 +76,7 @@ namespace NActors { { } void TExecutorThread::UnregisterActor(TMailboxHeader* mailbox, TActorId actorId) { - Y_VERIFY_DEBUG(IsUnitedWorker || actorId.PoolID() == ExecutorPool->PoolId && ExecutorPool->ResolveMailbox(actorId.Hint()) == mailbox); + Y_DEBUG_ABORT_UNLESS(IsUnitedWorker || actorId.PoolID() == ExecutorPool->PoolId && ExecutorPool->ResolveMailbox(actorId.Hint()) == mailbox); IActor* actor = mailbox->DetachActor(actorId.LocalId()); Ctx.DecrementActorsAliveByActivity(actor->GetActivityType()); DyingActors.push_back(THolder(actor)); @@ -154,7 +154,7 @@ namespace NActors { template <typename TMailbox> bool TExecutorThread::Execute(TMailbox* mailbox, ui32 hint, bool isTailExecution) { - Y_VERIFY_DEBUG(DyingActors.empty()); + Y_DEBUG_ABORT_UNLESS(DyingActors.empty()); bool reclaimAsFree = false; diff --git a/library/cpp/actors/core/log_settings.h b/library/cpp/actors/core/log_settings.h index bb7eabfa5f..f62f55c200 100644 --- a/library/cpp/actors/core/log_settings.h +++ b/library/cpp/actors/core/log_settings.h @@ -143,13 +143,13 @@ namespace NActors { } inline TComponentSettings GetComponentSettings(EComponent component) const { - Y_VERIFY_DEBUG((component & Mask) == component); + Y_DEBUG_ABORT_UNLESS((component & Mask) == component); // by using Mask we don't get outside of array boundaries return TComponentSettings(AtomicGet(ComponentInfo[component & Mask])); } const char* ComponentName(EComponent component) const { - Y_VERIFY_DEBUG((component & Mask) == component); + Y_DEBUG_ABORT_UNLESS((component & Mask) == component); return ComponentNames[component & Mask].data(); } diff --git a/library/cpp/actors/core/mailbox.cpp b/library/cpp/actors/core/mailbox.cpp index de746f0ecb..37cb900ecf 100644 --- a/library/cpp/actors/core/mailbox.cpp +++ b/library/cpp/actors/core/mailbox.cpp @@ -155,7 +155,7 @@ namespace NActors { case TMailboxType::TinyReadAsFilled: return TTinyReadAsFilledMailbox::Get(lineHint, x); default: - Y_VERIFY_DEBUG(false); + Y_DEBUG_ABORT_UNLESS(false); break; } } @@ -182,7 +182,7 @@ namespace NActors { TSimpleMailbox* const mailbox = TSimpleMailbox::Get(lineHint, x); mailbox->Push(recipient.LocalId()); #if (!defined(_tsan_enabled_)) - Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); + Y_DEBUG_ABORT_UNLESS(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->Queue.Push(ev.Release()); if (mailbox->MarkForSchedule()) { @@ -207,7 +207,7 @@ namespace NActors { TRevolvingMailbox* const mailbox = TRevolvingMailbox::Get(lineHint, x); mailbox->Push(recipient.LocalId()); #if (!defined(_tsan_enabled_)) - Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); + Y_DEBUG_ABORT_UNLESS(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->QueueWriter.Push(ev.Release()); if (mailbox->MarkForSchedule()) { @@ -220,7 +220,7 @@ namespace NActors { THTSwapMailbox* const mailbox = THTSwapMailbox::Get(lineHint, x); mailbox->Push(recipient.LocalId()); #if (!defined(_tsan_enabled_)) - Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); + Y_DEBUG_ABORT_UNLESS(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->Queue.Push(ev.Release()); if (mailbox->MarkForSchedule()) { @@ -236,7 +236,7 @@ namespace NActors { TReadAsFilledMailbox* const mailbox = TReadAsFilledMailbox::Get(lineHint, x); mailbox->Push(recipient.LocalId()); #if (!defined(_tsan_enabled_)) - Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); + Y_DEBUG_ABORT_UNLESS(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->Queue.Push(ev.Release()); if (mailbox->MarkForSchedule()) { @@ -252,7 +252,7 @@ namespace NActors { TTinyReadAsFilledMailbox* const mailbox = TTinyReadAsFilledMailbox::Get(lineHint, x); mailbox->Push(recipient.LocalId()); #if (!defined(_tsan_enabled_)) - Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); + Y_DEBUG_ABORT_UNLESS(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->Queue.Push(ev.Release()); if (mailbox->MarkForSchedule()) { diff --git a/library/cpp/actors/core/mailbox.h b/library/cpp/actors/core/mailbox.h index 0daafa83ac..d7e3ef5384 100644 --- a/library/cpp/actors/core/mailbox.h +++ b/library/cpp/actors/core/mailbox.h @@ -216,7 +216,7 @@ namespace NActors { } IActor* DetachActor(ui64 localActorId) noexcept { - Y_VERIFY_DEBUG(FindActor(localActorId) != nullptr); + Y_DEBUG_ABORT_UNLESS(FindActor(localActorId) != nullptr); IActor* actorToDestruct = nullptr; diff --git a/library/cpp/actors/core/mailbox_queue_revolving.h b/library/cpp/actors/core/mailbox_queue_revolving.h index 22b0332095..e1a25dd352 100644 --- a/library/cpp/actors/core/mailbox_queue_revolving.h +++ b/library/cpp/actors/core/mailbox_queue_revolving.h @@ -85,7 +85,7 @@ namespace NActors { } ~TReader() { - Y_VERIFY_DEBUG(Head() == 0); + Y_DEBUG_ABORT_UNLESS(Head() == 0); for (ui32 i = 0; i < TWriteConcurrency; ++i) delete ReadFrom[i]; } @@ -179,7 +179,7 @@ namespace NActors { if (RelaxedLoad(&WriteTo[i]) != nullptr) { if (TChunk* writeTo = AtomicSwap(&WriteTo[i], nullptr)) { const ui64 nextTag = AtomicIncrement(Tag); - Y_VERIFY_DEBUG(nextTag < Max<ui64>()); + Y_DEBUG_ABORT_UNLESS(nextTag < Max<ui64>()); const ui32 writePosition = WritePosition[i]; if (writePosition != TChunk::EntriesCount) { writeTo->Entries[writePosition].Tag = nextTag; diff --git a/library/cpp/actors/core/scheduler_actor.cpp b/library/cpp/actors/core/scheduler_actor.cpp index 513505b5d7..73fd6bd183 100644 --- a/library/cpp/actors/core/scheduler_actor.cpp +++ b/library/cpp/actors/core/scheduler_actor.cpp @@ -184,7 +184,7 @@ namespace NActors { if (it->first <= MonotonicTime) { if (NSchedulerQueue::TQueueType* q = it->second.Get()) { while (NSchedulerQueue::TEntry* x = q->Reader.Pop()) { - Y_VERIFY_DEBUG(x->InstantMicroseconds <= ActiveTick); + Y_DEBUG_ABORT_UNLESS(x->InstantMicroseconds <= ActiveTick); if (eventSchedulingErrorUs == 0 && MonotonicTime > x->InstantMicroseconds) { eventSchedulingErrorUs = MonotonicTime - x->InstantMicroseconds; } @@ -209,7 +209,7 @@ namespace NActors { } if (ActiveTick <= MonotonicTime) { - Y_VERIFY_DEBUG(!ActiveSec || ActiveSec->empty()); + Y_DEBUG_ABORT_UNLESS(!ActiveSec || ActiveSec->empty()); ActiveSec.Destroy(); ActiveTick += IntrasecondThreshold; TScheduleMap::iterator it = ScheduleMap.find(ActiveTick); diff --git a/library/cpp/actors/core/scheduler_basic.cpp b/library/cpp/actors/core/scheduler_basic.cpp index 3b4e0a08c1..5d66224f05 100644 --- a/library/cpp/actors/core/scheduler_basic.cpp +++ b/library/cpp/actors/core/scheduler_basic.cpp @@ -98,7 +98,7 @@ namespace NActors { if (NSchedulerQueue::TQueueType* q = it->second.Get()) { while (NSchedulerQueue::TEntry* x = q->Reader.Pop()) { somethingDone = true; - Y_VERIFY_DEBUG(x->InstantMicroseconds <= activeTick); + Y_DEBUG_ABORT_UNLESS(x->InstantMicroseconds <= activeTick); IEventHandle* ev = x->Ev; ISchedulerCookie* cookie = x->Cookie; // TODO: lazy send with backoff queue to not hang over contended mailboxes @@ -122,7 +122,7 @@ namespace NActors { } if (activeTick <= throttledMonotonic) { - Y_VERIFY_DEBUG(!activeSec || activeSec->empty()); + Y_DEBUG_ABORT_UNLESS(!activeSec || activeSec->empty()); activeSec.Destroy(); activeTick += IntrasecondThreshold; TScheduleMap::iterator it = ScheduleMap.find(activeTick); diff --git a/library/cpp/actors/core/worker_context.h b/library/cpp/actors/core/worker_context.h index 7ee9394cd9..b51ff55cd3 100644 --- a/library/cpp/actors/core/worker_context.h +++ b/library/cpp/actors/core/worker_context.h @@ -47,7 +47,7 @@ namespace NActors { } void AddElapsedCycles(ui32 activityType, i64 elapsed) { - Y_VERIFY_DEBUG(activityType < Stats->MaxActivityType()); + Y_DEBUG_ABORT_UNLESS(activityType < Stats->MaxActivityType()); RelaxedStore(&Stats->ElapsedTicks, RelaxedLoad(&Stats->ElapsedTicks) + elapsed); RelaxedStore(&Stats->ElapsedTicksByActivity[activityType], RelaxedLoad(&Stats->ElapsedTicksByActivity[activityType]) + elapsed); } diff --git a/library/cpp/actors/cppcoro/task.h b/library/cpp/actors/cppcoro/task.h index ad665d4cbf..8afeb7e705 100644 --- a/library/cpp/actors/cppcoro/task.h +++ b/library/cpp/actors/cppcoro/task.h @@ -33,7 +33,7 @@ namespace NActors { explicit TTaskAwaiter(TTaskHandle<T> handle) : Handle(handle) { - Y_VERIFY_DEBUG(Handle); + Y_DEBUG_ABORT_UNLESS(Handle); } TTaskAwaiter(TTaskAwaiter&& rhs) @@ -54,13 +54,13 @@ namespace NActors { // Some arbitrary continuation c suspended and awaits the task TTaskHandle<T> await_suspend(std::coroutine_handle<> c) noexcept { - Y_VERIFY_DEBUG(Handle); + Y_DEBUG_ABORT_UNLESS(Handle); Handle.promise().SetContinuation(c); return Handle; } TTaskResult<T>&& await_resume() noexcept { - Y_VERIFY_DEBUG(Handle); + Y_DEBUG_ABORT_UNLESS(Handle); return std::move(Handle.promise().Result); } @@ -133,7 +133,7 @@ namespace NActors { static std::coroutine_handle<> await_suspend(std::coroutine_handle<TTaskPromise<T>> h) noexcept { auto next = std::exchange(h.promise().Continuation, std::noop_coroutine()); - Y_VERIFY_DEBUG(next, "Task finished without a continuation"); + Y_DEBUG_ABORT_UNLESS(next, "Task finished without a continuation"); return next; } }; @@ -142,7 +142,7 @@ namespace NActors { private: void SetContinuation(std::coroutine_handle<> continuation) noexcept { - Y_VERIFY_DEBUG(!Continuation, "Task can only be awaited once"); + Y_DEBUG_ABORT_UNLESS(!Continuation, "Task can only be awaited once"); Continuation = continuation; } @@ -200,7 +200,7 @@ namespace NActors { * Starts task and returns TTaskResult<T> when it completes */ auto WhenDone() && noexcept { - Y_VERIFY_DEBUG(Handle, "Cannot await an empty task"); + Y_DEBUG_ABORT_UNLESS(Handle, "Cannot await an empty task"); return NDetail::TTaskAwaiter<T>(std::exchange(Handle, {})); } @@ -208,7 +208,7 @@ namespace NActors { * Starts task and returns its result when it completes */ auto operator co_await() && noexcept { - Y_VERIFY_DEBUG(Handle, "Cannot await an empty task"); + Y_DEBUG_ABORT_UNLESS(Handle, "Cannot await an empty task"); return NDetail::TTaskResultAwaiter<T>(std::exchange(Handle, {})); } diff --git a/library/cpp/actors/cppcoro/task_group.h b/library/cpp/actors/cppcoro/task_group.h index 0f7a91262b..5b82e5f592 100644 --- a/library/cpp/actors/cppcoro/task_group.h +++ b/library/cpp/actors/cppcoro/task_group.h @@ -41,7 +41,7 @@ namespace NActors { continue; } // We consume the awaiter - Y_VERIFY_DEBUG(ReadyQueue == nullptr, "TaskGroup is awaiting with non-empty ready queue"); + Y_DEBUG_ABORT_UNLESS(ReadyQueue == nullptr, "TaskGroup is awaiting with non-empty ready queue"); result->Next = ReadyQueue; ReadyQueue = result.release(); return std::exchange(Continuation, {}); @@ -66,7 +66,7 @@ namespace NActors { } Y_NO_INLINE std::coroutine_handle<> Suspend(std::coroutine_handle<> h) noexcept { - Y_VERIFY_DEBUG(ReadyQueue == nullptr, "Caller suspending with non-empty ready queue"); + Y_DEBUG_ABORT_UNLESS(ReadyQueue == nullptr, "Caller suspending with non-empty ready queue"); Continuation = h; void* currentValue = LastReady.load(std::memory_order_acquire); for (;;) { diff --git a/library/cpp/actors/cppcoro/task_result.h b/library/cpp/actors/cppcoro/task_result.h index 70176e64d5..54e66fd57f 100644 --- a/library/cpp/actors/cppcoro/task_result.h +++ b/library/cpp/actors/cppcoro/task_result.h @@ -78,7 +78,7 @@ namespace NActors { } case 2: { std::exception_ptr& e = std::get<2>(Result); - Y_VERIFY_DEBUG(e, "Task exception missing"); + Y_DEBUG_ABORT_UNLESS(e, "Task exception missing"); std::rethrow_exception(e); } } @@ -99,7 +99,7 @@ namespace NActors { } case 2: { std::exception_ptr& e = std::get<2>(Result); - Y_VERIFY_DEBUG(e, "Task exception missing"); + Y_DEBUG_ABORT_UNLESS(e, "Task exception missing"); std::rethrow_exception(std::move(e)); } } diff --git a/library/cpp/actors/http/http.h b/library/cpp/actors/http/http.h index a2d8004a64..d96ab062e8 100644 --- a/library/cpp/actors/http/http.h +++ b/library/cpp/actors/http/http.h @@ -470,7 +470,7 @@ public: //THttpRenderer(TStringBuf method, TStringBuf url, TStringBuf protocol, TStringBuf version); // request void InitRequest(TStringBuf method, TStringBuf url, TStringBuf protocol, TStringBuf version) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Init); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Init); AppendParsedValue<&THttpRequest::Method>(method); Append(' '); AppendParsedValue<&THttpRequest::URL>(url); @@ -485,7 +485,7 @@ public: //THttpRenderer(TStringBuf protocol, TStringBuf version, TStringBuf status, TStringBuf message); // response void InitResponse(TStringBuf protocol, TStringBuf version, TStringBuf status, TStringBuf message) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Init); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Init); AppendParsedValue<&THttpResponse::Protocol>(protocol); Append('/'); AppendParsedValue<&THttpResponse::Version>(version); @@ -516,7 +516,7 @@ public: template <TStringBuf HeaderType::* name> void Set(TStringBuf value) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Header); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Header); Append(HeaderType::template GetName<name>()); Append(": "); AppendParsedValue<name>(value); @@ -525,7 +525,7 @@ public: } void Set(TStringBuf name, TStringBuf value) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Header); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Header); Append(name); Append(": "); auto data = BufferType::Pos(); @@ -539,7 +539,7 @@ public: } void Set(const THeaders& headers) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Header); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Header); for (const auto& [name, value] : headers.Headers) { Set(name, value); } @@ -549,7 +549,7 @@ public: static constexpr TStringBuf ALLOWED_CONTENT_ENCODINGS[] = {"deflate"}; void SetContentEncoding(TStringBuf contentEncoding) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Header); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Header); if (Count(ALLOWED_CONTENT_ENCODINGS, contentEncoding) != 0) { Set("Content-Encoding", contentEncoding); } @@ -562,7 +562,7 @@ public: } void SetBody(TStringBuf body) { - Y_VERIFY_DEBUG(Stage == ERenderStage::Header); + Y_DEBUG_ABORT_UNLESS(Stage == ERenderStage::Header); if (HeaderType::ContentLength.empty()) { Set<&HeaderType::ContentLength>(ToString(body.size())); } diff --git a/library/cpp/actors/interconnect/channel_scheduler.h b/library/cpp/actors/interconnect/channel_scheduler.h index 3040601ef2..b0eac9debc 100644 --- a/library/cpp/actors/interconnect/channel_scheduler.h +++ b/library/cpp/actors/interconnect/channel_scheduler.h @@ -48,7 +48,7 @@ namespace NActors { } void AddToHeap(TEventOutputChannel& channel, ui64 counter) { - Y_VERIFY_DEBUG(channel.IsWorking()); + Y_DEBUG_ABORT_UNLESS(channel.IsWorking()); ui64 weight = channel.WeightConsumedOnPause; weight -= Min(weight, counter - channel.EqualizeCounterOnPause); Heap.push_back(THeapItem{&channel, weight}); diff --git a/library/cpp/actors/interconnect/interconnect_channel.cpp b/library/cpp/actors/interconnect/interconnect_channel.cpp index ab6af8f8d4..30f384786b 100644 --- a/library/cpp/actors/interconnect/interconnect_channel.cpp +++ b/library/cpp/actors/interconnect/interconnect_channel.cpp @@ -188,7 +188,7 @@ namespace NActors { task.Append<External>(data, len); } *bytesSerialized += len; - Y_VERIFY_DEBUG(len <= PartLenRemain); + Y_DEBUG_ABORT_UNLESS(len <= PartLenRemain); PartLenRemain -= len; event.EventActuallySerialized += len; @@ -275,7 +275,7 @@ namespace NActors { size_t bytesSerialized = 0; const bool complete = SerializeEvent<false>(task, event, &bytesSerialized); - Y_VERIFY_DEBUG(bytesSerialized); + Y_DEBUG_ABORT_UNLESS(bytesSerialized); Y_ABORT_UNLESS(bytesSerialized <= Max<ui16>()); TChannelPart part{ diff --git a/library/cpp/actors/interconnect/interconnect_handshake.cpp b/library/cpp/actors/interconnect/interconnect_handshake.cpp index 3c1e90115a..7783de1f92 100644 --- a/library/cpp/actors/interconnect/interconnect_handshake.cpp +++ b/library/cpp/actors/interconnect/interconnect_handshake.cpp @@ -346,7 +346,7 @@ namespace NActors { auto ev = WaitForSpecificEvent<TEvReportConnection>("WaitInboundXdcStream"); SubscribedForConnection = false; if (ev->Get()->HandshakeId != *HandshakeId) { - Y_VERIFY_DEBUG(false); + Y_DEBUG_ABORT_UNLESS(false); Fail(TEvHandshakeFail::HANDSHAKE_FAIL_PERMANENT, "Mismatching HandshakeId in external data channel"); } ExternalDataChannel.GetSocketRef() = std::move(ev->Get()->Socket); @@ -892,7 +892,7 @@ namespace NActors { // extract peer node id from the peer PeerNodeId = request.Header.SelfVirtualId.NodeId(); if (!PeerNodeId) { - Y_VERIFY_DEBUG(false, "PeerNodeId is zero request# %s", request.ToString().data()); + Y_DEBUG_ABORT_UNLESS(false, "PeerNodeId is zero request# %s", request.ToString().data()); Fail(TEvHandshakeFail::HANDSHAKE_FAIL_PERMANENT, "SelfVirtualId.NodeId is empty in initial packet"); } UpdatePrefix(); diff --git a/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp b/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp index 41fd36a824..5e29f49590 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_input_session.cpp @@ -24,7 +24,7 @@ namespace NActors { const char *begin = buffer.data(); const char *mid = begin + offset; const char *end = begin + buffer.size(); - Y_VERIFY_DEBUG(begin <= mid && mid < end); + Y_DEBUG_ABORT_UNLESS(begin <= mid && mid < end); TRope rope; rope.Insert(rope.End(), TRcBuf(TRcBuf::Piece, mid, end, buffer)); @@ -34,16 +34,16 @@ namespace NActors { DropFront(&rope, buffer.size()); } else { - Y_VERIFY_DEBUG(!XdcCatchBytesRead); + Y_DEBUG_ABORT_UNLESS(!XdcCatchBytesRead); } } void TReceiveContext::TPerChannelContext::FetchBuffers(ui16 channel, size_t numBytes, std::deque<std::tuple<ui16, TMutableContiguousSpan>>& outQ) { - Y_VERIFY_DEBUG(numBytes); + Y_DEBUG_ABORT_UNLESS(numBytes); auto it = XdcBuffers.begin() + FetchIndex; for (;;) { - Y_VERIFY_DEBUG(it != XdcBuffers.end()); + Y_DEBUG_ABORT_UNLESS(it != XdcBuffers.end()); const TMutableContiguousSpan span = it->SubSpan(FetchOffset, numBytes); outQ.emplace_back(channel, span); numBytes -= span.size(); @@ -60,7 +60,7 @@ namespace NActors { } void TReceiveContext::TPerChannelContext::DropFront(TRope *from, size_t numBytes) { - Y_VERIFY_DEBUG(from || !XdcCatchBuffer); + Y_DEBUG_ABORT_UNLESS(from || !XdcCatchBuffer); size_t n = numBytes; for (auto& pendingEvent : PendingEvents) { @@ -73,7 +73,7 @@ namespace NActors { } while (numBytes) { - Y_VERIFY_DEBUG(!XdcBuffers.empty()); + Y_DEBUG_ABORT_UNLESS(!XdcBuffers.empty()); auto& front = XdcBuffers.front(); if (from) { from->ExtractFrontPlain(front.data(), Min(numBytes, front.size())); @@ -81,13 +81,13 @@ namespace NActors { if (numBytes < front.size()) { front = front.SubSpan(numBytes, Max<size_t>()); if (!FetchIndex) { // we are sending this very buffer, adjust sending offset - Y_VERIFY_DEBUG(numBytes <= FetchOffset); + Y_DEBUG_ABORT_UNLESS(numBytes <= FetchOffset); FetchOffset -= numBytes; } break; } else { numBytes -= front.size(); - Y_VERIFY_DEBUG(FetchIndex); + Y_DEBUG_ABORT_UNLESS(FetchIndex); --FetchIndex; XdcBuffers.pop_front(); } @@ -240,7 +240,7 @@ namespace NActors { } case EState::PAYLOAD: - Y_VERIFY_DEBUG(PayloadSize); + Y_DEBUG_ABORT_UNLESS(PayloadSize); if (!IncomingData) { break; } else { @@ -369,7 +369,7 @@ namespace NActors { if (PayloadSize) { const ui64 expectedMin = Context->GetLastPacketSerialToConfirm() + 1; const ui64 expectedMax = Context->LastProcessedSerial + 1; - Y_VERIFY_DEBUG(expectedMin <= expectedMax); + Y_DEBUG_ABORT_UNLESS(expectedMin <= expectedMax); if (CurrentSerial ? serial != CurrentSerial + 1 : (serial == 0 || serial > expectedMin)) { LOG_CRIT_IC_SESSION("ICIS06", "%s", TString(TStringBuilder() << "packet serial number mismatch" @@ -383,7 +383,7 @@ namespace NActors { IgnorePayload = serial != expectedMax; CurrentSerial = serial; State = EState::PAYLOAD; - Y_VERIFY_DEBUG(!Payload); + Y_DEBUG_ABORT_UNLESS(!Payload); } else if (serial & TTcpPacketBuf::PingRequestMask) { Send(SessionId, new TEvProcessPingRequest(serial & ~TTcpPacketBuf::PingRequestMask)); } else if (serial & TTcpPacketBuf::PingResponseMask) { @@ -488,10 +488,10 @@ namespace NActors { // mark packet as processed if (IgnorePayload) { - Y_VERIFY_DEBUG(CurrentSerial <= Context->LastProcessedSerial); + Y_DEBUG_ABORT_UNLESS(CurrentSerial <= Context->LastProcessedSerial); } else { ++Context->LastProcessedSerial; - Y_VERIFY_DEBUG(CurrentSerial == Context->LastProcessedSerial); + Y_DEBUG_ABORT_UNLESS(CurrentSerial == Context->LastProcessedSerial); } XdcCatchStream.Ready = Context->LastProcessedSerial == CurrentSerial; ApplyXdcCatchStream(); @@ -515,7 +515,7 @@ namespace NActors { break; } - Y_VERIFY_DEBUG(front.Serial + InboundPacketQ.size() - 1 <= Context->LastProcessedSerial, + Y_DEBUG_ABORT_UNLESS(front.Serial + InboundPacketQ.size() - 1 <= Context->LastProcessedSerial, "front.Serial# %" PRIu64 " LastProcessedSerial# %" PRIu64 " InboundPacketQ.size# %zu", front.Serial, Context->LastProcessedSerial, InboundPacketQ.size()); @@ -643,7 +643,7 @@ namespace NActors { LOG_CRIT_IC_SESSION("ICIS19", "unprocessed payload remains after shuffling" " Type# 0x%08" PRIx32 " InternalPayload.size# %zu ExternalPayload.size# %zu", descr.Type, pendingEvent.InternalPayload.size(), pendingEvent.ExternalPayload.size()); - Y_VERIFY_DEBUG(false); + Y_DEBUG_ABORT_UNLESS(false); throw TExReestablishConnection{TDisconnectReason::FormatError()}; } } @@ -800,7 +800,7 @@ namespace NActors { if (Buffers.empty()) { // we have read all the data, increase number of buffers CurrentBuffers = Min(CurrentBuffers * 2, MaxBuffers); } else { - Y_VERIFY_DEBUG(numBuffersCovered); + Y_DEBUG_ABORT_UNLESS(numBuffersCovered); const size_t index = numBuffersCovered - 1; @@ -858,7 +858,7 @@ namespace NActors { // scatter read data const char *in = XdcCatchStream.Buffer.data(); while (recvres) { - Y_VERIFY_DEBUG(!XdcCatchStream.Markup.empty()); + Y_DEBUG_ABORT_UNLESS(!XdcCatchStream.Markup.empty()); auto& [channel, apply, bytes] = XdcCatchStream.Markup.front(); size_t bytesInChannel = Min<size_t>(recvres, bytes); bytes -= bytesInChannel; @@ -893,7 +893,7 @@ namespace NActors { void TInputSessionTCP::ApplyXdcCatchStream() { if (!XdcCatchStream.Applied && XdcCatchStream.Ready && !XdcCatchStream.BytesPending) { - Y_VERIFY_DEBUG(XdcCatchStream.Markup.empty()); + Y_DEBUG_ABORT_UNLESS(XdcCatchStream.Markup.empty()); auto process = [&](auto& context) { context.ApplyCatchBuffer(); @@ -967,7 +967,7 @@ namespace NActors { Y_ABORT_UNLESS(!bytesToCut); } - Y_VERIFY_DEBUG(n); + Y_DEBUG_ABORT_UNLESS(n); auto& context = GetPerChannelContext(channel); context.DropFront(nullptr, n); ProcessEvents(context); @@ -986,7 +986,7 @@ namespace NActors { return; } while (span.size()) { - Y_VERIFY_DEBUG(!XdcChecksumQ.empty()); + Y_DEBUG_ABORT_UNLESS(!XdcChecksumQ.empty()); auto& [size, expected] = XdcChecksumQ.front(); const size_t n = Min<size_t>(size, span.size()); if (Params.UseXxhash) { diff --git a/library/cpp/actors/interconnect/interconnect_tcp_proxy.h b/library/cpp/actors/interconnect/interconnect_tcp_proxy.h index b03b406195..4622bf3f88 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_proxy.h +++ b/library/cpp/actors/interconnect/interconnect_tcp_proxy.h @@ -364,7 +364,7 @@ namespace NActors { " THIS IS NOT A BUG IN INTERCONNECT, check the event sender instead", ev->Type, ev->GetTypeRewrite(), ev->Sender.ToString().data()); LOG_ERROR_IC("ICP03", "%s", msg.data()); - Y_VERIFY_DEBUG(false, "%s", msg.data()); + Y_DEBUG_ABORT_UNLESS(false, "%s", msg.data()); } Y_ABORT_UNLESS(ev->GetTypeRewrite() != TEvInterconnect::EvForward || ev->Recipient.NodeId() == PeerNodeId, @@ -499,7 +499,7 @@ namespace NActors { auto& msg = *ev->Get(); if (msg.Subscribe) { if (const auto [it, inserted] = ConnectionSubscriptions.emplace(msg.HandshakeId, ev->Sender); !inserted) { - Y_VERIFY_DEBUG(false); + Y_DEBUG_ABORT_UNLESS(false); ConnectionSubscriptions.erase(it); // collision happened somehow? } } else { diff --git a/library/cpp/actors/interconnect/interconnect_tcp_session.cpp b/library/cpp/actors/interconnect/interconnect_tcp_session.cpp index 3644706e51..59738b2052 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_session.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_session.cpp @@ -591,7 +591,7 @@ namespace NActors { static constexpr size_t maxBytesAtOnce = 256 * 1024; size_t bytesToSendInMain = maxBytesAtOnce; - Y_VERIFY_DEBUG(OutgoingIndex < SendQueue.size() || (OutgoingIndex == SendQueue.size() && !OutgoingOffset && !OutgoingStream)); + Y_DEBUG_ABORT_UNLESS(OutgoingIndex < SendQueue.size() || (OutgoingIndex == SendQueue.size() && !OutgoingOffset && !OutgoingStream)); if (OutOfBandStream) { bytesToSendInMain = 0; @@ -603,7 +603,7 @@ namespace NActors { // align send up to packet boundary size_t offset = OutgoingOffset; for (auto it = sendQueueIt; ForcedWriteLength; ++it, offset = 0) { - Y_VERIFY_DEBUG(it != SendQueue.end()); + Y_DEBUG_ABORT_UNLESS(it != SendQueue.end()); bytesToSendInMain += it->PacketSize - offset; // send remainder of current packet ForcedWriteLength -= Min(it->PacketSize - offset, ForcedWriteLength); } @@ -861,7 +861,7 @@ namespace NActors { size_t bytesDropped = 0; size_t bytesDroppedFromXdc = 0; ui64 frontPacketSerial = OutputCounter - SendQueue.size() + 1; - Y_VERIFY_DEBUG(OutgoingIndex < SendQueue.size() || (OutgoingIndex == SendQueue.size() && !OutgoingOffset && !OutgoingStream), + Y_DEBUG_ABORT_UNLESS(OutgoingIndex < SendQueue.size() || (OutgoingIndex == SendQueue.size() && !OutgoingOffset && !OutgoingStream), "OutgoingIndex# %zu SendQueue.size# %zu OutgoingOffset# %zu Unsent# %zu Total# %zu", OutgoingIndex, SendQueue.size(), OutgoingOffset, OutgoingStream.CalculateUnsentSize(), OutgoingStream.CalculateOutgoingSize()); @@ -910,7 +910,7 @@ namespace NActors { Y_ABORT_UNLESS(NumEventsInQueue); while (NumEventsInQueue) { TEventOutputChannel *channel = ChannelScheduler->PickChannelWithLeastConsumedWeight(); - Y_VERIFY_DEBUG(!channel->IsEmpty()); + Y_DEBUG_ABORT_UNLESS(!channel->IsEmpty()); // generate some data within this channel const ui64 netBefore = channel->GetBufferedAmountOfData(); @@ -918,14 +918,14 @@ namespace NActors { const bool eventDone = channel->FeedBuf(task, serial, &gross); channel->UnaccountedTraffic += gross; const ui64 netAfter = channel->GetBufferedAmountOfData(); - Y_VERIFY_DEBUG(netAfter <= netBefore); // net amount should shrink + Y_DEBUG_ABORT_UNLESS(netAfter <= netBefore); // net amount should shrink const ui64 net = netBefore - netAfter; // number of net bytes serialized // adjust metrics for local and global queue size TotalOutputQueueSize -= net; Proxy->Metrics->SubOutputBuffersTotalSize(net); bytesGenerated += gross; - Y_VERIFY_DEBUG(!!net == !!gross && gross >= net, "net# %" PRIu64 " gross# %" PRIu64, net, gross); + Y_DEBUG_ABORT_UNLESS(!!net == !!gross && gross >= net, "net# %" PRIu64 " gross# %" PRIu64, net, gross); // return it back to queue or delete, depending on whether this channel is still working or not ChannelScheduler->FinishPick(gross, EqualizeCounter); diff --git a/library/cpp/actors/interconnect/interconnect_tcp_session.h b/library/cpp/actors/interconnect/interconnect_tcp_session.h index a499d189c2..64519b2667 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_session.h +++ b/library/cpp/actors/interconnect/interconnect_tcp_session.h @@ -162,7 +162,7 @@ namespace NActors { if (value & LastPacketSerialToConfirmLockBit) { return false; } - Y_VERIFY_DEBUG(value + 1 == nextValue); + Y_DEBUG_ABORT_UNLESS(value + 1 == nextValue); if (LastPacketSerialToConfirm.compare_exchange_weak(value, nextValue)) { return true; } diff --git a/library/cpp/actors/interconnect/outgoing_stream.h b/library/cpp/actors/interconnect/outgoing_stream.h index 23982c4a3e..47803764d7 100644 --- a/library/cpp/actors/interconnect/outgoing_stream.h +++ b/library/cpp/actors/interconnect/outgoing_stream.h @@ -134,7 +134,7 @@ namespace NInterconnect { void WriteBookmark(TBookmark&& bookmark, TContiguousSpan in) { for (auto& outChunk : bookmark) { - Y_VERIFY_DEBUG(outChunk.size() <= in.size()); + Y_DEBUG_ABORT_UNLESS(outChunk.size() <= in.size()); memcpy(outChunk.data(), in.data(), outChunk.size()); in = in.SubSpan(outChunk.size(), Max<size_t>()); } @@ -167,24 +167,24 @@ namespace NInterconnect { } void Advance(size_t numBytes) { // called when numBytes portion of data has been sent - Y_VERIFY_DEBUG(numBytes == 0 || SendQueuePos != SendQueue.size()); - Y_VERIFY_DEBUG(numBytes <= UnsentBytes); + Y_DEBUG_ABORT_UNLESS(numBytes == 0 || SendQueuePos != SendQueue.size()); + Y_DEBUG_ABORT_UNLESS(numBytes <= UnsentBytes); SendOffset += numBytes; UnsentBytes -= numBytes; for (auto it = SendQueue.begin() + SendQueuePos; SendOffset && it->Span.size() <= SendOffset; ++SendQueuePos, ++it) { SendOffset -= it->Span.size(); - Y_VERIFY_DEBUG(SendOffset == 0 || SendQueuePos != SendQueue.size() - 1); + Y_DEBUG_ABORT_UNLESS(SendOffset == 0 || SendQueuePos != SendQueue.size() - 1); } } void DropFront(size_t numBytes) { // drops first numBytes from the queue, freeing buffers when necessary while (numBytes) { - Y_VERIFY_DEBUG(!SendQueue.empty()); + Y_DEBUG_ABORT_UNLESS(!SendQueue.empty()); auto& front = SendQueue.front(); if (numBytes < front.Span.size()) { front.Span = front.Span.SubSpan(numBytes, Max<size_t>()); if (SendQueuePos == 0) { - Y_VERIFY_DEBUG(numBytes <= SendOffset, "numBytes# %zu SendOffset# %zu SendQueuePos# %zu" + Y_DEBUG_ABORT_UNLESS(numBytes <= SendOffset, "numBytes# %zu SendOffset# %zu SendQueuePos# %zu" " SendQueue.size# %zu CalculateUnsentSize# %zu", numBytes, SendOffset, SendQueuePos, SendQueue.size(), CalculateUnsentSize()); SendOffset -= numBytes; @@ -193,7 +193,7 @@ namespace NInterconnect { } else { numBytes -= front.Span.size(); } - Y_VERIFY_DEBUG(!front.Buffer || (front.Span.data() >= front.Buffer->Data && + Y_DEBUG_ABORT_UNLESS(!front.Buffer || (front.Span.data() >= front.Buffer->Data && front.Span.data() + front.Span.size() <= front.Buffer->Data + BufferSize)); DropBufferReference(front.Buffer); SendQueue.pop_front(); @@ -210,7 +210,7 @@ namespace NInterconnect { auto it = SendQueue.end(); ssize_t offset = -numBytes; while (offset < 0) { - Y_VERIFY_DEBUG(it != SendQueue.begin()); + Y_DEBUG_ABORT_UNLESS(it != SendQueue.begin()); const TSendChunk& chunk = *--it; offset += chunk.Span.size(); } @@ -222,10 +222,10 @@ namespace NInterconnect { private: void AppendAcquiredSpan(TContiguousSpan span) { TBuffer *buffer = AppendBuffer; - Y_VERIFY_DEBUG(buffer); - Y_VERIFY_DEBUG(span.data() == AppendBuffer->Data + AppendOffset); + Y_DEBUG_ABORT_UNLESS(buffer); + Y_DEBUG_ABORT_UNLESS(span.data() == AppendBuffer->Data + AppendOffset); AppendOffset += span.size(); - Y_VERIFY_DEBUG(AppendOffset <= BufferSize); + Y_DEBUG_ABORT_UNLESS(AppendOffset <= BufferSize); if (AppendOffset == BufferSize) { AppendBuffer = nullptr; } else { @@ -239,7 +239,7 @@ namespace NInterconnect { if (!SendQueue.empty()) { auto& back = SendQueue.back(); if (back.Span.data() + back.Span.size() == span.data()) { // check if it is possible just to extend the last span - Y_VERIFY_DEBUG(buffer == back.Buffer); + Y_DEBUG_ABORT_UNLESS(buffer == back.Buffer); if (SendQueuePos == SendQueue.size()) { --SendQueuePos; SendOffset = back.Span.size(); @@ -256,7 +256,7 @@ namespace NInterconnect { if (buffer && !--buffer->RefCount) { const size_t index = buffer->Index; auto& cell = Buffers[index]; - Y_VERIFY_DEBUG(cell.get() == buffer); + Y_DEBUG_ABORT_UNLESS(cell.get() == buffer); std::swap(cell, Buffers.back()); cell->Index = index; Buffers.pop_back(); diff --git a/library/cpp/actors/interconnect/packet.h b/library/cpp/actors/interconnect/packet.h index 105cc41ce3..0a748cda2a 100644 --- a/library/cpp/actors/interconnect/packet.h +++ b/library/cpp/actors/interconnect/packet.h @@ -162,12 +162,12 @@ struct TTcpPacketOutTask : TNonCopyable { // Preallocate some space to fill it later. NInterconnect::TOutgoingStream::TBookmark Bookmark(size_t len) { if (ChecksummingCrc32c()) { - Y_VERIFY_DEBUG(!InsideBookmark); + Y_DEBUG_ABORT_UNLESS(!InsideBookmark); InsideBookmark = true; PreBookmarkChecksum = std::exchange(InternalChecksum, 0); InternalChecksumLen = 0; } - Y_VERIFY_DEBUG(len <= GetInternalFreeAmount()); + Y_DEBUG_ABORT_UNLESS(len <= GetInternalFreeAmount()); InternalSize += len; return OutgoingStream.Bookmark(len); } @@ -175,7 +175,7 @@ struct TTcpPacketOutTask : TNonCopyable { // Write previously bookmarked space. void WriteBookmark(NInterconnect::TOutgoingStream::TBookmark&& bookmark, const void *buffer, size_t len) { if (ChecksummingCrc32c()) { - Y_VERIFY_DEBUG(InsideBookmark); + Y_DEBUG_ABORT_UNLESS(InsideBookmark); InsideBookmark = false; const ui32 bookmarkChecksum = Crc32cExtendMSanCompatible(PreBookmarkChecksum, buffer, len); InternalChecksum = Crc32cCombine(bookmarkChecksum, InternalChecksum, InternalChecksumLen); @@ -196,7 +196,7 @@ struct TTcpPacketOutTask : TNonCopyable { // Append reference to some data (acquired previously or external pointer). template<bool External> void Append(const void *buffer, size_t len) { - Y_VERIFY_DEBUG(len <= (External ? GetExternalFreeAmount() : GetInternalFreeAmount())); + Y_DEBUG_ABORT_UNLESS(len <= (External ? GetExternalFreeAmount() : GetInternalFreeAmount())); (External ? ExternalSize : InternalSize) += len; (External ? XdcStream : OutgoingStream).Append({static_cast<const char*>(buffer), len}); ProcessChecksum<External>(buffer, len); @@ -205,7 +205,7 @@ struct TTcpPacketOutTask : TNonCopyable { // Write some data with copying. template<bool External> void Write(const void *buffer, size_t len) { - Y_VERIFY_DEBUG(len <= (External ? GetExternalFreeAmount() : GetInternalFreeAmount())); + Y_DEBUG_ABORT_UNLESS(len <= (External ? GetExternalFreeAmount() : GetInternalFreeAmount())); (External ? ExternalSize : InternalSize) += len; (External ? XdcStream : OutgoingStream).Write({static_cast<const char*>(buffer), len}); ProcessChecksum<External>(buffer, len); @@ -246,7 +246,7 @@ struct TTcpPacketOutTask : TNonCopyable { }); header.Checksum = XXH3_64bits_digest(&state); } else if (ChecksummingCrc32c()) { - Y_VERIFY_DEBUG(!InsideBookmark); + Y_DEBUG_ABORT_UNLESS(!InsideBookmark); const ui32 headerChecksum = Crc32cExtendMSanCompatible(0, &header, sizeof(header)); header.Checksum = Crc32cCombine(headerChecksum, InternalChecksum, InternalSize); } diff --git a/library/cpp/actors/interconnect/poller_tcp.cpp b/library/cpp/actors/interconnect/poller_tcp.cpp index 8267df31ea..ab9b7c85ea 100644 --- a/library/cpp/actors/interconnect/poller_tcp.cpp +++ b/library/cpp/actors/interconnect/poller_tcp.cpp @@ -4,7 +4,7 @@ namespace NInterconnect { TPollerThreads::TPollerThreads(size_t units, bool useSelect) : Units(units) { - Y_VERIFY_DEBUG(!Units.empty()); + Y_DEBUG_ABORT_UNLESS(!Units.empty()); for (auto& unit : Units) unit = TPollerUnit::Make(useSelect); } diff --git a/library/cpp/actors/interconnect/poller_tcp_unit.cpp b/library/cpp/actors/interconnect/poller_tcp_unit.cpp index 59e7dda810..853fce04b4 100644 --- a/library/cpp/actors/interconnect/poller_tcp_unit.cpp +++ b/library/cpp/actors/interconnect/poller_tcp_unit.cpp @@ -67,7 +67,7 @@ namespace NInterconnect { TPollerUnit::StartReadOperation( const TIntrusivePtr<TSharedDescriptor>& stream, TFDDelegate&& operation) { - Y_VERIFY_DEBUG(stream); + Y_DEBUG_ABORT_UNLESS(stream); if (AtomicLoad(&StopFlag)) return; GetSide<false>().InputQueue.Push(TSide::TItem(stream, std::move(operation))); @@ -77,7 +77,7 @@ namespace NInterconnect { TPollerUnit::StartWriteOperation( const TIntrusivePtr<TSharedDescriptor>& stream, TFDDelegate&& operation) { - Y_VERIFY_DEBUG(stream); + Y_DEBUG_ABORT_UNLESS(stream); if (AtomicLoad(&StopFlag)) return; GetSide<true>().InputQueue.Push(TSide::TItem(stream, std::move(operation))); diff --git a/library/cpp/actors/interconnect/poller_tcp_unit_epoll.cpp b/library/cpp/actors/interconnect/poller_tcp_unit_epoll.cpp index 5067f6724f..33666a2747 100644 --- a/library/cpp/actors/interconnect/poller_tcp_unit_epoll.cpp +++ b/library/cpp/actors/interconnect/poller_tcp_unit_epoll.cpp @@ -31,7 +31,7 @@ namespace NInterconnect { int Initialize() { const auto epoll = ::epoll_create(10000); - Y_VERIFY_DEBUG(epoll > 0); + Y_DEBUG_ABORT_UNLESS(epoll > 0); return epoll; } diff --git a/library/cpp/actors/interconnect/poller_tcp_unit_select.cpp b/library/cpp/actors/interconnect/poller_tcp_unit_select.cpp index ae7aaad566..1615d4679d 100644 --- a/library/cpp/actors/interconnect/poller_tcp_unit_select.cpp +++ b/library/cpp/actors/interconnect/poller_tcp_unit_select.cpp @@ -60,7 +60,7 @@ namespace NInterconnect { const auto numberEvents = ::pselect(FD_SETSIZE, &sets[R], &sets[W], &sets[E], &timeout, &sigmask); #endif - Y_VERIFY_DEBUG(numberEvents >= 0); + Y_DEBUG_ABORT_UNLESS(numberEvents >= 0); for (auto it = side.Operations.cbegin(); side.Operations.cend() != it;) { if (FD_ISSET(it->first, &sets[O]) || FD_ISSET(it->first, &sets[E])) diff --git a/library/cpp/actors/interconnect/watchdog_timer.h b/library/cpp/actors/interconnect/watchdog_timer.h index 66cf19dc4d..2a5860f84c 100644 --- a/library/cpp/actors/interconnect/watchdog_timer.h +++ b/library/cpp/actors/interconnect/watchdog_timer.h @@ -37,7 +37,7 @@ namespace NActors { } void operator()(typename TEvent::TPtr& ev) { - Y_VERIFY_DEBUG(EventScheduled); + Y_DEBUG_ABORT_UNLESS(EventScheduled); EventScheduled = false; if (!Armed()) { // just do nothing @@ -58,7 +58,7 @@ namespace NActors { private: void Schedule(const TActorIdentity& actor) { - Y_VERIFY_DEBUG(Armed()); + Y_DEBUG_ABORT_UNLESS(Armed()); if (!EventScheduled) { actor.Schedule(TriggerTimestamp, new TEvent); EventScheduled = true; diff --git a/library/cpp/actors/util/affinity.cpp b/library/cpp/actors/util/affinity.cpp index cc1b6e70ec..5851105ae7 100644 --- a/library/cpp/actors/util/affinity.cpp +++ b/library/cpp/actors/util/affinity.cpp @@ -12,7 +12,7 @@ public: TImpl() { #ifdef _linux_ int ar = sched_getaffinity(0, sizeof(cpu_set_t), &Mask); - Y_VERIFY_DEBUG(ar == 0); + Y_DEBUG_ABORT_UNLESS(ar == 0); #endif } @@ -33,7 +33,7 @@ public: void Set() const { #ifdef _linux_ int ar = sched_setaffinity(0, sizeof(cpu_set_t), &Mask); - Y_VERIFY_DEBUG(ar == 0); + Y_DEBUG_ABORT_UNLESS(ar == 0); #endif } diff --git a/library/cpp/actors/util/queue_oneone_inplace.h b/library/cpp/actors/util/queue_oneone_inplace.h index d7ec8bb21c..288011955a 100644 --- a/library/cpp/actors/util/queue_oneone_inplace.h +++ b/library/cpp/actors/util/queue_oneone_inplace.h @@ -48,7 +48,7 @@ public: } ~TOneOneQueueInplace() { - Y_VERIFY_DEBUG(Head() == 0); + Y_DEBUG_ABORT_UNLESS(Head() == 0); delete ReadFrom; } diff --git a/library/cpp/actors/util/rc_buf.h b/library/cpp/actors/util/rc_buf.h index 638a410f6b..b5b15fa4cc 100644 --- a/library/cpp/actors/util/rc_buf.h +++ b/library/cpp/actors/util/rc_buf.h @@ -69,7 +69,7 @@ public: {} const char& operator[](size_t index) const { - Y_VERIFY_DEBUG(index < Size_); + Y_DEBUG_ABORT_UNLESS(index < Size_); return Data_[index]; } @@ -639,7 +639,7 @@ class TRcBuf { if constexpr (sizeof(TObject) <= sizeof(TBackendHolder)) { TBackendHolder res = TBackend::Empty; new(&res) std::decay_t<TObject>(std::forward<TObject>(object)); - Y_VERIFY_DEBUG((res.Data[0] & ValueMask) == res.Data[0]); + Y_DEBUG_ABORT_UNLESS((res.Data[0] & ValueMask) == res.Data[0]); res.Data[0] = res.Data[0] | static_cast<uintptr_t>(type); return res; } else { @@ -649,7 +649,7 @@ class TRcBuf { template<typename TOwner, typename TCallback, bool IsConst = std::is_const_v<TOwner>> static std::invoke_result_t<TCallback, EType, std::conditional_t<IsConst, const TString&, TString&>> VisitRaw(TOwner& origValue, TCallback&& callback) { - Y_VERIFY_DEBUG(origValue); + Y_DEBUG_ABORT_UNLESS(origValue); const EType type = static_cast<EType>(origValue.Data[0] & TypeMask); TBackendHolder value(origValue); value.Data[0] = value.Data[0] & ValueMask; diff --git a/library/cpp/actors/util/rc_buf_backend.h b/library/cpp/actors/util/rc_buf_backend.h index f7089a302c..9cb8616554 100644 --- a/library/cpp/actors/util/rc_buf_backend.h +++ b/library/cpp/actors/util/rc_buf_backend.h @@ -157,12 +157,12 @@ public: private: Y_FORCE_INLINE THeader* Header() const noexcept { - Y_VERIFY_DEBUG(Data_); + Y_DEBUG_ABORT_UNLESS(Data_); return reinterpret_cast<THeader*>(Data_); } Y_FORCE_INLINE char* Data() const noexcept { - Y_VERIFY_DEBUG(Data_); + Y_DEBUG_ABORT_UNLESS(Data_); return Data_ + OverheadSize; } diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h index 1ab9a1b8ee..4487fdc87d 100644 --- a/library/cpp/actors/util/rope.h +++ b/library/cpp/actors/util/rope.h @@ -162,7 +162,7 @@ private: CheckValid(); while (amount) { - Y_VERIFY_DEBUG(Valid()); + Y_DEBUG_ABORT_UNLESS(Valid()); const size_t max = ContiguousSize(); const size_t num = std::min(amount, max); amount -= num; @@ -189,7 +189,7 @@ private: amount -= num; Ptr -= num; if (amount) { - Y_VERIFY_DEBUG(Iter != GetChainBegin()); + Y_DEBUG_ABORT_UNLESS(Iter != GetChainBegin()); --Iter; Ptr = Iter->End; } @@ -253,7 +253,7 @@ private: // Advance to next contiguous block of data. void AdvanceToNextContiguousBlock() { CheckValid(); - Y_VERIFY_DEBUG(Valid()); + Y_DEBUG_ABORT_UNLESS(Valid()); ++Iter; Ptr = Iter != GetChainEnd() ? Iter->Begin : nullptr; } @@ -263,7 +263,7 @@ private: CheckValid(); while (len) { - Y_VERIFY_DEBUG(Ptr); + Y_DEBUG_ABORT_UNLESS(Ptr); // calculate amount of bytes we need to move const size_t max = ContiguousSize(); @@ -290,7 +290,7 @@ private: template<bool IsOtherConst> bool operator ==(const TIteratorImpl<IsOtherConst>& other) const { - Y_VERIFY_DEBUG(Rope == other.Rope); + Y_DEBUG_ABORT_UNLESS(Rope == other.Rope); CheckValid(); other.CheckValid(); return Iter == other.Iter && Ptr == other.Ptr; @@ -399,7 +399,7 @@ public: } TRope(TConstIterator begin, TConstIterator end) { - Y_VERIFY_DEBUG(begin.Rope == end.Rope); + Y_DEBUG_ABORT_UNLESS(begin.Rope == end.Rope); if (begin.Rope == this) { TRope temp(begin, end); *this = std::move(temp); @@ -545,8 +545,8 @@ public: } void Insert(TIterator pos, TRope&& rope) { - Y_VERIFY_DEBUG(this == pos.Rope); - Y_VERIFY_DEBUG(this != &rope); + Y_DEBUG_ABORT_UNLESS(this == pos.Rope); + Y_DEBUG_ABORT_UNLESS(this != &rope); if (!rope) { return; // do nothing for empty rope @@ -595,16 +595,16 @@ public: if (rope) { // insert remains Chain.Splice(pos.Iter, rope.Chain, rope.Chain.begin(), rope.Chain.end()); } - Y_VERIFY_DEBUG(!rope); + Y_DEBUG_ABORT_UNLESS(!rope); InvalidateIterators(); } void EraseFront(size_t len) { - Y_VERIFY_DEBUG(Size >= len); + Y_DEBUG_ABORT_UNLESS(Size >= len); Size -= len; while (len) { - Y_VERIFY_DEBUG(Chain); + Y_DEBUG_ABORT_UNLESS(Chain); TRcBuf& item = Chain.GetFirstChunk(); const size_t itemSize = item.GetSize(); if (len >= itemSize) { @@ -620,11 +620,11 @@ public: } void EraseBack(size_t len) { - Y_VERIFY_DEBUG(Size >= len); + Y_DEBUG_ABORT_UNLESS(Size >= len); Size -= len; while (len) { - Y_VERIFY_DEBUG(Chain); + Y_DEBUG_ABORT_UNLESS(Chain); TRcBuf& item = Chain.GetLastChunk(); const size_t itemSize = item.GetSize(); if (len >= itemSize) { @@ -647,7 +647,7 @@ public: Size -= len; while (len) { auto& chunk = Chain.GetFirstChunk(); - Y_VERIFY_DEBUG(chunk.Backend); + Y_DEBUG_ABORT_UNLESS(chunk.Backend); const size_t num = Min(len, chunk.GetSize()); memcpy(buffer, chunk.Begin, num); buffer = static_cast<char*>(buffer) + num; @@ -848,7 +848,7 @@ public: private: void Cut(TIterator begin, TIterator end, TRope *target) { // ensure all iterators are belong to us - Y_VERIFY_DEBUG(this == begin.Rope && this == end.Rope); + Y_DEBUG_ABORT_UNLESS(this == begin.Rope && this == end.Rope); // if begin and end are equal, we do nothing -- checking this case allows us to find out that begin does not // point to End(), for example @@ -886,7 +886,7 @@ private: // now drop full blocks size_t rangeSize = 0; for (auto it = begin.Iter; it != end.Iter; ++it) { - Y_VERIFY_DEBUG(it->GetSize()); + Y_DEBUG_ABORT_UNLESS(it->GetSize()); rangeSize += it->GetSize(); } if (rangeSize) { @@ -927,7 +927,7 @@ public: while (len) { if (Arena) { auto iter = Arena.Begin(); - Y_VERIFY_DEBUG(iter.Valid()); + Y_DEBUG_ABORT_UNLESS(iter.Valid()); char *dest = const_cast<char*>(iter.ContiguousData()); const size_t bytesToCopy = std::min(len, iter.ContiguousSize()); memcpy(dest, buffer, bytesToCopy); @@ -952,7 +952,7 @@ public: struct TRopeUtils { static void Memset(TRope::TConstIterator dst, char c, size_t size) { while (size) { - Y_VERIFY_DEBUG(dst.Valid()); + Y_DEBUG_ABORT_UNLESS(dst.Valid()); size_t len = std::min(size, dst.ContiguousSize()); memset(const_cast<char*>(dst.ContiguousData()), c, len); dst += len; @@ -962,7 +962,7 @@ struct TRopeUtils { static void Memcpy(TRope::TConstIterator dst, TRope::TConstIterator src, size_t size) { while (size) { - Y_VERIFY_DEBUG(dst.Valid() && src.Valid(), + Y_DEBUG_ABORT_UNLESS(dst.Valid() && src.Valid(), "Invalid iterator in memcpy: dst.Valid() - %" PRIu32 ", src.Valid() - %" PRIu32, (ui32)dst.Valid(), (ui32)src.Valid()); size_t len = std::min(size, std::min(dst.ContiguousSize(), src.ContiguousSize())); @@ -975,7 +975,7 @@ struct TRopeUtils { static void Memcpy(TRope::TConstIterator dst, const char* src, size_t size) { while (size) { - Y_VERIFY_DEBUG(dst.Valid()); + Y_DEBUG_ABORT_UNLESS(dst.Valid()); size_t len = std::min(size, dst.ContiguousSize()); memcpy(const_cast<char*>(dst.ContiguousData()), src, len); size -= len; @@ -986,7 +986,7 @@ struct TRopeUtils { static void Memcpy(char* dst, TRope::TConstIterator src, size_t size) { while (size) { - Y_VERIFY_DEBUG(src.Valid()); + Y_DEBUG_ABORT_UNLESS(src.Valid()); size_t len = std::min(size, src.ContiguousSize()); memcpy(dst, src.ContiguousData(), len); size -= len; @@ -1080,13 +1080,13 @@ class TRopeZeroCopyInput : public IZeroCopyInput { private: size_t DoNext(const void** ptr, size_t len) override { - Y_VERIFY_DEBUG(ptr); + Y_DEBUG_ABORT_UNLESS(ptr); if (Len == 0) { if (Iter.Valid()) { Data = Iter.ContiguousData(); Len = Iter.ContiguousSize(); - Y_VERIFY_DEBUG(Len); - Y_VERIFY_DEBUG(Data); + Y_DEBUG_ABORT_UNLESS(Len); + Y_DEBUG_ABORT_UNLESS(Data); ++Iter; } else { Data = nullptr; diff --git a/library/cpp/actors/util/rope_cont_embedded_list.h b/library/cpp/actors/util/rope_cont_embedded_list.h index 80d5990310..294599538f 100644 --- a/library/cpp/actors/util/rope_cont_embedded_list.h +++ b/library/cpp/actors/util/rope_cont_embedded_list.h @@ -40,14 +40,14 @@ class TChunkList { } void ClearSingleItem() { - Y_VERIFY_DEBUG(Next == this && Prev == this); + Y_DEBUG_ABORT_UNLESS(Next == this && Prev == this); static_cast<TChunk&>(*this) = {}; Next = Prev = nullptr; } template<typename... TArgs> TItem *PrepareForUse(TArgs&&... args) { - Y_VERIFY_DEBUG(!IsInUse()); + Y_DEBUG_ABORT_UNLESS(!IsInUse()); static_cast<TChunk&>(*this) = TChunk(std::forward<TArgs>(args)...); Next = Prev = this; Invalidate(); @@ -136,7 +136,7 @@ private: TIterator& operator++() { CheckValid(); - Y_VERIFY_DEBUG(Item); + Y_DEBUG_ABORT_UNLESS(Item); Item = Item->Next; if (Item == &Cont->Root) { Item = nullptr; // make it end @@ -154,10 +154,10 @@ private: TIterator& operator--() { CheckValid(); if (!Item) { - Y_VERIFY_DEBUG(*Cont); + Y_DEBUG_ABORT_UNLESS(*Cont); Item = Cont->Root.Prev; } else { - Y_VERIFY_DEBUG(Item != &Cont->Root); + Y_DEBUG_ABORT_UNLESS(Item != &Cont->Root); Item = Item->Prev; } UpdateValidityToken(); @@ -171,7 +171,7 @@ private: } friend bool operator ==(const TIterator& x, const TIterator& y) { - Y_VERIFY_DEBUG(x.Cont == y.Cont); + Y_DEBUG_ABORT_UNLESS(x.Cont == y.Cont); x.CheckValid(); y.CheckValid(); return x.Item == y.Item; @@ -184,8 +184,8 @@ private: private: void CheckValid() const { #ifndef NDEBUG - Y_VERIFY_DEBUG(ValidityToken == (Item ? Item->ValidityToken : 0)); - Y_VERIFY_DEBUG(Cont && (Item != &Cont->Root || *Cont)); + Y_DEBUG_ABORT_UNLESS(ValidityToken == (Item ? Item->ValidityToken : 0)); + Y_DEBUG_ABORT_UNLESS(Cont && (Item != &Cont->Root || *Cont)); #endif } @@ -207,7 +207,7 @@ public: ~TChunkList() { Erase(begin(), end()); - Y_VERIFY_DEBUG(!*this); + Y_DEBUG_ABORT_UNLESS(!*this); } TChunkList(const TChunkList& other) { @@ -231,7 +231,7 @@ public: TChunkList& operator=(TChunkList&& other) { if (this != &other) { Erase(begin(), end()); - Y_VERIFY_DEBUG(!*this); + Y_DEBUG_ABORT_UNLESS(!*this); if (other.Root.IsInUse()) { // do we have something to move? Root.PrepareForUse(std::move(static_cast<TChunk&>(other.Root))); if (other.Root.Next != &other.Root) { // does other contain more than one item? @@ -290,7 +290,7 @@ public: } void EraseBack() { - Y_VERIFY_DEBUG(*this); + Y_DEBUG_ABORT_UNLESS(*this); if (Root.Prev != &Root) { delete Root.Prev; } else { @@ -324,8 +324,8 @@ public: if (first != last) { --last; // set 'last' pointing to the actual last element of the source range - Y_VERIFY_DEBUG(first.Item != &from.Root); - Y_VERIFY_DEBUG(pos.Item != &Root); + Y_DEBUG_ABORT_UNLESS(first.Item != &from.Root); + Y_DEBUG_ABORT_UNLESS(pos.Item != &Root); TItem* const firstItem = first.Item; TItem* const lastItem = last.Item; @@ -347,9 +347,9 @@ public: operator bool() const { return Root.IsInUse(); } - TChunk& GetFirstChunk() { Y_VERIFY_DEBUG(*this); return Root; } - const TChunk& GetFirstChunk() const { Y_VERIFY_DEBUG(*this); return Root; } - TChunk& GetLastChunk() { Y_VERIFY_DEBUG(*this); return *Root.Prev; } + TChunk& GetFirstChunk() { Y_DEBUG_ABORT_UNLESS(*this); return Root; } + const TChunk& GetFirstChunk() const { Y_DEBUG_ABORT_UNLESS(*this); return Root; } + TChunk& GetLastChunk() { Y_DEBUG_ABORT_UNLESS(*this); return *Root.Prev; } iterator begin() { return *this ? iterator(this, &Root) : end(); } const_iterator begin() const { return *this ? const_iterator(this, &Root) : end(); } @@ -359,14 +359,14 @@ public: private: TChunk Pop(iterator& pos) { pos.CheckValid(); - Y_VERIFY_DEBUG(pos.Item); + Y_DEBUG_ABORT_UNLESS(pos.Item); if (pos.Item == &Root) { TChunk res = PopFront(); pos = begin(); return res; } else { - Y_VERIFY_DEBUG(pos != end()); + Y_DEBUG_ABORT_UNLESS(pos != end()); TItem* const item = pos++.Item; TChunk res = std::move(static_cast<TChunk&>(*item)); delete item; @@ -375,7 +375,7 @@ private: } TChunk PopFront() { - Y_VERIFY_DEBUG(*this); + Y_DEBUG_ABORT_UNLESS(*this); TChunk res = std::move(static_cast<TChunk&>(Root)); if (Root.Next != &Root) { static_cast<TChunk&>(Root) = std::move(static_cast<TChunk&>(*Root.Next)); diff --git a/library/cpp/actors/util/shared_data.cpp b/library/cpp/actors/util/shared_data.cpp index 209ca7bcbd..51311ce7a3 100644 --- a/library/cpp/actors/util/shared_data.cpp +++ b/library/cpp/actors/util/shared_data.cpp @@ -40,7 +40,7 @@ namespace NActors { NActors::NMemory::TLabel<MemoryLabelSharedData>::Sub(privateHeader->AllocSize); auto* header = reinterpret_cast<THeader*>(raw + PrivateHeaderSize); - Y_VERIFY_DEBUG(header->Owner == nullptr); + Y_DEBUG_ABORT_UNLESS(header->Owner == nullptr); y_deallocate(raw); } diff --git a/library/cpp/actors/util/shared_data.h b/library/cpp/actors/util/shared_data.h index 753eb85d07..bd9afb00a5 100644 --- a/library/cpp/actors/util/shared_data.h +++ b/library/cpp/actors/util/shared_data.h @@ -86,9 +86,9 @@ namespace NActors { Y_FORCE_INLINE explicit operator bool() const { return Size_ > 0; } - Y_FORCE_INLINE char* mutable_data() { Y_VERIFY_DEBUG(IsPrivate()); return Data_; } - Y_FORCE_INLINE char* mutable_begin() { Y_VERIFY_DEBUG(IsPrivate()); return Data_; } - Y_FORCE_INLINE char* mutable_end() { Y_VERIFY_DEBUG(IsPrivate()); return Data_ + Size_; } + Y_FORCE_INLINE char* mutable_data() { Y_DEBUG_ABORT_UNLESS(IsPrivate()); return Data_; } + Y_FORCE_INLINE char* mutable_begin() { Y_DEBUG_ABORT_UNLESS(IsPrivate()); return Data_; } + Y_FORCE_INLINE char* mutable_end() { Y_DEBUG_ABORT_UNLESS(IsPrivate()); return Data_ + Size_; } Y_FORCE_INLINE const char* data() const { return Data_; } Y_FORCE_INLINE const char* begin() const { return Data_; } @@ -188,7 +188,7 @@ namespace NActors { private: Y_FORCE_INLINE THeader* Header() const noexcept { - Y_VERIFY_DEBUG(Data_); + Y_DEBUG_ABORT_UNLESS(Data_); return reinterpret_cast<THeader*>(Data_ - sizeof(THeader)); } diff --git a/library/cpp/actors/util/ticket_lock.h b/library/cpp/actors/util/ticket_lock.h index 3b1fa80393..30355c3390 100644 --- a/library/cpp/actors/util/ticket_lock.h +++ b/library/cpp/actors/util/ticket_lock.h @@ -23,7 +23,7 @@ public: ui32 revolves = 0; const ui32 ticket = AtomicUi32Increment(&TicketIn) - 1; while (ticket != AtomicLoad(&TicketOut)) { - Y_VERIFY_DEBUG(ticket >= AtomicLoad(&TicketOut)); + Y_DEBUG_ABORT_UNLESS(ticket >= AtomicLoad(&TicketOut)); SpinLockPause(); ++revolves; } diff --git a/library/cpp/actors/util/unordered_cache.h b/library/cpp/actors/util/unordered_cache.h index 0ab1a3d220..40794fc04b 100644 --- a/library/cpp/actors/util/unordered_cache.h +++ b/library/cpp/actors/util/unordered_cache.h @@ -100,7 +100,7 @@ private: } void WriteOne(TLockedWriter& lock, T x) { - Y_VERIFY_DEBUG(x != 0); + Y_DEBUG_ABORT_UNLESS(x != 0); const ui32 pos = AtomicLoad(&lock.Slot->WritePosition); if (pos != TChunk::EntriesCount) { diff --git a/library/cpp/actors/wilson/wilson_span.h b/library/cpp/actors/wilson/wilson_span.h index bf9b5bcf61..2ebf837cda 100644 --- a/library/cpp/actors/wilson/wilson_span.h +++ b/library/cpp/actors/wilson/wilson_span.h @@ -65,7 +65,7 @@ namespace NWilson { {} ~TData() { - Y_VERIFY_DEBUG(Sent || Ignored); + Y_DEBUG_ABORT_UNLESS(Sent || Ignored); } }; @@ -237,7 +237,7 @@ namespace NWilson { } void VerifyNotSent() { - Y_VERIFY_DEBUG(!Data || !Data->Sent, "span has been ended"); + Y_DEBUG_ABORT_UNLESS(!Data || !Data->Sent, "span has been ended"); } }; diff --git a/library/cpp/actors/wilson/wilson_trace.h b/library/cpp/actors/wilson/wilson_trace.h index 1675250566..41a6505134 100644 --- a/library/cpp/actors/wilson/wilson_trace.h +++ b/library/cpp/actors/wilson/wilson_trace.h @@ -116,7 +116,7 @@ namespace NWilson { p += sizeof(SpanId); memcpy(&Raw, p, sizeof(Raw)); p += sizeof(Raw); - Y_VERIFY_DEBUG(p - in == sizeof(TSerializedTraceId)); + Y_DEBUG_ABORT_UNLESS(p - in == sizeof(TSerializedTraceId)); } TTraceId(const NActorsProto::TTraceId& pb) @@ -138,7 +138,7 @@ namespace NWilson { p += sizeof(SpanId); memcpy(p, &Raw, sizeof(Raw)); p += sizeof(Raw); - Y_VERIFY_DEBUG(p - *out == sizeof(TSerializedTraceId)); + Y_DEBUG_ABORT_UNLESS(p - *out == sizeof(TSerializedTraceId)); } void Serialize(NActorsProto::TTraceId *pb) const { @@ -223,7 +223,7 @@ namespace NWilson { static constexpr size_t GetSpanIdSize() { return sizeof(ui64); } void Validate() const { - Y_VERIFY_DEBUG(*this || !SpanId); + Y_DEBUG_ABORT_UNLESS(*this || !SpanId); } // for compatibility with NBS |