Skip to content

Commit 8c1c018

Browse files
committed
work around blob quarantine infinite loop
1 parent bd6d2fa commit 8c1c018

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

beacon_chain/consensus_object_pools/blob_quarantine.nim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,18 @@ proc unloadRoot[A, B](quarantine: var SidecarQuarantine[A, B]) =
247247

248248
let blockRoot = quarantine.getOldestInMemoryRoot()
249249

250+
# There's some condition whereby `quarantine.roots` becomes desynced with
251+
# `quarantine.diskUsage`, such that `removeRoot` functions as a no-op and
252+
# the `fitsOnDisk/pruneOnDiskRoot` becomes an infinite loop. Pending some
253+
# more principled/correct approach, kludge around this.
254+
var retries = 0
255+
250256
quarantine.roots.withValue(blockRoot, record):
251257
while not(quarantine.fitsOnDisk(record[].count)):
252258
quarantine.pruneOnDiskRoot()
259+
inc retries
260+
if retries > 10:
261+
break
253262

254263
var res: seq[ref A]
255264
for index in 0 ..< len(record[].sidecars):

0 commit comments

Comments
 (0)