Hi, I'm using R-2.12 on a linux 64bit machine.
When I run a chunk of code inside a foreach() %do% { ...} or %dopar% {...} (with doMC backend) I keep getting a segfault. Running the *same* code within lapply(something, function(x) ... ) doesn't result in any segfaults. I'll paste the output below, but I'm not sure it would be helpful. I'm more curious how to go about smoking out what's causing this, as getting back "into" the code block that is crashing is tricky inside the code block executed by foreach(). If anybody has any suggestions on how they debug with foreach, I'd be happy to hear them. Setting .veborse=TRUE isn't providing anything informative. Anyway, I'll paste the segfault bomb below, followed by sessionInfo() ======== Segfault dump ========== result of evaluating expression: *** caught segfault *** address 0x30, cause 'memory not mapped' Traceback: 1: format(x[[i]], ..., justify = justify) 2: format.data.frame(x, digits = digits, na.encode = FALSE) 3: as.matrix(format.data.frame(x, digits = digits, na.encode = FALSE)) 4: print.data.frame(r) 5: print(r) 6: doTryCatch(return(expr), name, parentenv, handler) 7: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8: tryCatchList(expr, classes, parentenv, handlers) 9: tryCatch({ repeat { args <- nextElem(it) if (obj$verbose) { cat(sprintf("evaluation # %d:\n", i)) print(args) } for (a in names(args)) assign(a\ , args[[a]], pos = envir, inherits = FALSE) r <- tryCatch(eval(expr, envir = envir), error = function(e) e) if (obj$verbose) { cat("result of evaluating expression\ :\n") print(r) } tryCatch(accumulator(list(r), i), error = function(e) { cat("error calling combine function:\n") print(e) NULL }) \ i <- i + 1 }}, error = function(e) { if (!identical(conditionMessage(e), "StopIteration")) stop(simpleError(conditionMessage(e), expr))}) 10: doSEQ(obj, substitute(ex), parent.frame()) 11: foreach(chr = chrs, .packages = "GenomicFeaturesX", .verbose = TRUE) %do% { .gc <- duplicate(gcache, pre.load = NULL) on.exit(dispose(.gc)) cat("===", chr, "===\n") \ apaSummary(expt, .gc, chr, pvd.policy, utr.index, polya.variants, gene.collapse) } 12: apaSummaryCrank(bpm[[1]], gcr, chrs[21:22], gene.collapse = "longest") Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace ============= sessionInfo ============== R version 2.12.0 (2010-10-15) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] grid stats graphics grDevices utils datasets methods [8] base other attached packages: [1] reshape2_1.0 ShortRead_1.8.0 lattice_0.19-13 [4] ggplot2_0.8.8 proto_0.3-8 reshape_0.8.3 [7] doMC_1.2.1 multicore_0.1-3 foreach_1.3.0 [10] codetools_0.2-2 iterators_1.0.3 data.table_1.5.1 [13] plyr_1.2.1 GenomeGraphs_1.10.0 biomaRt_2.6.0 [16] bitops_1.0-4.1 Rsamtools_1.2.0 RSQLite_0.9-2 [19] DBI_0.2-5 Biostrings_2.18.0 GenomicFeaturesX_0.2 [22] GenomicFeatures_1.2.0 GenomicRanges_1.2.1 IRanges_1.8.2 loaded via a namespace (and not attached): [1] annotate_1.28.0 AnnotationDbi_1.12.0 Biobase_2.10.0 [4] BSgenome_1.18.0 hwriter_1.2 RCurl_1.4-3 [7] rtracklayer_1.10.2 stringr_0.4 XML_3.2-0 [10] xtable_1.5-6 -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.