From 45735addba3d67d8dbf6e243dd9f16ffa8199e2e Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Tue, 2 Apr 2024 09:49:57 +0100 Subject: [PATCH] Update comment and improve error reporting Signed-off-by: Gavin Halliday --- system/jhtree/jhtree.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/system/jhtree/jhtree.cpp b/system/jhtree/jhtree.cpp index b74ea9d286e..e98840bda02 100644 --- a/system/jhtree/jhtree.cpp +++ b/system/jhtree/jhtree.cpp @@ -690,7 +690,7 @@ class CNodeMapping : public HTMapping }; typedef OwningSimpleHashTableOf CNodeTable; -class CNodeMRUCache : public CMRUCacheOf +class CNodeMRUCache final : public CMRUCacheOf { std::atomic sizeInMem{0}; size32_t memLimit = 0; @@ -706,10 +706,13 @@ class CNodeMRUCache : public CMRUCacheOfprev; if (!tail) - return; // no pages in the cache are ready - this should never happen because full() should be false + { + // no pages in the cache are ready - this could possibly happen in a tiny race-window where + // sizes in the cache have been updated, but no nodes have yet been associated with the entries. + return; + } } mruList.remove(tail);