diff --git a/src/xrpld/app/ledger/detail/InboundLedger.cpp b/src/xrpld/app/ledger/detail/InboundLedger.cpp index 1b6fb51fc68..9f6a0e35487 100644 --- a/src/xrpld/app/ledger/detail/InboundLedger.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedger.cpp @@ -107,7 +107,7 @@ InboundLedger::init(ScopedLockType& collectionLock) JLOG(journal_.debug()) << "TimeoutCounter lock2 " << this; ScopedLockType sl(mtx_); collectionLock.unlock(); - + JLOG(journal_.debug()) << "InboundLedgers InboundLedger::init unlock"; tryDB(app_.getNodeFamily().db()); if (failed_) { diff --git a/src/xrpld/app/ledger/detail/InboundLedgers.cpp b/src/xrpld/app/ledger/detail/InboundLedgers.cpp index 1e0dbba6e90..0445f3f8d91 100644 --- a/src/xrpld/app/ledger/detail/InboundLedgers.cpp +++ b/src/xrpld/app/ledger/detail/InboundLedgers.cpp @@ -84,11 +84,13 @@ class InboundLedgersImp : public InboundLedgers std::shared_ptr inbound; { JLOG(j_.debug()) << "InboundLedgers::acquire3 " << this; + JLOG(j_.debug()) << "InboundLedgers lock1"; ScopedLockType sl(mLock); JLOG(j_.debug()) << "InboundLedgers::acquire4 " << this; if (stopping_) { JLOG(j_.debug()) << "InboundLedgers::acquire5 " << this; + JLOG(j_.debug()) << "InboundLedgers unlock1-1"; return {}; } @@ -116,6 +118,7 @@ class InboundLedgersImp : public InboundLedgers if (inbound->isFailed()) { JLOG(j_.debug()) << "InboundLedgers::acquire6 " << this; + JLOG(j_.debug()) << "InboundLedgers unlock1-2 but I think init already unlocked"; return {}; } @@ -127,10 +130,12 @@ class InboundLedgersImp : public InboundLedgers if (!inbound->isComplete()) { JLOG(j_.debug()) << "InboundLedgers::acquire7 " << this; + JLOG(j_.debug()) << "InboundLedgers unlock1-3 but I think init already unlocked"; return {}; } JLOG(j_.debug()) << "InboundLedgers::acquire8 " << this; + JLOG(j_.debug()) << "InboundLedgers unlock1-4 but I think init already unlocked"; return inbound->getLedger(); } @@ -142,6 +147,7 @@ class InboundLedgersImp : public InboundLedgers std::shared_ptr ret; { + JLOG(j_.debug()) << "InboundLedgers lock2"; ScopedLockType sl(mLock); auto it = mLedgers.find(hash); @@ -150,6 +156,7 @@ class InboundLedgersImp : public InboundLedgers ret = it->second; } } + JLOG(j_.debug()) << "InboundLedgers unlock2"; return ret; } @@ -213,18 +220,26 @@ class InboundLedgersImp : public InboundLedgers void logFailure(uint256 const& h, std::uint32_t seq) override { + JLOG(j_.debug()) << "InboundLedgers lock3"; ScopedLockType sl(mLock); mRecentFailures.emplace(h, seq); + JLOG(j_.debug()) << "InboundLedgers unlock3"; } bool isFailure(uint256 const& h) override { - ScopedLockType sl(mLock); + bool ret; + JLOG(j_.debug()) << "InboundLedgers lock4"; + { + ScopedLockType sl(mLock); - beast::expire(mRecentFailures, kReacquireInterval); - return mRecentFailures.find(h) != mRecentFailures.end(); + beast::expire(mRecentFailures, kReacquireInterval); + ret = mRecentFailures.find(h) != mRecentFailures.end(); + } + JLOG(j_.debug()) << "InboundLedgers unlock4"; + return ret; } /** We got some data for a ledger we are no longer acquiring Since we paid @@ -268,10 +283,12 @@ class InboundLedgersImp : public InboundLedgers void clearFailures() override { + JLOG(j_.debug()) << "InboundLedgers lock5"; ScopedLockType sl(mLock); mRecentFailures.clear(); mLedgers.clear(); + JLOG(j_.debug()) << "InboundLedgers unlock5"; } std::size_t @@ -298,6 +315,7 @@ class InboundLedgersImp : public InboundLedgers std::vector>> acqs; { + JLOG(j_.debug()) << "InboundLedgers lock6"; ScopedLockType sl(mLock); acqs.reserve(mLedgers.size()); @@ -314,6 +332,7 @@ class InboundLedgersImp : public InboundLedgers ret[to_string(it.first)][jss::failed] = true; } } + JLOG(j_.debug()) << "InboundLedgers unlock6"; for (auto const& it : acqs) { @@ -333,6 +352,7 @@ class InboundLedgersImp : public InboundLedgers { std::vector> acquires; { + JLOG(j_.debug()) << "InboundLedgers lock7"; ScopedLockType sl(mLock); acquires.reserve(mLedgers.size()); @@ -342,6 +362,7 @@ class InboundLedgersImp : public InboundLedgers acquires.push_back(it.second); } } + JLOG(j_.debug()) << "InboundLedgers lock7"; for (auto const& acquire : acquires) { @@ -359,6 +380,7 @@ class InboundLedgersImp : public InboundLedgers std::size_t total; { + JLOG(j_.debug()) << "InboundLedgers lock8"; ScopedLockType sl(mLock); MapType::iterator it(mLedgers.begin()); total = mLedgers.size(); @@ -389,6 +411,7 @@ class InboundLedgersImp : public InboundLedgers beast::expire(mRecentFailures, kReacquireInterval); } + JLOG(j_.debug()) << "InboundLedgers unlock8"; JLOG(j_.debug()) << "Swept " << stuffToSweep.size() << " out of " << total @@ -402,17 +425,25 @@ class InboundLedgersImp : public InboundLedgers void stop() override { + JLOG(j_.debug()) << "InboundLedgers lock9"; ScopedLockType lock(mLock); stopping_ = true; mLedgers.clear(); mRecentFailures.clear(); + JLOG(j_.debug()) << "InboundLedgers unlock9"; } std::size_t cacheSize() override { - ScopedLockType lock(mLock); - return mLedgers.size(); + std::size_t ret; + JLOG(j_.debug()) << "InboundLedgers lock10"; + { + ScopedLockType lock(mLock); + ret = mLedgers.size(); + } + JLOG(j_.debug()) << "InboundLedgers unlock10"; + return ret; } private: