Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
With the present code a finished run with run["cores"]>0 will
never be evicted from the cache. This is not a legal
condition but it happened in the past because of race conditions.

This explains why official-stockfish#2030 seemed to create more unvalidated runs.
The illegal runs become more and more likely to be selected for
validation as they are not evicted and eventually dominate the
cache.
  • Loading branch information
vdbergh committed Jun 1, 2024
1 parent a217f3f commit d2b0f56
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,11 @@ def flush_buffers(self):
if self.scavenge(run):
with self.run_cache_write_lock:
self.runs.replace_one({"_id": run["_id"]}, run)
if (
run["cores"] <= 0
and cache_entry["last_access_time"] < now - 300
):
# Presently run["finished"] implies run["cores"]==0 but
# this was not always true in the past.
if (run["cores"] <= 0 or run["finished"]) and cache_entry[
"last_access_time"
] < now - 300:
del self.run_cache[r_id]
elif cache_entry["last_sync_time"] < old:
old = cache_entry["last_sync_time"]
Expand Down

0 comments on commit d2b0f56

Please sign in to comment.