You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tasks stuck in PENDING — Nextflow abandons tasks before spawn instance boots #12
Nextflow tasks dispatched via nf-spawn get stuck in PENDING state and Nextflow exits without running them. The spawn instance launches successfully (visible in spawn list) but Nextflow's task polling monitor times out before --wait-for-ssh completes.
Log evidence
[Task submitter] INFO io.nextflow.spawn.SpawnTaskHandler - Submitting task 'FETCH_FASTQ (1)' to spawn instance 'nf-xxx' (t4g.medium in us-east-1)
[Task monitor] DEBUG n.processor.TaskPollingMonitor - !! executor spawn > No more task to compute -- The following nodes are still active:
[operator] map
[operator] collectFile
[operator] subscribe
WorkflowStats[succeededCount=0; failedCount=0; pendingCount=2; submittedCount=0; runningCount=0]
The instance appears in spawn list as running but Nextflow never marks it as running or complete.
Root cause
SpawnTaskHandler.submit() calls spawn launch --wait-for-ssh which blocks until the instance is SSH-ready (~1-2 min). Nextflow's task polling monitor has a shorter effective timeout and gives up before --wait-for-ssh returns.
Possible fixes
Run spawn launch with --wait-for-running (faster) instead of --wait-for-ssh
Make the SSH wait timeout configurable via ext.sshTimeout or similar
Run spawn launch asynchronously and poll the instance state separately
Traced this through both nf-spawn and spawn. The stated root cause doesn't match the code — and there are two real bugs underneath the symptom.
The reported cause is already addressed
The issue says SpawnTaskHandler.submit() calls spawn launch --wait-for-ssh and blocks ~1-2 min. But both current mainand the v0.2.0 tag this was filed against already launch with:
So spawn bakes the literal string /tmp/nf-spawn-nf-xxx-….sh into the instance's user-data instead of the script contents. The task body is never executed on the instance.
Fix: prefix with @ ('--user-data', '@' + scriptFile.toString()) or use the dedicated --user-data-file flag, which reads the file unconditionally (launch.go:1928).
Real bug B — no output staging back to task.workDir (the actual PENDING cause)
There is no copy-back logic anywhere in nf-spawn — no scp, no S3 download, no .exitcode / .command.out / .command.err handling (grep is empty). buildTaskScript() runs the script in a remote working dir and only writes a SPAWN_COMPLETE marker.
But Nextflow finalizes a task by reading .exitcode plus the declared output files in task.workDir (the local/shared work directory). Those files never materialize there, so the task can't bind its outputs. Its consumers therefore never become runnable and sit in PENDING — which is exactly the log:
No more task to compute -- The following nodes are still active: [operator] map / collectFile / subscribe
pendingCount=2; submittedCount=0
FETCH_FASTQ (1)was submitted (per the log); the two stuck tasks are its downstream consumers, blocked because FETCH_FASTQ produced no retrievable outputs.
Fix (design decision needed): stage results back to task.workDir. Options:
Have buildTaskScript() write .exitcode and the declared outputs to a shared filesystem mounted at task.workDir (the cleanest path if work dir is an S3/EFS mount both sides see).
Or scp the work dir back from the instance before it self-terminates — but note --on-complete terminate means we must copy back before termination, and spawn status can't reach a terminated instance to do it afterward.
Suggested issue updates
Correct the root-cause section (the --wait-for-ssh analysis is stale).
Split into two: (A) --user-data@-prefix one-liner fix; (B) output staging, which is the substantive design item and the real reason tasks hang in PENDING.
Bug A is a trivial fix; bug B is the blocker. Happy to take both once the staging approach (shared FS vs scp-before-terminate) is decided.
Closing in favor of two focused issues. The root cause described here (submit() blocking on spawn launch --wait-for-ssh) is stale — both main and the v0.2.0 tag already launch with --wait-for-running=false --wait-for-ssh=false, so that's not it.
No output staging back to task.workDir → tasks never bind outputs, downstream stays PENDING #14 — no output staging back to task.workDir.This is the likely culprit for the PENDING symptom reported here: results/.exitcode are never returned to the dir Nextflow reads, so outputs never bind and downstream tasks stay PENDING (No more task to compute… nodes still active). Substantive — needs a staging design decision (shared FS vs scp-before-terminate).
#13 must land first (script has to actually run) before #14's staging can be validated end-to-end. Tracking the fix in those two.
Activity
scttfrdmn commentedon Jun 3, 2026
Traced this through both nf-spawn and spawn. The stated root cause doesn't match the code — and there are two real bugs underneath the symptom.
The reported cause is already addressed
The issue says
SpawnTaskHandler.submit()callsspawn launch --wait-for-sshand blocks ~1-2 min. But both currentmainand thev0.2.0tag this was filed against already launch with:(
SpawnTaskHandler.groovy:57-58)So
submit()does not block on SSH — "possible fix #1" is already in place. The PENDING hang has a different cause.Real bug A —
--user-datais passed as a bare path, so the task script never runsThe handler writes the task script to a temp file and passes it as:
But spawn's
--user-dataflag means "@fileor inline". A value without a leading@is treated as inline user-data:So spawn bakes the literal string
/tmp/nf-spawn-nf-xxx-….shinto the instance's user-data instead of the script contents. The task body is never executed on the instance.Fix: prefix with
@('--user-data', '@' + scriptFile.toString()) or use the dedicated--user-data-fileflag, which reads the file unconditionally (launch.go:1928).Real bug B — no output staging back to
task.workDir(the actual PENDING cause)There is no copy-back logic anywhere in nf-spawn — no scp, no S3 download, no
.exitcode/.command.out/.command.errhandling (grep is empty).buildTaskScript()runs the script in a remote working dir and only writes aSPAWN_COMPLETEmarker.But Nextflow finalizes a task by reading
.exitcodeplus the declared output files intask.workDir(the local/shared work directory). Those files never materialize there, so the task can't bind its outputs. Its consumers therefore never become runnable and sit in PENDING — which is exactly the log:FETCH_FASTQ (1)was submitted (per the log); the two stuck tasks are its downstream consumers, blocked because FETCH_FASTQ produced no retrievable outputs.Fix (design decision needed): stage results back to
task.workDir. Options:buildTaskScript()write.exitcodeand the declared outputs to a shared filesystem mounted attask.workDir(the cleanest path if work dir is an S3/EFS mount both sides see).--on-complete terminatemeans we must copy back before termination, andspawn statuscan't reach a terminated instance to do it afterward.Suggested issue updates
--wait-for-sshanalysis is stale).--user-data@-prefix one-liner fix; (B) output staging, which is the substantive design item and the real reason tasks hang in PENDING.Bug A is a trivial fix; bug B is the blocker. Happy to take both once the staging approach (shared FS vs scp-before-terminate) is decided.
scttfrdmn commentedon Jun 3, 2026
Closing in favor of two focused issues. The root cause described here (
submit()blocking onspawn launch --wait-for-ssh) is stale — bothmainand thev0.2.0tag already launch with--wait-for-running=false --wait-for-ssh=false, so that's not it.The real causes, split out:
--user-datapassed as a bare path. spawn treats a non-@value as inline user-data, so the literal temp-file path gets baked in and the task script never runs on the instance. Trivial fix.task.workDir. This is the likely culprit for the PENDING symptom reported here: results/.exitcodeare never returned to the dir Nextflow reads, so outputs never bind and downstream tasks stay PENDING (No more task to compute… nodes still active). Substantive — needs a staging design decision (shared FS vs scp-before-terminate).#13 must land first (script has to actually run) before #14's staging can be validated end-to-end. Tracking the fix in those two.
chore(release): v0.2.1 (#17)