From 74a2a52d1590c05270f92bfb0b85d77541751eda Mon Sep 17 00:00:00 2001 From: Jorropo Date: Fri, 3 Feb 2023 11:48:31 +0100 Subject: [PATCH] rapide: fix: make unexpected blocks a retriable error In 719b5e64af256916c4b5a275e93e63ca455a34c0 I changed `download.expand` to release the node lock before returning. This allows other workers to access the just expanded node while we walk up the chain ancestry. This mean that when we relock the node later to add it to our list of tasks, someone else may have downloaded some of the blocks already and thus they are not in the childrens slice and thus we wont add them to our list. This also solve the case where you give a Traversal that is not supported by the underlying protocol, in that case we want to kill the current download and retry deeper, while previously we would hard error on this and kill the worker. --- rapide/serverdriven.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rapide/serverdriven.go b/rapide/serverdriven.go index 7186017a6..1b7a4e864 100644 --- a/rapide/serverdriven.go +++ b/rapide/serverdriven.go @@ -53,7 +53,7 @@ func (w *serverDrivenWorker) work(ctx context.Context) { err := w.doOneDownload(ctx, workCid, traversal) switch err { - case nil, io.EOF, errGotDoneBlock: + case nil, io.EOF, errGotDoneBlock, errGotUnexpectedBlock: w.resetCurrentChildsNodeWorkState() continue default: