nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Division by 0 with Biocontainers and trace enabled

Open rspreafico opened this issue 6 years ago • 20 comments

Bug report

All processes fail with exit status 1. Inspection of .command.err shows the same error for all processes, regardless of the .command.sh executed:

Example 1: /path/to/work/1d/ea9ef9b6c1fd65626e6419e659ce8d/.command.run: line 172: 1581115658 %000: division by 0 (error token is "000")

Example 2: /path/to/work/1d/ea9ef9b6c1fd65626e6419e659ce8d/.command.run: line 172: 1581115701 %000: division by 0 (error token is "000")

Expected behavior and actual behavior

By looking at .command.log, I confirmed that the actual command completes successfully. The issue is entirely with .command.run wrapper.

Steps to reproduce the problem

Any process Using DSL2

Program output

.nextflow.log:

Feb-07 14:47:31.083 [main] DEBUG nextflow.cli.Launcher - $> nextflow run ../nf-virvar/main.nf -resume -latest -params-file params.yml
Feb-07 14:47:31.260 [main] INFO  nextflow.cli.CmdRun - N E X T F L O W  ~  version 20.01.0-edge
Feb-07 14:47:31.291 [main] INFO  nextflow.cli.CmdRun - Launching `../nf-virvar/main.nf` [confident_cori] - revision: 32b47dc0a8
Feb-07 14:47:31.354 [main] DEBUG nextflow.config.ConfigBuilder - Found config base: /Users/rspreafico/workspace/nf-virvar/nextflow.config
Feb-07 14:47:31.355 [main] DEBUG nextflow.config.ConfigBuilder - Parsing config file: /Users/rspreafico/workspace/nf-virvar/nextflow.config
Feb-07 14:47:31.382 [main] DEBUG nextflow.config.ConfigBuilder - Applying config profile: `standard`
Feb-07 14:47:32.401 [main] DEBUG nextflow.Session - Session uuid: 8c11e273-5027-4883-9814-3130033e2241
Feb-07 14:47:32.401 [main] DEBUG nextflow.Session - Run name: confident_cori
Feb-07 14:47:32.402 [main] DEBUG nextflow.Session - Executor pool size: 4
Feb-07 14:47:32.553 [main] DEBUG nextflow.cli.CmdRun - 
  Version: 20.01.0-edge build 5246
  Created: 20-01-2020 19:20 UTC (11:20 PDT)
  System: Mac OS X 10.15.3
  Runtime: Groovy 2.5.8 on OpenJDK 64-Bit Server VM 1.8.0_152-release-1056-b12
  Encoding: UTF-8 (UTF-8)
  Process: [email protected] [127.0.0.1]
  CPUs: 4 - Mem: 16 GB (28.5 MB) - Swap: 3 GB (1.4 GB)
