DADA2 (2017-12) segfault, memory not mapped error

Hi again, sorry to bother you all! Hope your holidays are going well.

I’m still trying to run DADA2 on my 53 unjoined, paired-end fastq files. The code I used is below. I added a --p-n-threads option to help with the processing speed:

$ qiime dada2 denoise-paired --i-demultiplexed-seqs demux-paired-end.qza --p-trim-left-f 0 --p-trunc-len-f 270 --p-trim-left-r 0 --p-trunc-len-r 120 --o-representative-sequences rep-seqs.qza --p-n-threads 0 --o-table table-dada2.qza

It came out with an error:
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: run_dada_paired.R /var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/forward /var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/reverse /var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/output.tsv.biom /var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/filt_f /var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/filt_r 270 120 0 0 2.0 2 consensus 1.0 0 1000000

R version 3.4.1 (2017-06-30)
Loading required package: Rcpp
DADA2 R package version: 1.6.0

  1. Filtering …
  2. Learning Error Rates
    2a) Forward Reads
    Initializing error rates to maximum possible estimate.
    Sample 1 - 165126 reads in 46441 unique sequences.

*** caught segfault ***
address 0x8, cause ‘memory not mapped’

Traceback:
1: .Call("_dada2_dada_uniques", PACKAGE = “dada2”, seqs, abundances, err, quals, score, gap, use_kmers, kdist_cutoff, band_size, omegaA, max_clust, min_fold, min_hamming, min_abund, use_quals, final_consensus, vectorized_alignment, homo_gap, multithread, verbose, SSE)
2: dada_uniques(names(derep[[i]]$uniques), unname(derep[[i]]$uniques), err, qi, opts[[“SCORE_MATRIX”]], opts[[“GAP_PENALTY”]], opts[[“USE_KMERS”]], opts[[“KDIST_CUTOFF”]], opts[[“BAND_SIZE”]], opts[[“OMEGA_A”]], if (initializeErr) { 1 } else { opts[[“MAX_CLUST”]] }, opts[[“MIN_FOLD”]], opts[[“MIN_HAMMING”]], opts[[“MIN_ABUNDANCE”]], TRUE, FALSE, opts[[“VECTORIZED_ALIGNMENT”]], opts[[“HOMOPOLYMER_GAP_PENALTY”]], multithread, (verbose >= 2), opts[[“SSE”]])
3: dada(drpsF, err = NULL, selfConsist = TRUE, multithread = multithread, VECTORIZED_ALIGNMENT = FALSE, SSE = 2)
An irrecoverable exception occurred. R is aborting now …
Traceback (most recent call last):
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_dada2/_denoise.py”, line 179, in denoise_paired
run_commands([cmd])
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_dada2/_denoise.py”, line 35, in run_commands
subprocess.run(cmd, check=True)
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/subprocess.py”, line 398, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘run_dada_paired.R’, ‘/var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/forward’, ‘/var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/reverse’, ‘/var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/output.tsv.biom’, ‘/var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/filt_f’, ‘/var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/tmp4oi35lem/filt_r’, ‘270’, ‘120’, ‘0’, ‘0’, ‘2.0’, ‘2’, ‘consensus’, ‘1.0’, ‘0’, ‘1000000’]’ returned non-zero exit status -11

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2cli/commands.py”, line 224, in call
results = action(**arguments)
File “”, line 2, in denoise_paired
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/sdk/action.py”, line 228, in bound_callable
output_types, provenance)
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/sdk/action.py”, line 363, in callable_executor
output_views = self._callable(**view_args)
File “/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_dada2/_denoise.py”, line 194, in denoise_paired
" and stderr to learn more." % e.returncode)
Exception: An error was encountered while running DADA2 in R (return code -11), please inspect stdout and stderr to learn more.

I’m not sure what the segfault is, or what “‘memory not mapped’” means? If anyone can shed some light on this error and what I might be doing wrong I would be really appreciative. Thank you so much.

Hey @slh277,

Sorry I responded in a different thread, but if you don’t mind following up again here:

What version of OS X are you running?

Also, just to see, does activating your environment and then running this command:

CDPATH= R -e 'source("https://bioconductor.org/biocLite.R"); biocLite("dada2")'

fix the issue?

Operating systems try to protect the memory of programs so that they don’t get corrupted by other bad programs. segfault is short for segmentation fault, which really means the OS is telling us “No, that memory isn’t for you.” and then kills the program.

You aren’t doing anything wrong here, there’s just something that we are struggling to reproduce at the moment.

1 Like

Hi @ebolyen, thanks for answering both posts - sorry I made a new thread (I tried again a few days later and wasn’t sure if the errors were exactly the same so posted that output as well).

I am running High Sierra 10.13.1.

