Repository navigation
Description
Symptom
On nf-spawn 0.7.0, an nf-core/taxprofiler run deadlocks at the profiling step: KRAKEN2_KRAKEN2 and METAPHLAN_METAPHLAN sit status=ACTIVE with their db channel (queue) OPEN and zero classifier tasks are ever submitted. Nextflow then logs:
!! executor spawn > No more task to compute -- The following nodes are still active:
[process] NFCORE_TAXPROFILER:TAXPROFILER:PROFILING:KRAKEN2_KRAKEN2
status=ACTIVE
port 1: (queue) OPEN ; channel: db
All preceding stages (FETCH/fastp/FastQC) complete exit 0. ext.az (the 0.7.0 feature) works correctly — every task pinned to the requested AZ.
Root cause (what the head log shows)
The DB is delivered via ext.volumes (EBS snapshot mounted RO at /opt/databases/{kraken2,metaphlan}), and taxprofiler stages db_path as a Nextflow path input. On 0.7.0 the head's FilePorter copies the entire mounted DB dir UP to S3 instead of the staged input being symlinked to the ext.volumes mount (the #55/#56 zero-copy behavior):
FilePorter - Copying foreign file /opt/databases/kraken2 to work dir: s3://.../stage-.../kraken2
S3FileSystemProvider - S3 upload directory from=/opt/databases/kraken2 to=s3://.../kraken2
FilePorter - Staging foreign file: /opt/databases/kraken2 # and /opt/databases/metaphlan
That upload never completes for the large files — in the staged S3 prefix, all the small Kraken2 files are present but hash.k2d (the ~16 GB main DB) is missing; likewise MetaPhlAn's main .1.bt2l/.2.bt2l are missing. So the db channel never receives a complete staged input and the process deadlocks.
Why this is surprising
The symlink methods (volumeMountPaths, volumeBindMounts, parseVolumeSpecs) are present in 0.7.0, and javap shows 0.7.0's SpawnTaskHandler differs from 0.6.0 only by the added az parameter on buildLaunchCommand — the volume/symlink code is byte-identical. So either:
- the 0.5.0 stage-name symlink works for
--db <name>(Kraken2) but notfind -L <name>(MetaPhlAn) — symlink missing in task work dir #55/fix: symlink ext.volumes DB by stage-name basename, not source URI (#55) #56 staged-input→symlink path regressed in behavior despite identical-looking methods, or - it never actually fired for taxprofiler's specific staging shape and a different earlier build masked it.
(Reporting observations only — not proposing a fix.)
Repro
- nf-spawn 0.7.0, nf-core/taxprofiler 2.0.0, S3 workDir
process { withName: 'KRAKEN2_KRAKEN2' { ext.volumes = [[snapshot:'snap-…', mount:'/opt/databases/kraken2', readOnly:true]] } }(same for METAPHLAN)databases.csvdb_path= the mount path; mount basename == the input stage name- head also mounts the same snapshots RO (via
--attach-volume) so head-sidedb_pathexistence validation passes
Expected
The staged path input whose stage-name basename matches an ext.volumes mount is symlinked to the mount (zero-copy), not copied to S3 — so the db channel resolves and classifier tasks submit. This worked on a pre-release build between 0.6.0 and 0.7.0.
Activity
scttfrdmn commentedon Jun 16, 2026
Dug into this — your hypothesis #2 is correct, and it's not a 0.7.0 regression. Root cause locked down:
What's actually happening
The
#55/#56zero-copy fix is entirely instance-side:buildInputStaging(inSpawnTaskHandler) emitsln -sfn <mount> <stagename>instead ofaws s3 cpon the task instance, keyed offtask.getInputFilesMap(). That code is byte-identical in 0.7.0 (you're right — the only delta is theazparam), and it works once a task is scheduled.But the deadlock happens before any task exists. The
db_pathinput points at/opt/databases/kraken2— a local path on the head that is foreign to the S3 work dir's filesystem. Nextflow's FilePorter therefore copies it into the S3 work area on the head as part of resolving thedbchannel, beforeKRAKEN2_KRAKEN2ever submits. The instance-side symlink never gets a chance to run because the channel never resolves — the 16 GBhash.k2dupload stalls/never completes, so the(queue) OPENdeadlock you see.Why this isn't a regression
getStageInMode/stageInMode/FilePorterhave never appeared in nf-spawn's history (git log -Sacross--allis empty) — there was never any head-side foreign-file handling.SpawnExecutordoesn't override stage-in at all, so Nextflow's default "copy foreign path inputs into the work dir" applies. The pre-release build that "worked" almost certainly had the head mounting the same snapshot such that the copy was local→local (fast, completed) — but as soon as the work dir is S3 and the DB is large, the head→S3 copy is the bottleneck. #55 fixed the per-task download; it never addressed the head-side stage-in copy because in the validating run that copy happened to complete.The real fix is head-side, and it's a design choice
The instance-side symlink can't help here. Options, roughly:
SpawnExecutor/handler tell Nextflow not to stage apathinput whose source matches anext.volumesmount (so FilePorter skips the copy and the channel resolves to the mount path, which the instance already has bind-mounted). This is the clean fix if the 26.04 plugin API exposes the right hook (getStageInMode/foreign-file seam — needs confirming against the plugin API; I couldn't verify the exact method from the jar).databases.csvdb_pathat a path under the S3 work dir / same filesystem (or ans3://URI you pre-stage once), so it isn't foreign and isn't bulk-copied per run; the instance-side symlink then resolves it zero-copy. Less clean but unblocks the demo now.ext.volumes-backed DBs must not also be declared aspathinputs that resolve to a head-local path — pass them purely as the volume + reference them by mount path in the module.I'd lean option 1 as the durable fix but it needs an API spike to confirm the hook exists in the nextflow-plugin 1.0.0-beta.14 / Nextflow 26.04 surface before committing. Flagging clearly: this is a new gap (head-side stage-in), not the #55 path — re-opening #55 wouldn't be right; #65 is the correct home.
Want me to (a) spike option 1 (confirm the stage-in hook + prototype), or (b) write up option 2 as an immediate unblock for aws-microbiome-demo while option 1 is designed?
scttfrdmn commentedon Jun 16, 2026
Following up to correct my own framing above: this is a head-side / pipeline-config matter, not an nf-spawn defect — and I'm walking back the "option 1 (executor stage-in override)" suggestion.
By design, nf-spawn does no work on the head. It builds the
spawn launchargv and ships a staging script that runs entirely on the EC2 instance — that's the whole instance-sidebuildInputStaging/symlink mechanism (#55). The FilePorter copy you're seeing is Nextflow's own head-side staging, triggered bydatabases.csvdeclaringdb_pathas a path that resolves to a head-local directory (/opt/databases/kraken2) foreign to the S3 work dir. For nf-spawn to prevent that, it would have to intercept Nextflow's head-side file localization — which is both against its design (no head work) and a brittle fight with Nextflow internals. Not the right place to fix it.Resolution is on the head, in pipeline config: don't declare the
ext.volumes-backed DB as apathinput that resolves to a head-local foreign path. The intendedext.volumespattern (per #45/#49) is that the DB lives on the mounted volume and is referenced by its mount path on the instance — not also staged as a Nextflowpathinput the head must localize. With taxprofiler specifically, that means wiringdb_pathso Nextflow doesn't treat it as a foreign file to copy into the S3 work area (e.g. a pre-stageds3://location, or not routing the volume DB through the staged-pathchannel at all). You know your taxprofiler config best, so I'll leave the exact knob to you.Closing as not planned (not an nf-spawn bug) — the analysis stays here as the record. Happy to reopen if a head-side config change still leaves nf-spawn doing the wrong thing on the instance side.
One small thing I can do on the nf-spawn side if useful: a note in the README
ext.volumessection warning that a volume-backed DB must not also be declared as a head-localpathinput (it'll be bulk-copied to the work dir and can deadlock). Say the word and I'll add it — that's the only nf-spawn-side action that makes sense here.scttfrdmn commentedon Jun 16, 2026
Agreed on all counts — closing as not-planned is correct. The deadlock is the demo's pipeline config, not nf-spawn: by declaring the
ext.volumes-backed DB as a taxprofilerpathinput that resolves to the head-local mount (/opt/databases/kraken2), we made Nextflow's FilePorter try to bulk-copy ~56 GB of foreign files into the S3 work dir on the head, which stalls before any task is scheduled — so the instance-side#55symlink never gets a chance to run.The fix lives entirely on the demo side: stop routing the volume DB through a staged head-local
pathchannel. The mounted volume is the source of truth on the instance (the whole point ofext.volumesper #45/#49); the head must not also be asked to localize it. I'll rework the demo'sdatabases.csv/db_pathwiring so Nextflow doesn't treat it as a foreign file to copy (tracking that on the demo repo, not here).Yes please to the README note — a one-liner in the
ext.volumessection warning that a volume-backed reference must not also be declared as a head-localpathinput (it'll be bulk-copied to the work dir and can deadlock before any task submits) would have saved me this whole detour, and it's the right place to capture it. Thanks for the thorough root-cause.docs: warn against head-local foreign db_path with ext.volumes (#65) (#…
chore(release): v0.8.0