Feb-07 14:47:32.581 [main] DEBUG nextflow.Session - Work-dir: /Users/rspreafico/workspace/virvar-test/work [Mac OS X]
Feb-07 14:47:32.581 [main] DEBUG nextflow.Session - Script base path does not exist or is not a directory: /Users/rspreafico/workspace/nf-virvar/bin
Feb-07 14:47:32.604 [main] DEBUG nextflow.Session - Observer factory: TowerFactory
Feb-07 14:47:32.606 [main] DEBUG nextflow.Session - Observer factory: DefaultObserverFactory
Feb-07 14:47:32.918 [main] DEBUG nextflow.Session - Session start invoked
Feb-07 14:47:32.922 [main] DEBUG nextflow.trace.TraceFileObserver - Flow starting -- trace file: /Users/rspreafico/workspace/virvar-test/trace.tsv
Feb-07 14:47:33.247 [main] DEBUG nextflow.script.ScriptRunner - > Launching execution
Feb-07 14:47:33.259 [main] WARN  nextflow.NextflowMeta$Preview - DSL 2 IS AN EXPERIMENTAL FEATURE UNDER DEVELOPMENT -- SYNTAX MAY CHANGE IN FUTURE RELEASE
Feb-07 14:47:34.721 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.721 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.727 [main] DEBUG nextflow.executor.Executor - [warm up] executor > local
Feb-07 14:47:34.734 [main] DEBUG n.processor.LocalPollingMonitor - Creating local task monitor for executor 'local' > cpus=4; memory=16 GB; capacity=4; pollInterval=100ms; dumpInterval=5m
Feb-07 14:47:34.790 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > fastqc_raw -- maxForks: 48; blocking: true
Feb-07 14:47:34.860 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.860 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.861 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > trimmomatic -- maxForks: 24; blocking: true
Feb-07 14:47:34.873 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.873 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.874 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > fastqc_trimmed -- maxForks: 48; blocking: true
Feb-07 14:47:34.880 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.881 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.884 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:bwa_index -- maxForks: 4; blocking: true
Feb-07 14:47:34.887 [main] WARN  nextflow.extension.OperatorEx - The operator `first` is useless when applied to a value channel which returns a single value by definition
Feb-07 14:47:34.893 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.893 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.894 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:bwa_align -- maxForks: 16; blocking: true
Feb-07 14:47:34.899 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.899 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.901 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:samtools_fixmate_bwa -- maxForks: 24; blocking: true
Feb-07 14:47:34.904 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.904 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.906 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:samtools_sort_bwa -- maxForks: 24; blocking: true
Feb-07 14:47:34.911 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.911 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.912 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:samtools_index_bwa -- maxForks: 24; blocking: true
Feb-07 14:47:34.915 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.916 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.916 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:mosdepth -- maxForks: 24; blocking: true
Feb-07 14:47:34.922 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.922 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.923 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:lofreq_viterbi -- maxForks: 12; blocking: true
Feb-07 14:47:34.926 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.926 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.926 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:samtools_sort_viterbi -- maxForks: 24; blocking: true
Feb-07 14:47:34.928 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.928 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.929 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:samtools_index_viterbi -- maxForks: 24; blocking: true
Feb-07 14:47:34.933 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.933 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.934 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:lofreq_indelqual -- maxForks: 12; blocking: true
Feb-07 14:47:34.940 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.940 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.941 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:lofreq_alnqual -- maxForks: 12; blocking: true
Feb-07 14:47:34.945 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.945 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.946 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:lofreq_call_parallel -- maxForks: 12; blocking: true
Feb-07 14:47:34.951 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.951 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.954 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:bcftools_view_filter -- maxForks: 24; blocking: true
Feb-07 14:47:34.958 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.959 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.959 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:htslib_bgzip_filter -- maxForks: 24; blocking: true
Feb-07 14:47:34.963 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.963 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.963 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:htslib_tabix_filter -- maxForks: 24; blocking: true
Feb-07 14:47:34.967 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.967 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.968 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:vcflib_vcf2tsv -- maxForks: 24; blocking: true
Feb-07 14:47:34.975 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.975 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.976 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:bcftools_view_consensus -- maxForks: 24; blocking: true
Feb-07 14:47:34.978 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.978 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.978 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:htslib_bgzip_consensus -- maxForks: 24; blocking: true
Feb-07 14:47:34.981 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.981 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.982 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:htslib_tabix_consensus -- maxForks: 24; blocking: true
Feb-07 14:47:34.986 [main] DEBUG nextflow.executor.ExecutorFactory - << taskConfig executor: local
Feb-07 14:47:34.986 [main] DEBUG nextflow.executor.ExecutorFactory - >> processorType: 'local'
Feb-07 14:47:34.988 [main] DEBUG nextflow.processor.TaskProcessor - Creating operator > variant_calling_step1:bcftools_consensus -- maxForks: 24; blocking: true
Feb-07 14:47:35.004 [main] DEBUG nextflow.Session - Ignite dataflow network (28)
Feb-07 14:47:35.016 [PathVisitor-1] DEBUG nextflow.file.PathVisitor - files for syntax: glob; folder: /Users/rspreafico/workspace/virvar-test/reads/; pattern: *_L???_R{1,2}_001.fastq.gz; options: [:]
Feb-07 14:47:35.022 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > fastqc_raw
Feb-07 14:47:35.024 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > trimmomatic
Feb-07 14:47:35.026 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > fastqc_trimmed
Feb-07 14:47:35.027 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:bwa_index
Feb-07 14:47:35.030 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:bwa_align
Feb-07 14:47:35.036 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:samtools_fixmate_bwa
Feb-07 14:47:35.037 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:samtools_sort_bwa
Feb-07 14:47:35.037 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:samtools_index_bwa
Feb-07 14:47:35.039 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:mosdepth
Feb-07 14:47:35.040 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:lofreq_viterbi
Feb-07 14:47:35.040 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:samtools_sort_viterbi
Feb-07 14:47:35.043 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:samtools_index_viterbi
Feb-07 14:47:35.044 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:lofreq_indelqual
Feb-07 14:47:35.044 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:lofreq_alnqual
Feb-07 14:47:35.045 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:lofreq_call_parallel
Feb-07 14:47:35.046 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:bcftools_view_filter
Feb-07 14:47:35.046 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:htslib_bgzip_filter
Feb-07 14:47:35.046 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:htslib_tabix_filter
Feb-07 14:47:35.047 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:vcflib_vcf2tsv
Feb-07 14:47:35.047 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:bcftools_view_consensus
Feb-07 14:47:35.048 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:htslib_bgzip_consensus
Feb-07 14:47:35.048 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:htslib_tabix_consensus
Feb-07 14:47:35.050 [main] DEBUG nextflow.processor.TaskProcessor - Starting process > variant_calling_step1:bcftools_consensus
Feb-07 14:47:35.050 [main] DEBUG nextflow.script.ScriptRunner - > Await termination 
Feb-07 14:47:35.052 [main] DEBUG nextflow.Session - Session await
Feb-07 14:47:35.242 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:47:35.247 [Task submitter] INFO  nextflow.Session - [1d/ea9ef9] Submitted process > variant_calling_step1:bwa_index (null)
Feb-07 14:47:35.373 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:47:35.373 [Task submitter] INFO  nextflow.Session - [72/3ae973] Submitted process > fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz)
Feb-07 14:47:35.382 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:47:35.383 [Task submitter] INFO  nextflow.Session - [3f/7c2c66] Submitted process > fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R1_001.fastq.gz)
Feb-07 14:47:35.401 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:47:35.404 [Task submitter] INFO  nextflow.Session - [06/b884ff] Submitted process > fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R2_001.fastq.gz)
Feb-07 14:47:38.973 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 1; name: variant_calling_step1:bwa_index (null); status: COMPLETED; exit: 1; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/1d/ea9ef9b6c1fd65626e6419e659ce8d]
Feb-07 14:47:38.981 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:47:38.983 [Task submitter] INFO  nextflow.Session - [5e/804f02] Submitted process > fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R1_001.fastq.gz)
Feb-07 14:47:38.985 [Task monitor] INFO  nextflow.processor.TaskProcessor - [1d/ea9ef9] NOTE: Process `variant_calling_step1:bwa_index (null)` terminated with an error exit status (1) -- Execution is retried (1)
Feb-07 14:47:59.136 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 6; name: fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R1_001.fastq.gz); status: COMPLETED; exit: 1; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/5e/804f0243149fd8de58c1c51110d200]
Feb-07 14:47:59.137 [Task monitor] INFO  nextflow.processor.TaskProcessor - [5e/804f02] NOTE: Process `fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R1_001.fastq.gz)` terminated with an error exit status (1) -- Execution is retried (1)
Feb-07 14:48:00.993 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 4; name: fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R1_001.fastq.gz); status: COMPLETED; exit: 1; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/3f/7c2c66f61288bd7cf6867d1720fa85]
Feb-07 14:48:00.994 [Task monitor] INFO  nextflow.processor.TaskProcessor - [3f/7c2c66] NOTE: Process `fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R1_001.fastq.gz)` terminated with an error exit status (1) -- Execution is retried (1)
Feb-07 14:48:01.001 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:48:01.001 [Task submitter] INFO  nextflow.Session - [f0/aa3a70] Submitted process > trimmomatic (UDS-SEQ00559-P0735M00005_L001)
Feb-07 14:48:01.083 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 7; name: fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R2_001.fastq.gz); status: COMPLETED; exit: 1; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/06/b884ffb7a21df0bfc95a9e000db2f2]
Feb-07 14:48:01.083 [Task monitor] INFO  nextflow.processor.TaskProcessor - [06/b884ff] NOTE: Process `fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R2_001.fastq.gz)` terminated with an error exit status (1) -- Execution is retried (1)
Feb-07 14:48:01.089 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:48:01.091 [Task submitter] INFO  nextflow.Session - [ce/ae7dd3] Re-submitted process > variant_calling_step1:bwa_index (null)
Feb-07 14:48:02.450 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 5; name: fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz); status: COMPLETED; exit: 1; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/72/3ae973698f0742ac21a6b65c558c31]
Feb-07 14:48:02.451 [Task monitor] INFO  nextflow.processor.TaskProcessor - [72/3ae973] NOTE: Process `fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz)` terminated with an error exit status (1) -- Execution is retried (1)
Feb-07 14:48:02.455 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:48:02.455 [Task submitter] INFO  nextflow.Session - [4c/61e8b7] Re-submitted process > fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R1_001.fastq.gz)
Feb-07 14:48:21.812 [Task monitor] DEBUG n.processor.TaskPollingMonitor - Task completed > TaskHandler[id: 2; name: trimmomatic (UDS-SEQ00559-P0735M00005_L001); status: COMPLETED; exit: 1; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/f0/aa3a7031a54c3c9aedb524787198ea]
Feb-07 14:48:21.813 [Task monitor] INFO  nextflow.processor.TaskProcessor - [f0/aa3a70] NOTE: Process `trimmomatic (UDS-SEQ00559-P0735M00005_L001)` terminated with an error exit status (1) -- Execution is retried (1)
Feb-07 14:48:21.821 [Task submitter] DEBUG nextflow.executor.LocalTaskHandler - Launch cmd line: /bin/bash -ue .command.run
Feb-07 14:48:21.821 [Task submitter] INFO  nextflow.Session - [6f/54efc9] Submitted process > trimmomatic (UDS-SEQ00559-P0735M00007_L001)
Feb-07 14:52:34.864 [Task monitor] DEBUG n.processor.TaskPollingMonitor - !! executor local > tasks to be completed: 3 -- submitted tasks are shown below
~> TaskHandler[id: 8; name: variant_calling_step1:bwa_index (null); status: SUBMITTED; exit: -; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/ce/ae7dd3f4deec4a5c28509e8ba3953c]
~> TaskHandler[id: 9; name: fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R1_001.fastq.gz); status: SUBMITTED; exit: -; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/4c/61e8b76fab14abb216458761635120]
~> TaskHandler[id: 3; name: trimmomatic (UDS-SEQ00559-P0735M00007_L001); status: SUBMITTED; exit: -; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/6f/54efc9f6152ca6ef7a92688ae837ab]
Feb-07 14:57:34.870 [Task monitor] DEBUG n.processor.TaskPollingMonitor - !! executor local > tasks to be completed: 3 -- submitted tasks are shown below
~> TaskHandler[id: 8; name: variant_calling_step1:bwa_index (null); status: SUBMITTED; exit: -; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/ce/ae7dd3f4deec4a5c28509e8ba3953c]
~> TaskHandler[id: 9; name: fastqc_raw (UDS-SEQ00559-P0735M00007_S42_L001_R1_001.fastq.gz); status: SUBMITTED; exit: -; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/4c/61e8b76fab14abb216458761635120]
~> TaskHandler[id: 3; name: trimmomatic (UDS-SEQ00559-P0735M00007_L001); status: SUBMITTED; exit: -; error: -; workDir: /Users/rspreafico/workspace/virvar-test/work/6f/54efc9f6152ca6ef7a92688ae837ab]

