diff options
author | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-17 08:15:44 +0300 |
---|---|---|
committer | ilnurkh <ilnurkh@yandex-team.com> | 2023-10-17 09:00:07 +0300 |
commit | 784925324fd115c37bc98c5bbfe64c15f9966d74 (patch) | |
tree | f763f6eaacfcd4757d249977aaddfa4e9b2a355b /library/cpp/messagebus | |
parent | d6c75d9ec33559b29eb61a8f2e17cbca30fd5ae2 (diff) | |
download | ydb-784925324fd115c37bc98c5bbfe64c15f9966d74.tar.gz |
Y_FAIL->Y_ABORT at '^li'
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/messagebus')
27 files changed, 44 insertions, 44 deletions
diff --git a/library/cpp/messagebus/actor/tasks.h b/library/cpp/messagebus/actor/tasks.h index 5e1fd5f212..ba4bc3050b 100644 --- a/library/cpp/messagebus/actor/tasks.h +++ b/library/cpp/messagebus/actor/tasks.h @@ -41,7 +41,7 @@ namespace NActor { } else if (newState == E_WAITING) { return false; } - Y_FAIL("unknown"); + Y_ABORT("unknown"); } }; diff --git a/library/cpp/messagebus/config/netaddr.cpp b/library/cpp/messagebus/config/netaddr.cpp index 4660711a0c..0e9f76be8c 100644 --- a/library/cpp/messagebus/config/netaddr.cpp +++ b/library/cpp/messagebus/config/netaddr.cpp @@ -14,7 +14,7 @@ namespace NBus { case EIP_VERSION_6: return "EIP_VERSION_6"; } - Y_FAIL(); + Y_ABORT(); } int ToAddrFamily(EIpVersion ipVersion) { @@ -26,7 +26,7 @@ namespace NBus { case EIP_VERSION_6: return AF_INET6; } - Y_FAIL(); + Y_ABORT(); } class TNetworkAddressRef: private TNetworkAddress, public TAddrInfo { @@ -81,7 +81,7 @@ namespace NBus { case EIP_VERSION_ANY: return "any address"; default: - Y_FAIL("unreachable"); + Y_ABORT("unreachable"); } } @@ -158,7 +158,7 @@ namespace NBus { case AF_INET6: return InetToHost(((sockaddr_in6*)Ptr->Addr())->sin6_port); default: - Y_FAIL("unknown AF: %d", (int)Ptr->Addr()->sa_family); + Y_ABORT("unknown AF: %d", (int)Ptr->Addr()->sa_family); throw 1; } } diff --git a/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp b/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp index 0c74f9ecc3..008084d345 100644 --- a/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp +++ b/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp @@ -8,7 +8,7 @@ TDebugReceiverProtocol::TDebugReceiverProtocol() } void TDebugReceiverProtocol::Serialize(const NBus::TBusMessage*, TBuffer&) { - Y_FAIL("it is receiver only"); + Y_ABORT("it is receiver only"); } TAutoPtr<NBus::TBusMessage> TDebugReceiverProtocol::Deserialize(ui16, TArrayRef<const char> payload) { diff --git a/library/cpp/messagebus/event_loop.cpp b/library/cpp/messagebus/event_loop.cpp index 9a9d90508d..ffb31d0c9b 100644 --- a/library/cpp/messagebus/event_loop.cpp +++ b/library/cpp/messagebus/event_loop.cpp @@ -262,7 +262,7 @@ TEventLoop::TImpl::TImpl(const char* name) SOCKET wakeupSockets[2]; if (SocketPair(wakeupSockets) < 0) { - Y_FAIL("failed to create socket pair for wakeup sockets: %s", LastSystemErrorText()); + Y_ABORT("failed to create socket pair for wakeup sockets: %s", LastSystemErrorText()); } TSocketHolder wakeupReadSocket(wakeupSockets[0]); @@ -297,7 +297,7 @@ void TEventLoop::TImpl::Run() { if (*c == this) { char buf[0x1000]; if (NBus::NPrivate::SocketRecv(WakeupReadSocket, buf) < 0) { - Y_FAIL("failed to recv from wakeup socket: %s", LastSystemErrorText()); + Y_ABORT("failed to recv from wakeup socket: %s", LastSystemErrorText()); } continue; } @@ -354,7 +354,7 @@ TChannelPtr TEventLoop::TImpl::Register(TSocket socket, TEventHandlerPtr eventHa void TEventLoop::TImpl::Wakeup() { if (NBus::NPrivate::SocketSend(WakeupWriteSocket, TArrayRef<const char>("", 1)) < 0) { if (LastSystemError() != EAGAIN) { - Y_FAIL("failed to send to wakeup socket: %s", LastSystemErrorText()); + Y_ABORT("failed to send to wakeup socket: %s", LastSystemErrorText()); } } } @@ -367,6 +367,6 @@ void TEventLoop::TImpl::AddToPoller(SOCKET socket, void* cookie, int flags) { } else if (flags == OP_READ_WRITE) { Poller.WaitReadWriteOneShot(socket, cookie); } else { - Y_FAIL("Wrong flags: %d", int(flags)); + Y_ABORT("Wrong flags: %d", int(flags)); } } diff --git a/library/cpp/messagebus/locator.cpp b/library/cpp/messagebus/locator.cpp index e49716f166..5cc4604754 100644 --- a/library/cpp/messagebus/locator.cpp +++ b/library/cpp/messagebus/locator.cpp @@ -409,7 +409,7 @@ namespace NBus { return 0; } if ((item.Start < start && start < item.End) || (item.Start < end && end < item.End)) { - Y_FAIL("Overlap in registered keys with non-identical range"); + Y_ABORT("Overlap in registered keys with non-identical range"); } } diff --git a/library/cpp/messagebus/message.cpp b/library/cpp/messagebus/message.cpp index ac8caa5c56..8f8ff7e442 100644 --- a/library/cpp/messagebus/message.cpp +++ b/library/cpp/messagebus/message.cpp @@ -34,7 +34,7 @@ namespace NBus { if (!!Connection) { return Connection->GetAddr(); } else { - Y_FAIL(); + Y_ABORT(); } } @@ -112,7 +112,7 @@ namespace NBus { if (Y_UNLIKELY(LocalFlags != 0)) { TString describe = Describe(); TString localFlags = LocalFlagSetToString(LocalFlags); - Y_FAIL("message local flags must be zero, got: %s, message: %s", localFlags.data(), describe.data()); + Y_ABORT("message local flags must be zero, got: %s, message: %s", localFlags.data(), describe.data()); } } diff --git a/library/cpp/messagebus/message.h b/library/cpp/messagebus/message.h index 2027f24983..f7f58930c9 100644 --- a/library/cpp/messagebus/message.h +++ b/library/cpp/messagebus/message.h @@ -86,7 +86,7 @@ namespace NBus { } else if (LocalFlags == NPrivate::MESSAGE_IN_WORK && !inWork) { LocalFlags = 0; } else { - Y_FAIL("impossible combination of flag and parameter: %s %d", + Y_ABORT("impossible combination of flag and parameter: %s %d", inWork ? "true" : "false", unsigned(LocalFlags)); } } diff --git a/library/cpp/messagebus/messqueue.cpp b/library/cpp/messagebus/messqueue.cpp index 85baa3c383..789b86a15e 100644 --- a/library/cpp/messagebus/messqueue.cpp +++ b/library/cpp/messagebus/messqueue.cpp @@ -146,7 +146,7 @@ TBusServerSessionPtr TBusMessageQueue::CreateDestination(TBusProtocol* proto, IB Add(session.Get()); return session.Release(); } catch (...) { - Y_FAIL("create destination failure: %s", CurrentExceptionMessage().c_str()); + Y_ABORT("create destination failure: %s", CurrentExceptionMessage().c_str()); } } @@ -157,7 +157,7 @@ TBusServerSessionPtr TBusMessageQueue::CreateDestination(TBusProtocol* proto, IB Add(session.Get()); return session.Release(); } catch (...) { - Y_FAIL("create destination failure: %s", CurrentExceptionMessage().c_str()); + Y_ABORT("create destination failure: %s", CurrentExceptionMessage().c_str()); } } diff --git a/library/cpp/messagebus/oldmodule/module.cpp b/library/cpp/messagebus/oldmodule/module.cpp index 4ec37a4d53..7db3a9af42 100644 --- a/library/cpp/messagebus/oldmodule/module.cpp +++ b/library/cpp/messagebus/oldmodule/module.cpp @@ -390,7 +390,7 @@ namespace NBus { if (call.Status == MESSAGE_OK) { ++it; // keep pending list until we get reply } else if (call.Status == MESSAGE_BUSY) { - Y_FAIL("MESSAGE_BUSY is prohibited in modules. Please increase MaxInFlight"); + Y_ABORT("MESSAGE_BUSY is prohibited in modules. Please increase MaxInFlight"); } else if (call.Status == MESSAGE_CONNECT_FAILED && call.NumRetries < call.MaxRetries) { ++it; // try up to call.MaxRetries times to send message call.NumRetries++; @@ -480,7 +480,7 @@ namespace NBus { /// if not found, report error if (i == Pending.size()) { - Y_FAIL("must not happen"); + Y_ABORT("must not happen"); } /// fill in response into job state diff --git a/library/cpp/messagebus/protobuf/ybusbuf.cpp b/library/cpp/messagebus/protobuf/ybusbuf.cpp index 7212e59590..c6ef971172 100644 --- a/library/cpp/messagebus/protobuf/ybusbuf.cpp +++ b/library/cpp/messagebus/protobuf/ybusbuf.cpp @@ -47,7 +47,7 @@ void TBusBufferProtocol::Serialize(const TBusMessage* mess, TBuffer& data) { const TBusHeader* header = mess->GetHeader(); if (!IsRegisteredType(header->Type)) { - Y_FAIL("unknown message type: %d", int(header->Type)); + Y_ABORT("unknown message type: %d", int(header->Type)); return; } @@ -69,7 +69,7 @@ TAutoPtr<TBusMessage> TBusBufferProtocol::Deserialize(ui16 messageType, TArrayRe TBusBufferBase* messageTemplate = FindType(messageType); if (messageTemplate == nullptr) { return nullptr; - //Y_FAIL("unknown message type: %d", unsigned(messageType)); + //Y_ABORT("unknown message type: %d", unsigned(messageType)); } // clone the base diff --git a/library/cpp/messagebus/rain_check/core/task.cpp b/library/cpp/messagebus/rain_check/core/task.cpp index d8aeefac25..0d4dd198a5 100644 --- a/library/cpp/messagebus/rain_check/core/task.cpp +++ b/library/cpp/messagebus/rain_check/core/task.cpp @@ -142,7 +142,7 @@ void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) { for (;;) { ESubtaskState current = State.Get(); if (current != CREATED && current != DONE) { - Y_FAIL("current state should be CREATED or DONE: %s", ToCString(current)); + Y_ABORT("current state should be CREATED or DONE: %s", ToCString(current)); } if (State.CompareAndSet(current, RUNNING)) { return; @@ -166,7 +166,7 @@ void TSubtaskCompletion::SetDone() { break; } } else { - Y_FAIL("cannot SetDone: unknown state: %s", ToCString(state)); + Y_ABORT("cannot SetDone: unknown state: %s", ToCString(state)); } } diff --git a/library/cpp/messagebus/rain_check/core/task.h b/library/cpp/messagebus/rain_check/core/task.h index 7d8778bcda..c5fa86323a 100644 --- a/library/cpp/messagebus/rain_check/core/task.h +++ b/library/cpp/messagebus/rain_check/core/task.h @@ -99,9 +99,9 @@ namespace NRainCheck { case CANCELED: return true; case CREATED: - Y_FAIL("not started"); + Y_ABORT("not started"); default: - Y_FAIL("unknown value: %u", (unsigned)state); + Y_ABORT("unknown value: %u", (unsigned)state); } } diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp index 1628114391..747128b0b0 100644 --- a/library/cpp/messagebus/rain_check/http/client_ut.cpp +++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp @@ -74,7 +74,7 @@ namespace { const int THR_POOL_SIZE = 2; runner->ForkLoop(THR_POOL_SIZE); } catch (...) { - Y_FAIL("Can't run server: %s", CurrentExceptionMessage().data()); + Y_ABORT("Can't run server: %s", CurrentExceptionMessage().data()); } return runner; diff --git a/library/cpp/messagebus/remote_client_connection.cpp b/library/cpp/messagebus/remote_client_connection.cpp index 30a7fc25fb..2fa56f7902 100644 --- a/library/cpp/messagebus/remote_client_connection.cpp +++ b/library/cpp/messagebus/remote_client_connection.cpp @@ -252,7 +252,7 @@ void TRemoteClientConnection::ReaderProcessMessageUnknownVersion(TArrayRef<const LWPROBE(Error, ToString(MESSAGE_INVALID_VERSION), ToString(PeerAddr), ""); ReaderData.Status.Incremental.StatusCounter[MESSAGE_INVALID_VERSION] += 1; // TODO: close connection - Y_FAIL("unknown message"); + Y_ABORT("unknown message"); } void TRemoteClientConnection::ClearOutgoingQueue(TMessagesPtrs& result, bool reconnect) { diff --git a/library/cpp/messagebus/remote_connection.cpp b/library/cpp/messagebus/remote_connection.cpp index 24c2153730..0e79ca084a 100644 --- a/library/cpp/messagebus/remote_connection.cpp +++ b/library/cpp/messagebus/remote_connection.cpp @@ -143,7 +143,7 @@ namespace NBus { } void TRemoteConnection::TryConnect() { - Y_FAIL("TryConnect is client connection only operation"); + Y_ABORT("TryConnect is client connection only operation"); } void TRemoteConnection::ScheduleRead() { diff --git a/library/cpp/messagebus/scheduler_actor_ut.cpp b/library/cpp/messagebus/scheduler_actor_ut.cpp index e81ffd3186..9f52e26f0c 100644 --- a/library/cpp/messagebus/scheduler_actor_ut.cpp +++ b/library/cpp/messagebus/scheduler_actor_ut.cpp @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TSchedulerActorTests) { void Act(TDefaultTag) { if (!Alarm.FetchTask()) { - Y_FAIL("must not have no spurious wakeups in test"); + Y_ABORT("must not have no spurious wakeups in test"); } TestSync.WaitForAndIncrement(Iteration++); diff --git a/library/cpp/messagebus/socket_addr.cpp b/library/cpp/messagebus/socket_addr.cpp index c1b3a28fbe..71a1277a92 100644 --- a/library/cpp/messagebus/socket_addr.cpp +++ b/library/cpp/messagebus/socket_addr.cpp @@ -36,7 +36,7 @@ NBus::NPrivate::TBusSocketAddr::TBusSocketAddr(const NAddr::IRemoteAddr* addr) break; } default: - Y_FAIL("unknown address family"); + Y_ABORT("unknown address family"); } } diff --git a/library/cpp/messagebus/test/example/client/client.cpp b/library/cpp/messagebus/test/example/client/client.cpp index 8d0f0584e0..e707ec432f 100644 --- a/library/cpp/messagebus/test/example/client/client.cpp +++ b/library/cpp/messagebus/test/example/client/client.cpp @@ -36,7 +36,7 @@ namespace NCalculator { int b = requestMul->Record.GetB(); Cerr << a << " * " << b << " = " << response->Record.GetResult() << "\n"; } else { - Y_FAIL("unknown request"); + Y_ABORT("unknown request"); } } diff --git a/library/cpp/messagebus/test/example/server/server.cpp b/library/cpp/messagebus/test/example/server/server.cpp index 13e52d75f5..dc0cda78fa 100644 --- a/library/cpp/messagebus/test/example/server/server.cpp +++ b/library/cpp/messagebus/test/example/server/server.cpp @@ -39,7 +39,7 @@ namespace NCalculator { response->Record.SetResult(result); request.SendReplyMove(response); } else { - Y_FAIL("unknown request"); + Y_ABORT("unknown request"); } } }; diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp index 1ef2809111..80447ca1a8 100644 --- a/library/cpp/messagebus/test/helper/example.cpp +++ b/library/cpp/messagebus/test/helper/example.cpp @@ -83,7 +83,7 @@ void TExampleProtocol::Serialize(const TBusMessage* message, TBuffer& buffer) { } else if (const TExampleResponse* exampleReply = dynamic_cast<const TExampleResponse*>(message)) { buffer.Append(exampleReply->Data.data(), exampleReply->Data.size()); } else { - Y_FAIL("unknown message type"); + Y_ABORT("unknown message type"); } } @@ -204,7 +204,7 @@ void TExampleClient::OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> r void TExampleClient::OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) { if (CrashOnError) { - Y_FAIL("client failed: %s", ToCString(status)); + Y_ABORT("client failed: %s", ToCString(status)); } Y_UNUSED(mess); diff --git a/library/cpp/messagebus/test/helper/message_handler_error.cpp b/library/cpp/messagebus/test/helper/message_handler_error.cpp index c09811ec67..f22f46fa6c 100644 --- a/library/cpp/messagebus/test/helper/message_handler_error.cpp +++ b/library/cpp/messagebus/test/helper/message_handler_error.cpp @@ -6,21 +6,21 @@ using namespace NBus; using namespace NBus::NTest; void TBusClientHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus status) { - Y_FAIL("must not be called, status: %s", ToString(status).data()); + Y_ABORT("must not be called, status: %s", ToString(status).data()); } void TBusClientHandlerError::OnReply(TAutoPtr<TBusMessage>, TAutoPtr<TBusMessage>) { - Y_FAIL("must not be called"); + Y_ABORT("must not be called"); } void TBusClientHandlerError::OnMessageSentOneWay(TAutoPtr<TBusMessage>) { - Y_FAIL("must not be called"); + Y_ABORT("must not be called"); } void TBusServerHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus status) { - Y_FAIL("must not be called, status: %s", ToString(status).data()); + Y_ABORT("must not be called, status: %s", ToString(status).data()); } void TBusServerHandlerError::OnMessage(TOnMessageContext&) { - Y_FAIL("must not be called"); + Y_ABORT("must not be called"); } diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 3084c9e01c..0a681a5c4d 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -279,7 +279,7 @@ public: //delete message; //Sleep(TDuration::MilliSeconds(1)); //continue; - Y_FAIL("unreachable"); + Y_ABORT("unreachable"); } else if (ret == MESSAGE_SHUTDOWN) { delete message; } else { diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp index 8f6aa6a295..27886ad74c 100644 --- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp +++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp @@ -555,7 +555,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { TAutoPtr<TExampleResponse> resp(new TExampleResponse(&Proto.ResponseCount, 10)); req.SendReplyMove(resp); } else { - Y_FAIL("wrong"); + Y_ABORT("wrong"); } } }; diff --git a/library/cpp/messagebus/test/ut/moduletest.h b/library/cpp/messagebus/test/ut/moduletest.h index d5da72c0cb..665afbdf59 100644 --- a/library/cpp/messagebus/test/ut/moduletest.h +++ b/library/cpp/messagebus/test/ut/moduletest.h @@ -77,7 +77,7 @@ namespace NBus { } else if (messageType == TYPE_HOSTINFORESPONSE) { return new THostInfoReply(MESSAGE_CREATE_UNINITIALIZED); } else { - Y_FAIL("unknown"); + Y_ABORT("unknown"); } } }; diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp index 0b90985289..a391669b39 100644 --- a/library/cpp/messagebus/test/ut/one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp @@ -125,7 +125,7 @@ public: /// this handler should not be called because this server does not send replies void OnSent(TAutoPtr<TBusMessage> mess) override { Y_UNUSED(mess); - Y_FAIL("This server does not sent replies"); + Y_ABORT("This server does not sent replies"); } }; diff --git a/library/cpp/messagebus/test/ut/starter_ut.cpp b/library/cpp/messagebus/test/ut/starter_ut.cpp index dd4d3aaa5e..548e83ae5a 100644 --- a/library/cpp/messagebus/test/ut/starter_ut.cpp +++ b/library/cpp/messagebus/test/ut/starter_ut.cpp @@ -89,7 +89,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } TJobHandler Never(TBusJob*, TBusMessage*) { - Y_FAIL("happens"); + Y_ABORT("happens"); throw 1; } }; diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index a52ad404ff..9c3e0f522d 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -57,7 +57,7 @@ namespace { } } - Y_FAIL("unregistered"); + Y_ABORT("unregistered"); } void Add(TValuePtr p) { |