Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RPC Webhook queue dropping #5163

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/xrpld/net/detail/RPCCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -1623,7 +1626,7 @@ fromNetwork(
std::placeholders::_2,
j),
RPC_REPLY_MAX_BYTES,
RPC_NOTIFY,
RPC_WEBHOOK_TIMEOUT,
std::bind(
&RPCCallImp::onResponse,
callbackFuncP,
Expand Down
22 changes: 15 additions & 7 deletions src/xrpld/net/detail/RPCSub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading