Skip to content

Commit 70fd689

Browse files
committed
work around blob quarantine infinite loop
1 parent bd6d2fa commit 70fd689

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

beacon_chain/consensus_object_pools/blob_quarantine.nim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,21 @@ 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()
253259

260+
# There are only 128 columns.
261+
inc retries
262+
if retries > 150:
263+
break
264+
254265
var res: seq[ref A]
255266
for index in 0 ..< len(record[].sidecars):
256267
if record[].sidecars[index].kind == SidecarHolderKind.Loaded:

0 commit comments

Comments
 (0)