diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index ca586a3af6..1c4a3a7407 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -3488,10 +3488,20 @@ void controller::validate_db_available_size() const { const auto guard = my->conf.state_guard_size; EOS_ASSERT(free >= guard, database_guard_exception, "database free: ${f}, guard size: ${g}", ("f", free)("g",guard)); - // give a change to chainbase to write some pages to disk if memory becomes scarce. + // give chainbase a chance to flush its private pages to disk if memory becomes scarce. if (is_write_window()) { - if (auto flushed_pages = mutable_db().check_memory_and_flush_if_needed()) { - ilog("CHAINBASE: flushed ${p} pages to disk to decrease memory pressure", ("p", flushed_pages)); + auto check_time = fc::time_point::now(); + if (auto res = mutable_db().check_memory_and_flush_if_needed()) { + if (res->num_pages_written > 0) { + auto duration = (fc::time_point::now() - check_time).count()/1000; // in milliseconds + wlog("chainbase: oom = ${oom_prev}, flushed ${p} state pages to disk (in ${dur} ms) to decrease memory pressure", + ("oom_prev", res->oom_score_before)("p", res->num_pages_written)("dur", duration)); + wlog("chainbase: oom score after flush: ${oom_post}", ("oom_post", res->oom_score_after)); + wlog("chainbase: The system is running low in memory for running nodeos. " + "If this is not a temporary condition, consider increasing the available RAM"); + } else { + ilog("chainbase: oom_score = ${oom_prev} within acceptable range, no action taken", ("oom_prev", res->oom_score_before)); + } } } } diff --git a/libraries/chainbase b/libraries/chainbase index 3bfb0d00b6..580a743720 160000 --- a/libraries/chainbase +++ b/libraries/chainbase @@ -1 +1 @@ -Subproject commit 3bfb0d00b61087bff804c622ffa5929fec2fa4ed +Subproject commit 580a743720a82cccbeb04fc84da9b270978d0609