From 15a786344db52e9627208b5182f541e9ad68ede9 Mon Sep 17 00:00:00 2001 From: Wietse Wind Date: Thu, 24 Oct 2024 08:37:04 +0200 Subject: [PATCH] Fix RPC Webhook queue dropping --- src/xrpld/net/detail/RPCCall.cpp | 7 +++++-- src/xrpld/net/detail/RPCSub.cpp | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/xrpld/net/detail/RPCCall.cpp b/src/xrpld/net/detail/RPCCall.cpp index 997d6463f23..bde026e20d7 100644 --- a/src/xrpld/net/detail/RPCCall.cpp +++ b/src/xrpld/net/detail/RPCCall.cpp @@ -1606,7 +1606,10 @@ fromNetwork( constexpr auto RPC_REPLY_MAX_BYTES = megabytes(256); using namespace std::chrono_literals; - auto constexpr RPC_NOTIFY = 10min; + // Wietse: used to be 10m, but which backend + // ever requires 10 minutes to respond? + // Lower = prevent stacking pending calls + auto constexpr RPC_WEBHOOK_TIMEOUT = 30s; HTTPClient::request( bSSL, @@ -1623,7 +1626,7 @@ fromNetwork( std::placeholders::_2, j), RPC_REPLY_MAX_BYTES, - RPC_NOTIFY, + RPC_WEBHOOK_TIMEOUT, std::bind( &RPCCallImp::onResponse, callbackFuncP, diff --git a/src/xrpld/net/detail/RPCSub.cpp b/src/xrpld/net/detail/RPCSub.cpp index 13bdf9119b4..42c1a6fb9d5 100644 --- a/src/xrpld/net/detail/RPCSub.cpp +++ b/src/xrpld/net/detail/RPCSub.cpp @@ -78,12 +78,16 @@ class RPCSubImp : public RPCSub { std::lock_guard sl(mLock); - if (mDeque.size() >= eventQueueMax) - { - // Drop the previous event. - JLOG(j_.warn()) << "RPCCall::fromNetwork drop"; - mDeque.pop_back(); - } + // Wietse: we're not going to limit this, this is admin-port only, scale + // accordingly Dropping events just like this results in inconsistent + // data on the receiving end if (mDeque.size() >= eventQueueMax) + // -- this is guarded by 'context.role != Role::ADMIN' @ subscribe.cpp + // if (mDeque.size() >= eventQueueMax) + // { + // // Drop the previous event. + // JLOG(j_.warn()) << "RPCCall::fromNetwork drop"; + // mDeque.pop_back(); + // } auto jm = broadcast ? j_.debug() : j_.info(); JLOG(jm) << "RPCCall::fromNetwork push: " << jvObj; @@ -182,7 +186,11 @@ class RPCSubImp : public RPCSub } private: - enum { eventQueueMax = 32 }; + // Wietse: we're not going to limit this, this is admin-port only, scale + // accordingly Dropping events just like this results in inconsistent + // data on the receiving end if (mDeque.size() >= eventQueueMax) + // -- this is guarded by 'context.role != Role::ADMIN' @ subscribe.cpp + // enum { eventQueueMax = 32 }; boost::asio::io_service& m_io_service; JobQueue& m_jobQueue;