Environment

Nextflow 20.01.0-edge macOS Catalina Nextflow installed via conda in a new conda environment openjdk version "1.8.0_152-release" installed in conda env as nextflow dependency All processes are dockerized, Docker Desktop 2.2.0.0 with Engine 19.03.5

Additional context

NA

rspreafico avatar Feb 07 '20 22:02 rspreafico

Confirming this is still present in Nf 20.01-0-rc1

rspreafico avatar Feb 08 '20 04:02 rspreafico

Please share the .command.run producing the error.

pditommaso avatar Feb 08 '20 13:02 pditommaso

#!/bin/bash
# NEXTFLOW TASK: fastqc_raw (UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz)
set -e
set -u
NXF_DEBUG=${NXF_DEBUG:=0}; [[ $NXF_DEBUG > 1 ]] && set -x
NXF_ENTRY=${1:-nxf_main}

nxf_tree() {
    local pid=$1

    declare -a ALL_CHILDREN
    while read P PP;do
        ALL_CHILDREN[$PP]+=" $P"
    done < <(ps -e -o pid= -o ppid=)

    pstat() {
        local x_pid=$1
        local STATUS=$(2> /dev/null < /proc/$1/status egrep 'Vm|ctxt')

        if [ $? = 0 ]; then
        local  x_vsz=$(echo "$STATUS" | grep VmSize | awk '{print $2}' || echo -n '0')
        local  x_rss=$(echo "$STATUS" | grep VmRSS | awk '{print $2}' || echo -n '0')
        local x_peak=$(echo "$STATUS" | egrep 'VmPeak|VmHWM' | sed 's/^.*:\s*//' | sed 's/[\sa-zA-Z]*$//' | tr '\n' ' ' || echo -n '0 0')
        local x_pmem=$(awk -v rss=$x_rss -v mem_tot=$mem_tot 'BEGIN {printf "%.0f", rss/mem_tot*100*10}' || echo -n '0')
        local vol_ctxt=$(echo "$STATUS" | grep '\bvoluntary_ctxt_switches' | awk '{print $2}' || echo -n '0')
        local inv_ctxt=$(echo "$STATUS" | grep '\bnonvoluntary_ctxt_switches' | awk '{print $2}' || echo -n '0')
        cpu_stat[x_pid]="$x_pid $x_pmem $x_vsz $x_rss $x_peak $vol_ctxt $inv_ctxt"
        fi
    }

    pwalk() {
        pstat $1
        for i in ${ALL_CHILDREN[$1]:=}; do pwalk $i; done
    }

    pwalk $1
}

