mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Prevent low-likelihood crash on shutdown (RIPD-1392):
The DatabaseImp has threads that asynchronously call JobQueue to perform database reads. Formerly these threads had the same lifespan as Database, which was until the end-of-life of ApplicationImp. During shutdown these threads could call JobQueue after JobQueue had already stopped. Or, even worse, occasionally call JobQueue after JobQueue's destructor had run. To avoid these shutdown conditions, Database is made a Stoppable, with JobQueue as its parent. When Database stops, it shuts down its asynchronous read threads. This prevents Database from accessing JobQueue after JobQueue has stopped, but allows Database to perform stores for the remainder of shutdown. During development it was noted that the Database::close() method was never called. So that method is removed from Database and all derived classes. Stoppable is also adjusted so it can be constructed using either a char const* or a std::string. For those files touched for other reasons, unneeded #includes are removed.
This commit is contained in:
@@ -22,19 +22,12 @@
|
||||
|
||||
#include <ripple/basics/LocalValue.h>
|
||||
#include <ripple/basics/win32_workaround.h>
|
||||
#include <ripple/core/Job.h>
|
||||
#include <ripple/core/JobTypes.h>
|
||||
#include <ripple/core/JobTypeData.h>
|
||||
#include <ripple/core/Stoppable.h>
|
||||
#include <ripple/core/impl/Workers.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/beast/insight/Collector.h>
|
||||
#include <ripple/core/Stoppable.h>
|
||||
#include <boost/coroutine/all.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user