From faf89cd37ce810334923927d0c416b9db112f94e Mon Sep 17 00:00:00 2001 From: vagkaratzas Date: Tue, 3 Mar 2026 16:15:53 +0000 Subject: [PATCH] bot attempt to figure the bug, based on reproducible example --- .../nextflow/processor/TaskProcessor.groovy | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy b/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy index fc16c0c0a8..fef96d8cbb 100644 --- a/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy @@ -796,7 +796,7 @@ class TaskProcessor { @CompileStatic final protected void checkCachedOrLaunchTask( TaskRun task, HashCode hash, boolean shouldTryCache ) { - int tries = task.failCount +1 + int tries = 1 while( true ) { hash = HashBuilder.defaultHasher().putBytes(hash.asBytes()).putInt(tries).hash() @@ -1050,8 +1050,13 @@ class TaskProcessor { final taskCopy = task.makeCopy() session.getExecService().submit { try { + // Compute the base hash with attempt=1 so the hash chain is consistent + // with what checkCachedOrLaunchTask produces on -resume (which always + // starts from a fresh task with attempt=1). + taskCopy.config.attempt = 1 + final retryHash = new TaskHasher(taskCopy).compute() taskCopy.runType = RunType.RETRY - checkCachedOrLaunchTask( taskCopy, taskCopy.hash, false ) + checkCachedOrLaunchTask( taskCopy, retryHash, false ) } catch( Throwable e ) { log.error("Unable to re-submit task `${taskCopy.name}`", e) @@ -1170,11 +1175,17 @@ class TaskProcessor { final taskCopy = task.makeCopy() session.getExecService().submit({ try { + // Compute the base hash with attempt=1 so the hash chain is consistent + // with what checkCachedOrLaunchTask produces on -resume (which always + // starts from a fresh task with attempt=1). This must happen before + // taskCopy.config.attempt is bumped to the retry attempt number. + taskCopy.config.attempt = 1 + final retryHash = new TaskHasher(taskCopy).compute() taskCopy.config.attempt = taskErrCount+1 taskCopy.config.submitAttempt = submitRetries+1 taskCopy.runType = RunType.RETRY taskCopy.resolve(taskBody) - checkCachedOrLaunchTask( taskCopy, taskCopy.hash, false ) + checkCachedOrLaunchTask( taskCopy, retryHash, false ) } catch( Throwable e ) { log.error("Unable to re-submit task `${safeTaskName(taskCopy)}`", e)