Skip to content

Commit df8761d

Browse files
committed
Merge branch 'develop' into vault
2 parents 7b5680f + c0299db commit df8761d

File tree

6 files changed

+49
-46
lines changed

6 files changed

+49
-46
lines changed

cfg/rippled-example.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@
420420
# - r.ripple.com 51235
421421
# - sahyadri.isrdc.in 51235
422422
# - hubs.xrpkuwait.com 51235
423+
# - hub.xrpl-commons.org 51235
423424
#
424425
# Examples:
425426
#

src/xrpld/app/main/Application.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,10 +1555,10 @@ ApplicationImp::run()
15551555
if (!config_->standalone())
15561556
{
15571557
// VFALCO NOTE This seems unnecessary. If we properly refactor the load
1558-
// manager then the deadlock detector can just always be
1558+
// manager then the stall detector can just always be
15591559
// "armed"
15601560
//
1561-
getLoadManager().activateDeadlockDetector();
1561+
getLoadManager().activateStallDetector();
15621562
}
15631563

15641564
{

src/xrpld/app/main/LoadManager.cpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
namespace ripple {
3333

3434
LoadManager::LoadManager(Application& app, beast::Journal journal)
35-
: app_(app), journal_(journal), deadLock_(), armed_(false)
35+
: app_(app), journal_(journal), lastHeartbeat_(), armed_(false)
3636
{
3737
}
3838

@@ -53,19 +53,19 @@ LoadManager::~LoadManager()
5353
//------------------------------------------------------------------------------
5454

5555
void
56-
LoadManager::activateDeadlockDetector()
56+
LoadManager::activateStallDetector()
5757
{
5858
std::lock_guard sl(mutex_);
5959
armed_ = true;
60-
deadLock_ = std::chrono::steady_clock::now();
60+
lastHeartbeat_ = std::chrono::steady_clock::now();
6161
}
6262

6363
void
64-
LoadManager::resetDeadlockDetector()
64+
LoadManager::heartbeat()
6565
{
66-
auto const detector_start = std::chrono::steady_clock::now();
66+
auto const heartbeat = std::chrono::steady_clock::now();
6767
std::lock_guard sl(mutex_);
68-
deadLock_ = detector_start;
68+
lastHeartbeat_ = heartbeat;
6969
}
7070

7171
//------------------------------------------------------------------------------
@@ -118,63 +118,62 @@ LoadManager::run()
118118
break;
119119

120120
// Copy out shared data under a lock. Use copies outside lock.
121-
auto const deadLock = deadLock_;
121+
auto const lastHeartbeat = lastHeartbeat_;
122122
auto const armed = armed_;
123123
sl.unlock();
124124

125-
// Measure the amount of time we have been deadlocked, in seconds.
125+
// Measure the amount of time we have been stalled, in seconds.
126126
using namespace std::chrono;
127-
auto const timeSpentDeadlocked =
128-
duration_cast<seconds>(steady_clock::now() - deadLock);
127+
auto const timeSpentStalled =
128+
duration_cast<seconds>(steady_clock::now() - lastHeartbeat);
129129

130130
constexpr auto reportingIntervalSeconds = 10s;
131-
constexpr auto deadlockFatalLogMessageTimeLimit = 90s;
132-
constexpr auto deadlockLogicErrorTimeLimit = 600s;
131+
constexpr auto stallFatalLogMessageTimeLimit = 90s;
132+
constexpr auto stallLogicErrorTimeLimit = 600s;
133133

134-
if (armed && (timeSpentDeadlocked >= reportingIntervalSeconds))
134+
if (armed && (timeSpentStalled >= reportingIntervalSeconds))
135135
{
136-
// Report the deadlocked condition every
137-
// reportingIntervalSeconds
138-
if ((timeSpentDeadlocked % reportingIntervalSeconds) == 0s)
136+
// Report the stalled condition every reportingIntervalSeconds
137+
if ((timeSpentStalled % reportingIntervalSeconds) == 0s)
139138
{
140-
if (timeSpentDeadlocked < deadlockFatalLogMessageTimeLimit)
139+
if (timeSpentStalled < stallFatalLogMessageTimeLimit)
141140
{
142141
JLOG(journal_.warn())
143-
<< "Server stalled for " << timeSpentDeadlocked.count()
142+
<< "Server stalled for " << timeSpentStalled.count()
144143
<< " seconds.";
144+
145145
if (app_.getJobQueue().isOverloaded())
146146
{
147-
JLOG(journal_.warn()) << app_.getJobQueue().getJson(0);
147+
JLOG(journal_.warn())
148+
<< "JobQueue: " << app_.getJobQueue().getJson(0);
148149
}
149150
}
150151
else
151152
{
152153
JLOG(journal_.fatal())
153-
<< "Deadlock detected. Deadlocked time: "
154-
<< timeSpentDeadlocked.count() << "s";
154+
<< "Server stalled for " << timeSpentStalled.count()
155+
<< " seconds.";
155156
JLOG(journal_.fatal())
156157
<< "JobQueue: " << app_.getJobQueue().getJson(0);
157158
}
158159
}
159160

160-
// If we go over the deadlockTimeLimit spent deadlocked, it
161-
// means that the deadlock resolution code has failed, which
162-
// qualifies as undefined behavior.
163-
//
164-
if (timeSpentDeadlocked >= deadlockLogicErrorTimeLimit)
161+
// If we go over the stallLogicErrorTimeLimit spent stalled, it
162+
// means that the stall resolution code has failed, which qualifies
163+
// as a LogicError
164+
if (timeSpentStalled >= stallLogicErrorTimeLimit)
165165
{
166166
JLOG(journal_.fatal())
167-
<< "LogicError: Deadlock detected. Deadlocked time: "
168-
<< timeSpentDeadlocked.count() << "s";
167+
<< "LogicError: Fatal server stall detected. Stalled time: "
168+
<< timeSpentStalled.count() << "s";
169169
JLOG(journal_.fatal())
170170
<< "JobQueue: " << app_.getJobQueue().getJson(0);
171-
LogicError("Deadlock detected");
171+
LogicError("Fatal server stall detected");
172172
}
173173
}
174174
}
175175

176-
bool change;
177-
176+
bool change = false;
178177
if (app_.getJobQueue().isOverloaded())
179178
{
180179
JLOG(journal_.info()) << "Raising local fee (JQ overload): "

src/xrpld/app/main/LoadManager.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,28 @@ class LoadManager
5858
*/
5959
~LoadManager();
6060

61-
/** Turn on deadlock detection.
61+
/** Turn on stall detection.
6262
63-
The deadlock detector begins in a disabled state. After this function
64-
is called, it will report deadlocks using a separate thread whenever
63+
The stall detector begins in a disabled state. After this function
64+
is called, it will report stalls using a separate thread whenever
6565
the reset function is not called at least once per 10 seconds.
6666
67-
@see resetDeadlockDetector
67+
@see resetStallDetector
6868
*/
69-
// VFALCO NOTE it seems that the deadlock detector has an "armed" state
69+
// VFALCO NOTE it seems that the stall detector has an "armed" state
7070
// to prevent it from going off during program startup if
7171
// there's a lengthy initialization operation taking place?
7272
//
7373
void
74-
activateDeadlockDetector();
74+
activateStallDetector();
7575

76-
/** Reset the deadlock detection timer.
76+
/** Reset the stall detection timer.
7777
78-
A dedicated thread monitors the deadlock timer, and if too much
78+
A dedicated thread monitors the stall timer, and if too much
7979
time passes it will produce log warnings.
8080
*/
8181
void
82-
resetDeadlockDetector();
82+
heartbeat();
8383

8484
//--------------------------------------------------------------------------
8585

@@ -98,12 +98,12 @@ class LoadManager
9898
beast::Journal const journal_;
9999

100100
std::thread thread_;
101-
std::mutex mutex_; // Guards deadLock_, armed_, cv_
101+
std::mutex mutex_; // Guards lastHeartbeat_, armed_, cv_
102102
std::condition_variable cv_;
103103
bool stop_ = false;
104104

105-
std::chrono::steady_clock::time_point
106-
deadLock_; // Detect server deadlocks.
105+
// Detect server stalls
106+
std::chrono::steady_clock::time_point lastHeartbeat_;
107107
bool armed_;
108108

109109
friend std::unique_ptr<LoadManager>

src/xrpld/app/misc/NetworkOPs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ NetworkOPsImp::processHeartbeatTimer()
10151015

10161016
// VFALCO NOTE This is for diagnosing a crash on exit
10171017
LoadManager& mgr(app_.getLoadManager());
1018-
mgr.resetDeadlockDetector();
1018+
mgr.heartbeat();
10191019

10201020
std::size_t const numPeers = app_.overlay().size();
10211021

src/xrpld/overlay/detail/OverlayImpl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ OverlayImpl::start()
503503

504504
// Pool of servers operated by @Xrpkuwait - https://xrpkuwait.com
505505
bootstrapIps.push_back("hubs.xrpkuwait.com 51235");
506+
507+
// Pool of servers operated by XRPL Commons - https://xrpl-commons.org
508+
bootstrapIps.push_back("hub.xrpl-commons.org 51235");
506509
}
507510

508511
m_resolver.resolve(

0 commit comments

Comments
 (0)