I tried running the code you posted (thanks!!) … but I got an error that the “math.h.” file wasn’t found? The full error is below. When you have a chance, can you let me know if you have any more insight to this? Thanks so much!!

(qiime2-2017.12) MacBook-Pro-4:~ sm939$ CDPATH= R -e ‘source(“https://bioconductor.org/biocLite.R”); biocLite(“dada2”)’

R version 3.4.1 (2017-06-30) – "Single Candle"
Copyright © 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin14.5.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type ‘license()’ or ‘licence()’ for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type ‘contributors()’ for more information and
’citation()’ on how to cite R or R packages in publications.

Type ‘demo()’ for some demos, ‘help()’ for on-line help, or
’help.start()’ for an HTML browser interface to help.
Type ‘q()’ to quit R.

Warning: namespace ‘phyloseq’ is not available and has been replaced
by .GlobalEnv when processing object ‘plist’
[Previously saved workspace restored]

source(“https://bioconductor.org/biocLite.R”); biocLite(“dada2”)
Bioconductor version 3.6 (BiocInstaller 1.28.0), ?biocLite for help
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.6 (BiocInstaller 1.28.0), R 3.4.1 (2017-06-30).
Installing package(s) ‘dada2’
trying URL 'https://bioconductor.org/packages/3.6/bioc/src/contrib/dada2_1.6.0.tar.gz
Content type ‘application/x-gzip’ length 1767703 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

  • installing source package ‘dada2’ …
    ** libs
    clang++ -std=gnu++11 -I/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/include -DNDEBUG -I"/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/Rcpp/include" -I"/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/RcppParallel/include" -I/Users/sm939/miniconda3/envs/qiime2-2017.12/include -fPIC -I/Users/sm939/miniconda3/envs/qiime2-2017.12/include -c RcppExports.cpp -o RcppExports.o
    In file included from RcppExports.cpp:4:
    In file included from ./…/inst/include/dada2.h:7:
    In file included from ./…/inst/include/dada2_RcppExports.h:7:
    In file included from /Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/Rcpp/include/Rcpp.h:27:
    In file included from /Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/Rcpp/include/Rcpp/r/headers.h:48:
    In file included from /Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/Rcpp/include/Rcpp/platform/compiler.h:103:
    In file included from /Users/sm939/miniconda3/envs/qiime2-2017.12/include/c++/v1/cmath:305:
    /Users/sm939/miniconda3/envs/qiime2-2017.12/include/c++/v1/math.h:301:15: fatal error: ‘math.h’ file not found
    #include_next <math.h>
    ^~~~~~~~
    1 error generated.
    make: *** [RcppExports.o] Error 1
    ERROR: compilation failed for package ‘dada2’
  • removing ‘/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/dada2’
  • restoring previous ‘/Users/sm939/miniconda3/envs/qiime2-2017.12/lib/R/library/dada2’

The downloaded source packages are in
‘/private/var/folders/8x/rqqs6m296k7g3trbdz559cnm0000gp/T/RtmphCrUpB/downloaded_packages’
Updating HTML index of packages in '.Library’
Making ‘packages.html’ … done
Old packages: ‘data.table’, ‘digest’, ‘GenomicAlignments’, ‘GenomicRanges’,
‘lambda.r’, ‘lattice’, ‘lazyeval’, ‘MASS’, ‘Matrix’, ‘Rcpp’, ‘RCurl’,
‘reshape2’, ‘rlang’, ‘scales’, ‘stringi’, ‘SummarizedExperiment’, 'tibble’
Warning message:
In install.packages(pkgs = doing, lib = lib, …) :
installation of package ‘dada2’ had non-zero exit status

Hey @slh277, thanks for following up!

Oh gosh. That’s a new one. Let’s not worry about that right at this moment, but we’ll keep it in mind.

For now, would you be able to run the following:

sysctl -a | grep machdep.cpu.leaf7_features

We’re looking for an entry called “AVX2”.

Thanks!

Hi @ebolyen, Thanks so much!

Ran the following, I do see AVX2 in the output:
(qiime2-2017.12) MacBook-Pro-4:Mumbai sm939$ sysctl -a | grep machdep.cpu.leaf7_features

output:
machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 BMI2 INVPCID FPU_CSDS

1 Like

I am seeing a similar issue, I just updated by pipeline to include the new cutadapt module. This apparently completed fine, before launching into dada2 but on Linux, I wonder if it is the same issue.

Linux ashtaroth 4.13.0-19-generic #22-Ubuntu SMP Mon Dec 4 11:58:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Error from snakemake:

  An error was encountered while running DADA2 in R (return code -11), please inspect stdout and stderr to learn more.

Debug info has been saved to /tmp/qiime2-q2cli-err-dfot2w67.log
Error in job dada2Denoise while creating output files qiime2Artifacts/dada2DenoiseRepSeqs.qza, qiime2Artifacts/dada2DenoiseTable.qza.
RuleException:
CalledProcessError in line 187 of /home/dan/data/16s_data/qiime2-2017.12/Snakefile:
Command 'qiime dada2 denoise-paired --i-demultiplexed-seqs qiime2Artifacts/trimmedPairedEndImport.qza --p-trunc-len-f 265 --p-trunc-len-r 230 --o-representative-sequences qiime2Artifacts/dada2DenoiseRepSeqs.qza --o-table qiime2Artifacts/dada2DenoiseTable.qza > logs/dada2Denoise.log' returned non-zero exit status 1.
  File "/home/dan/data/16s_data/qiime2-2017.12/Snakefile", line 187, in __rule_dada2Denoise
  File "/home/dan/tools/miniconda3/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Will exit after finishing currently running jobs.
Exiting because a job execution failed. Look above for error message

And the entry from /tmp/qiime2-q2cli-err-dfot2w67.log:

R version 3.4.1 (2017-06-30) 
Loading required package: Rcpp
DADA2 R package version: 1.6.0 
1) Filtering .........
2) Learning Error Rates
2a) Forward Reads
Initializing error rates to maximum possible estimate.
Sample 1 - 2701 reads in 1211 unique sequences.

 *** caught segfault ***