nxf_stat() {
    cpu_stat=()
    nxf_tree $1

    declare -a sum=(0 0 0 0 0 0 0 0)
    local pid
    local i
    for pid in "${!cpu_stat[@]}"; do
        local row=(${cpu_stat[pid]})
        [ $NXF_DEBUG = 1 ] && echo "++ stat mem=${row[*]}"
        for i in "${!row[@]}"; do
        if [ $i != 0 ]; then
            sum[i]=$((sum[i]+row[i]))
        fi
        done
    done

    [ $NXF_DEBUG = 1 ] && echo -e "++ stat SUM=${sum[*]}"

    for i in {1..7}; do
        if [ ${sum[i]} -lt ${cpu_peak[i]} ]; then
            sum[i]=${cpu_peak[i]}
        else
            cpu_peak[i]=${sum[i]}
        fi
    done

    [ $NXF_DEBUG = 1 ] && echo -e "++ stat PEAK=${sum[*]}\n"
    nxf_stat_ret=(${sum[*]})
}

nxf_sleep() {
  sleep $1 2>/dev/null || sleep 1;
}

nxf_mem_watch() {
    set -o pipefail
    local pid=$1
    local trace_file=.command.trace
    local count=0;
    declare -a cpu_stat=(0 0 0 0 0 0 0 0)
    declare -a cpu_peak=(0 0 0 0 0 0 0 0)
    local mem_tot=$(< /proc/meminfo grep MemTotal | awk '{print $2}')
    local timeout
    local DONE
    local STOP=''

    [ $NXF_DEBUG = 1 ] && nxf_sleep 0.2 && ps fx

    while true; do
        nxf_stat $pid
        if [ $count -lt 10 ]; then timeout=1;
        elif [ $count -lt 120 ]; then timeout=5;
        else timeout=30;
        fi
        read -t $timeout -r DONE || true
        [[ $DONE ]] && break
        if [ ! -e /proc/$pid ]; then
            [ ! $STOP ] && STOP=$(nxf_date)
            [ $(($(nxf_date)-STOP)) -gt 10000 ] && break
        fi
        count=$((count+1))
    done

    echo "%mem=${nxf_stat_ret[1]}"      >> $trace_file
    echo "vmem=${nxf_stat_ret[2]}"      >> $trace_file
    echo "rss=${nxf_stat_ret[3]}"       >> $trace_file
    echo "peak_vmem=${nxf_stat_ret[4]}" >> $trace_file
    echo "peak_rss=${nxf_stat_ret[5]}"  >> $trace_file
    echo "vol_ctxt=${nxf_stat_ret[6]}"  >> $trace_file
    echo "inv_ctxt=${nxf_stat_ret[7]}"  >> $trace_file
}