address 0x10, cause 'memory not mapped'

Traceback:
 1: .Call("_dada2_dada_uniques", PACKAGE = "dada2", seqs, abundances,     err, quals, score, gap, use_kmers, kdist_cutoff, band_size,     omegaA, max_clust, min_fold, min_hamming, min_abund, use_quals,     final_consensus, vectorized_alignment, homo_gap, multithread,     verbose, SSE)
 2: dada_uniques(names(derep[[i]]$uniques), unname(derep[[i]]$uniques),     err, qi, opts[["SCORE_MATRIX"]], opts[["GAP_PENALTY"]], opts[["USE_KMERS"]],     opts[["KDIST_CUTOFF"]], opts[["BAND_SIZE"]], opts[["OMEGA_A"]],     if (initializeErr) {        1    } else {        opts[["MAX_CLUST"]]    }, opts[["MIN_FOLD"]], opts[["MIN_HAMMING"]], opts[["MIN_ABUNDANCE"]],     TRUE, FALSE, opts[["VECTORIZED_ALIGNMENT"]], opts[["HOMOPOLYMER_GAP_PENALTY"]],     multithread, (verbose >= 2), opts[["SSE"]])
 3: dada(drpsF, err = NULL, selfConsist = TRUE, multithread = multithread,     VECTORIZED_ALIGNMENT = FALSE, SSE = 2)
An irrecoverable exception occurred. R is aborting now ...
Running external command line application(s). This may print messages to stdout and/or stderr.
The command(s) being run are below. These commands cannot be manually re-run as they will depend on temporary files that no longer exist.

Command: run_dada_paired.R /tmp/tmput1r8inm/forward /tmp/tmput1r8inm/reverse /tmp/tmput1r8inm/output.tsv.biom /tmp/tmput1r8inm/filt_f /tmp/tmput1r8inm/filt_r 265 230 0 0 2.0 2 consensus 1.0 1 1000000

Traceback (most recent call last):
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_dada2/_denoise.py", line 179, in denoise_paired
    run_commands([cmd])
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_dada2/_denoise.py", line 35, in run_commands
    subprocess.run(cmd, check=True)
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['run_dada_paired.R', '/tmp/tmput1r8inm/forward', '/tmp/tmput1r8inm/reverse', '/tmp/tmput1r8inm/output.tsv.biom', '/tmp/tmput1r8inm/filt_f', '/tmp/tmput1r8inm/filt_r', '265', '230', '0', '0', '2.0', '2', 'consensus', '1.0', '1', '1000000']' returned non-zero exit status -11

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2cli/commands.py", line 224, in __call__
    results = action(**arguments)
  File "<decorator-gen-354>", line 2, in denoise_paired
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/sdk/action.py", line 228, in bound_callable
    output_types, provenance)
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/sdk/action.py", line 363, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/home/dan/tools/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_dada2/_denoise.py", line 194, in denoise_paired
    " and stderr to learn more." % e.returncode)
Exception: An error was encountered while running DADA2 in R (return code -11), please inspect stdout and stderr to learn more.

This does not fix the issue for me on x86_64 Ubuntu 17.10, despite reinstalling dada2 successfully.

We have just released a patched update to q2-dada2 that appears to fix this :crossed_fingers: . Please follow the instructions here to get your hands on the patch, and please let us know how it goes! Thanks so much for all the support while we were debugging this! :t_rex:

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.