nxf_write_trace() {
    echo "nextflow.trace/v2"           > $trace_file
    echo "realtime=$wall_time"         >> $trace_file
    echo "%cpu=$ucpu"                  >> $trace_file
    echo "rchar=${io_stat1[0]}"        >> $trace_file
    echo "wchar=${io_stat1[1]}"        >> $trace_file
    echo "syscr=${io_stat1[2]}"        >> $trace_file
    echo "syscw=${io_stat1[3]}"        >> $trace_file
    echo "read_bytes=${io_stat1[4]}"   >> $trace_file
    echo "write_bytes=${io_stat1[5]}"  >> $trace_file
}

nxf_trace_mac() {
    local start_millis=$(nxf_date)

    /bin/bash -ue /Users/rspreafico/workspace/virvar-test/work/fa/2a61318db974e1e84ed2800c8d2a90/.command.sh

    local end_millis=$(nxf_date)
    local wall_time=$((end_millis-start_millis))
    local ucpu=''
    local io_stat1=('' '' '' '' '' '')
    nxf_write_trace
}

nxf_fd() {
    local FD=11
    while [ -e /proc/$$/fd/$FD ]; do FD=$((FD+1)); done
    echo $FD
}

nxf_trace_linux() {
    local pid=$$
    command -v ps &>/dev/null || { >&2 echo "Command 'ps' required by nextflow to collect task metrics cannot be found"; exit 1; }
    local num_cpus=$(< /proc/cpuinfo grep '^processor' -c)
    local tot_time0=$(grep '^cpu ' /proc/stat | awk '{sum=$2+$3+$4+$5+$6+$7+$8+$9; printf "%.0f",sum}')
    local cpu_time0=$(2> /dev/null < /proc/$pid/stat awk '{printf "%.0f", ($16+$17)*10 }' || echo -n 'X')
    local io_stat0=($(2> /dev/null < /proc/$pid/io sed 's/^.*:\s*//' | head -n 6 | tr '\n' ' ' || echo -n '0 0 0 0 0 0'))
    local start_millis=$(nxf_date)
    trap 'kill $mem_proc' ERR
    
    /bin/bash -ue /Users/rspreafico/workspace/virvar-test/work/fa/2a61318db974e1e84ed2800c8d2a90/.command.sh &
    local task=$!

    mem_fd=$(nxf_fd)
    eval "exec $mem_fd> >(nxf_mem_watch $task)"
    local mem_proc=$!

    wait $task

    local end_millis=$(nxf_date)
    local tot_time1=$(grep '^cpu ' /proc/stat | awk '{sum=$2+$3+$4+$5+$6+$7+$8+$9; printf "%.0f",sum}')
    local cpu_time1=$(2> /dev/null < /proc/$pid/stat awk '{printf "%.0f", ($16+$17)*10 }' || echo -n 'X')
    local ucpu=$(awk -v p1=$cpu_time1 -v p0=$cpu_time0 -v t1=$tot_time1 -v t0=$tot_time0 -v n=$num_cpus 'BEGIN { pct=(p1-p0)/(t1-t0)*100*n; printf("%.0f", pct>0 ? pct : 0) }' )

    local io_stat1=($(2> /dev/null < /proc/$pid/io sed 's/^.*:\s*//' | head -n 6 | tr '\n' ' ' || echo -n '0 0 0 0 0 0'))
    local i
    for i in {0..5}; do
        io_stat1[i]=$((io_stat1[i]-io_stat0[i]))
    done

    local wall_time=$((end_millis-start_millis))
    [ $NXF_DEBUG = 1 ] && echo "+++ STATS %CPU=$ucpu TIME=$wall_time I/O=${io_stat1[*]}"

    echo "nextflow.trace/v2"           > $trace_file
    echo "realtime=$wall_time"         >> $trace_file
    echo "%cpu=$ucpu"                  >> $trace_file
    echo "rchar=${io_stat1[0]}"        >> $trace_file
    echo "wchar=${io_stat1[1]}"        >> $trace_file
    echo "syscr=${io_stat1[2]}"        >> $trace_file
    echo "syscw=${io_stat1[3]}"        >> $trace_file
    echo "read_bytes=${io_stat1[4]}"   >> $trace_file
    echo "write_bytes=${io_stat1[5]}"  >> $trace_file

    [ -e /proc/$mem_proc ] && eval "echo 'DONE' >&$mem_fd" || true
    wait $mem_proc 2>/dev/null || true
    while [ -e /proc/$mem_proc ]; do nxf_sleep 0.1; done
}

nxf_trace() {
    local trace_file=.command.trace
    touch $trace_file
    if [[ $(uname) = Darwin ]]; then
        nxf_trace_mac
    else
        nxf_trace_linux
    fi
}

nxf_date() {
    local ts=$(date +%s%3N);
    if [[ ${#ts} == 10 ]]; then echo ${ts}000
    elif [[ $ts == *3N ]]; then echo ${ts/3N/000}
    elif [[ ${#ts} == 13 ]]; then echo $ts
    else echo "Unexpected timestamp value: $ts"; exit 1
    fi
}

nxf_env() {
    echo '============= task environment ============='
    env | sort | sed "s/\(.*\)AWS\(.*\)=\(.\{6\}\).*/\1AWS\2=\3xxxxxxxxxxxxx/"
    echo '============= task output =================='
}

nxf_kill() {
    declare -a children
    while read P PP;do
        children[$PP]+=" $P"
    done < <(ps -e -o pid= -o ppid=)

    kill_all() {
        [[ $1 != $$ ]] && kill $1 2>/dev/null || true
        for i in ${children[$1]:=}; do kill_all $i; done
    }

    kill_all $1
}

nxf_mktemp() {
    local base=${1:-/tmp}
    if [[ $(uname) = Darwin ]]; then mktemp -d $base/nxf.XXXXXXXXXX
    else TMPDIR="$base" mktemp -d -t nxf.XXXXXXXXXX
    fi
}

on_exit() {
    exit_status=${nxf_main_ret:=$?}
    printf $exit_status > /Users/rspreafico/workspace/virvar-test/work/fa/2a61318db974e1e84ed2800c8d2a90/.exitcode
    set +u
    [[ "$tee1" ]] && kill $tee1 2>/dev/null
    [[ "$tee2" ]] && kill $tee2 2>/dev/null
    [[ "$ctmp" ]] && rm -rf $ctmp || true
    docker rm $NXF_BOXID &>/dev/null || true
    exit $exit_status
}

on_term() {
    set +e
    docker kill $NXF_BOXID
}

nxf_launch() {
    docker run -i --memory 2048m -e "NXF_DEBUG=${NXF_DEBUG:=0}" -v /Users/rspreafico/workspace/virvar-test:/Users/rspreafico/workspace/virvar-test -v "$PWD":"$PWD" -w "$PWD" --entrypoint /bin/bash --user `id -u`:`id -g` --name $NXF_BOXID quay.io/biocontainers/fastqc:0.11.8--1 -c "/bin/bash /Users/rspreafico/workspace/virvar-test/work/fa/2a61318db974e1e84ed2800c8d2a90/.command.run nxf_trace"
}

nxf_stage() {
    true
    # stage input files
    rm -f UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz
    ln -s /Users/rspreafico/workspace/virvar-test/reads/UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz UDS-SEQ00559-P0735M00005_S41_L001_R2_001.fastq.gz
}

nxf_unstage() {
    true
    [[ ${nxf_main_ret:=0} != 0 ]] && return
}

nxf_main() {
    trap on_exit EXIT
    trap on_term TERM INT USR1 USR2

    [[ "${NXF_CHDIR:-}" ]] && cd "$NXF_CHDIR"
    export NXF_BOXID="nxf-$(dd bs=18 count=1 if=/dev/urandom 2>/dev/null | base64 | tr +/ 0A)"
    NXF_SCRATCH=''
    [[ $NXF_DEBUG > 0 ]] && nxf_env
    touch /Users/rspreafico/workspace/virvar-test/work/fa/2a61318db974e1e84ed2800c8d2a90/.command.begin
    set +u
    set -u
    [[ $NXF_SCRATCH ]] && echo "nxf-scratch-dir $HOSTNAME:$NXF_SCRATCH" && cd $NXF_SCRATCH
    nxf_stage

    set +e
    local ctmp=$(set +u; nxf_mktemp /dev/shm 2>/dev/null || nxf_mktemp $TMPDIR)
    local cout=$ctmp/.command.out; mkfifo $cout
    local cerr=$ctmp/.command.err; mkfifo $cerr
    tee .command.out < $cout &
    tee1=$!
    tee .command.err < $cerr >&2 &
    tee2=$!
    ( nxf_launch ) >$cout 2>$cerr &
    pid=$!
    wait $pid || nxf_main_ret=$?
    wait $tee1 $tee2
    nxf_unstage
}

$NXF_ENTRY

rspreafico avatar Feb 08 '20 16:02 rspreafico

Umm.

macOS Catalina

What's the shell you are using? Check with $SHELL --version.

pditommaso avatar Feb 08 '20 16:02 pditommaso

Oh my zsh

On Sat, Feb 8, 2020, 8:14 AM Paolo Di Tommaso [email protected] wrote:

Umm.

macOS Catalina

What's the shell you are using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nextflow-io/nextflow/issues/1488?email_source=notifications&email_token=AA2TT37ISCEXPMH2DI2RJR3RB3K6RA5CNFSM4KRWEZCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELFVJ5Y#issuecomment-583750903, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2TT37VSMDOHK6Z2B2VSZDRB3K6RANCNFSM4KRWEZCA .

rspreafico avatar Feb 08 '20 17:02 rspreafico

Ok I am on laptop now - zsh 5.7.1 (x86_64-apple-darwin19.0)

rspreafico avatar Feb 08 '20 19:02 rspreafico

After changing default shell to bashwith chsh -s /bin/bash, logging out/in, then executing nextflow, same error.

.command.run is set to be executed by bash. Makes me wonder whether the issue is then with Catalina's bash? Given that default shell is zsh, maybe Catalina's bash lacks minimal configuration?

rspreafico-vir avatar Feb 09 '20 00:02 rspreafico-vir

Some more tests: same issues when using zsh on Ubuntu 19.10, and even when switching to bash on Ubuntu 19.10. The issue is definitely not the shell.

I tried switching a FastQC process from its Biocontainer to another random Docker container on Dockerhub, and now FastQC completed. Therefore, the issue is specific to Biocontainers.

rspreafico avatar Feb 09 '20 00:02 rspreafico

Ok final piece of troubleshooting info:

  • switching back to an old biocontainer (same tool, but from 2 years ago) did not help -> indicates that biocontainers did not introduce something new recently that have broken things

  • I haven't tried reverting back to an older version of Nextflow (since I made all the syntax changes for 20.01.0-rc already), but I have a different biocontainers-using pipeline running Nf 19.10.0 with AWS Batch backend that always worked fine

rspreafico-vir avatar Feb 09 '20 01:02 rspreafico-vir

The bottom line is that is not expected to work zsh, try to set bash as your default shell. For example https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/

pditommaso avatar Feb 09 '20 14:02 pditommaso

Yes I tried setting bash as default shell yesterday, but still no luck, nextflow throws the same error.

Conversely, using non-Biocontainers Docker containers solved things.

On Sun, Feb 9, 2020, 6:27 AM Paolo Di Tommaso [email protected] wrote:

The bottom line is that is not expected to work zsh, try to set bash as your default shell. For example https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nextflow-io/nextflow/issues/1488?email_source=notifications&email_token=AA2TT3ZCARE7G4GIE3NHXH3RCAHFJA5CNFSM4KRWEZCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELGN25A#issuecomment-583851380, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2TT34EFRTV2DP3ECMYMY3RCAHFJANCNFSM4KRWEZCA .

rspreafico avatar Feb 09 '20 16:02 rspreafico

This is the output when trying bash after chsh and logout/login:

$SHELL -version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

Then nextflow's .command.err:

[bwa_index] Pack FASTA... 0.00 sec
[bwa_index] Construct BWT for the packed sequence...
[bwa_index] 0.00 seconds elapse.
[bwa_index] Update BWT... 0.00 sec
[bwa_index] Pack forward-only FASTA... 0.00 sec
[bwa_index] Construct SA from BWT and Occ... 0.00 sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa index HBV_B_AB219428.fasta
[main] Real time: 0.073 sec; CPU: 0.014 sec
/path/to/work/6c/f5088ed1d8baa63cb329de7a967820/.command.run: line 172: 1581270194%000: division by 0 (error token is "000")

rspreafico-vir avatar Feb 09 '20 17:02 rspreafico-vir

Although zsh seems unrelated to this specific issue, I will open a separate enhancement proposal to support zsh in future, given macOS' move to deprecate bash.

rspreafico-vir avatar Feb 09 '20 17:02 rspreafico-vir

if a container execution is involved than depends on on the Bash in the container. Which is exactly the container image you are using?

pditommaso avatar Feb 10 '20 10:02 pditommaso

Any Biocontainer, the version seems not to matter since I tried recent Biocontainers (1 month old) and old alike (2 years) and anything in between - they all fail.

However, with Nextflow 19.10 I don't see any issue.

Has anything changed between Nf 19.10 and 20.01.0 in .command.run?


From: Paolo Di Tommaso [email protected] Sent: Monday, February 10, 2020 2:25:31 AM To: nextflow-io/nextflow [email protected] Cc: Roberto Spreafico [email protected]; Comment [email protected] Subject: [EXTERNAL] Re: [nextflow-io/nextflow] Division by 0 with zsh (#1488)

if a container execution is involved than depends on on the Bash in the container. Which is exactly the container image you are using?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/nextflow-io/nextflow/issues/1488?email_source=notifications&email_token=ALGEWX6KZP6GY63BX4IJUSTRCETRXA5CNFSM4KRWEZCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELH7K2I#issuecomment-584054121, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGEWX6AOFPJGE5P6M75Z4DRCETRXANCNFSM4KRWEZCA.

rspreafico-vir avatar Feb 10 '20 11:02 rspreafico-vir

I'm *not* able to replicate the problem with quay.io/biocontainers/salmon:1.1.0--hf69c8f4_0. You can provide a container image url reporting the issue?

pditommaso avatar Feb 10 '20 11:02 pditommaso

Ok, I tried a minimal example and was able to isolate the issue.

There needs to be two conditions for the error to come up:

  • using Biocontainers as opposed to other Docker containers
  • need to enable trace in nextflow.config

If you replace Biocontainers with other containers, it works. If you disable trace, it works.

I am using quay.io/biocontainers/fastqc:0.11.8--1 but the salmon biocontainer is another one I use in my pipelines as would give same errors when trace is required.

rspreafico-vir avatar Feb 10 '20 20:02 rspreafico-vir

Ok, found. the date tool in the containers does not support milliseconds resolution.

pditommaso avatar Feb 10 '20 20:02 pditommaso

Solved. Thanks for helping to troubleshoot the issue.

pditommaso avatar Feb 10 '20 21:02 pditommaso

Thanks @pditommaso for the quick resolution!

rspreafico-vir avatar Feb 10 '20 21:02 rspreafico-vir