Skip to content

unmapped memory core dump with pure R program?

10 messages · ivo welch, Simon Urbanek, Dirk Eddelbuettel

#
On 13 July 2013 at 22:24, ivo welch wrote:
| dear R developers---I am running a pure R program on the stock binary
| debian (ubuntu) 64-bit linux distribution, 3.0.1.  for identification,
[...]
| recurse some.  I don't have symbols in my R binary, so the location may not
| be useful, but I thought I would let you guys know.  

You can install the 'r-base-core-dbg' package [1] to get the (stripped)
debugging symbols back.

Dirk

[1] Quite generally, on Debian/Ubuntu, for package $xys the corresponding
    $xyz-dbg contains the corresponding debugging symbols.
#
On Jul 14, 2013, at 10:51 AM, ivo welch wrote:

            
R should not segfault, so we're interested, but we will need a reproducible example.
That said, R-devel has quite a few new bugfixes, so I'd suggest that you may want to replicate it there first.

Cheers,
Simon
#
On 14 July 2013 at 09:04, ivo welch wrote:
| thanks, simon.  it's replicable even on
| 
|    R version 3.0.1 Patched (2013-07-13 r63293) -- "Good Sport"
| 
| (I presume that it is loading its own updated dynamic libraries when I
| installed it in a temporary directory and am invoking it as
| "temp/R-patched/bin/R", and not the system-wide unpatched version.)  the

It "should" stay within its own tree. I call my r-devel builds with a
two-line shell script wrapper to make sure its bin/ directory is prefixed to
the $PATH. 

| program that causes it is small enough to be displayable
| 
| if (interactive()) options(error=recover)
| year <- 1982
| 
| for (yr in (year-6):year) {
|     ifname <- paste0("dbetas/dbetas-",yr, ".Rdata")

That is obviously NOT reproducible as we do not have your files.

If possible, please create a _self-contained reproducible script_ as it ought
to be possible to create such data matrices with random data.

Dirk

|     load(ifname)
|     print(head(dbetas,2))  ## if you remove this, then the core dump goes
| away
|     dm <- if (!exists("dm")) dbetas else rbind(dm, dbetas)
|     cat("[Loaded ", yr,"]\n")
| }
| cat("\n[", now(), "Loaded All Data]\n")
| 
| 
| Reproducing the error,
| 
| # r-devel/R-patched/bin/R --vanilla
| 
| R version 3.0.1 Patched (2013-07-13 r63293) -- "Good Sport"
| Copyright (C) 2013 The R Foundation for Statistical Computing
| Platform: x86_64-unknown-linux-gnu (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.
| 
| > source("coredump.R")
|       permno yyyymmdd lagmval        beta
| 31303  10006 19760102  219450 -0.81162794
| 31304  10006 19760105  218025 -0.01280477
| [Loaded  1976 ]
|       permno yyyymmdd  lagmval       beta
| 31556  10006 19770103 304709.4  4.5770379
| 31557  10006 19770104 301456.2 -0.3810519
| [Loaded  1977 ]
|       permno yyyymmdd  lagmval     beta
| 31808  10006 19780103 301219.5 1.277823
| 31809  10006 19780104 296854.0 2.671327
| [Loaded  1978 ]
|       permno yyyymmdd  lagmval        beta
| 32060  10006 19790102 269308.5 -0.06000999
| 32061  10006 19790103 269308.5 -0.83697042
| [Loaded  1979 ]
|       permno yyyymmdd  lagmval       beta
| 32313  10006 19800102 303420.8 -0.3768525
| 32314  10006 19800103 305635.5  2.2475787
| Error in rbind(deparse.level, ...) :
|   'pairlist' object cannot be coerced to type 'double'
| 
| Enter a frame number, or 0 to exit
| 
| 1: source("coredump.R")
| 2: withVisible(eval(ei, envir))
| 3: eval(ei, envir)
| 4: eval(expr, envir, enclos)
| 5: coredump.R#8: rbind(dm, dbetas)
| 6: rbind(deparse.level, ...)
| 
| Selection: 6
| Called from: eval(substitute(browser(skipCalls = skip), list(skip = 7 -
| which)),
|     envir = sys.frame(which))
| Browse[1]> head(dm)
|       permno yyyymmdd lagmval        beta
| 31303  10006 19760102  219450 -0.81162794
| 31304  10006 19760105  218025 -0.01280477
| 31305  10006 19760106  218025  7.26041268
| 31306  10006 19760107  236550 -1.23044474
| 31307  10006 19760108  235125  3.02461687
| 31308  10006 19760109  239400  2.04868169
| Browse[1]> head(rbind(dm,dbetas))
| 
|  *** caught segfault ***
| address 0x10, cause 'memory not mapped'
| 
| Traceback:
|  1: rbind(deparse.level, ...)
|  2: rbind(dm, dbetas)
|  3: head(rbind(dm, dbetas))
|  4: eval(expr, envir, enclos)
|  5: eval(substitute(browser(skipCalls = skip), list(skip = 7 - which)),
| envir = sys.frame(which))
|  6: (function () {    if (.isMethodsDispatchOn()) {        tState <-
| tracingState(FALSE)        on.exit(tracingState(tState))    }    calls <-
| sys.calls()    from <- 0L    n <- length(calls)    if
| (identical(sys.function(n), recover))         n <- n - 1L    for (i in
| rev(seq_len(n))) {        calli <- calls[[i]]        fname <- calli[[1L]]
|      if (!is.na(match(deparse(fname)[1L], c("methods::.doTrace",
|   ".doTrace")))) {            from <- i - 1L            break        }    }
|    if (from == 0L)         for (i in rev(seq_len(n))) {            calli <-
| calls[[i]]            fname <- calli[[1L]]            if (!is.name(fname)
| || is.na(match(as.character(fname),                 c("recover", "stop",
| "Stop")))) {                from <- i                break            }
|    }    if (from > 0L) {        if (!interactive()) {
|  try(dump.frames())            cat(gettext("recover called
| non-interactively; frames dumped, use debugger() to view\n"))
|  return(NULL)        }        else if
| (identical(getOption("show.error.messages"),             FALSE))
|   return(NULL)        calls <- limitedLabels(calls[1L:from])        repeat
| {            which <- menu(calls, title = "\nEnter a frame number, or 0 to
| exit  ")            if (which)
| eval(substitute(browser(skipCalls = skip), list(skip = 7 -
|   which)), envir = sys.frame(which))            else break        }    }
|  else cat(gettext("No suitable frames for recover()\n"))})()
|  7: rbind(deparse.level, ...)
|  8: rbind(dm, dbetas)
|  9: eval(expr, envir, enclos)
| 10: eval(ei, envir)
| 11: withVisible(eval(ei, envir))
| 12: source("coredump.R")
| 
| Possible actions:
| 1: abort (with core dump, if enabled)
| 2: normal R exit
| 3: exit R without saving workspace
| 4: exit R saving workspace
| Selection:
| 
| 
| the data files used are about 60mb.  this is all happening on a home
| machine, which is not easy to ssh into.  however, I can bring it into the
| office and see if I can replicate it there, too.  if I can, I could put it
| up and give you an account on my machine.  or I can tar it up incl the data
| and put it somewhere for download.  whatever you prefer.
| 
| regards,
| 
| /iaw
| ----
| Ivo Welch (ivo.welch at gmail.com)
| 
| 	[[alternative HTML version deleted]]
| 
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel
#
On 14 July 2013 at 11:45, ivo welch wrote:
| hi dirk---look, it's a fickle bus segfault. ?if you read my email in full, you
| will note that even eliminating an irrelevant print(head()) statement makes it
| go away. ?we are lucky it is reproducible and thus easy to track down for
| whoever wrote the code, given my code AND the data, of course. ?(maybe it
| could do with me trying to create data that are random, maybe not. ?but there
| is no point to me doing so. ?if we have the bug reproducible, we should chase
| it down when we know it appears.) ?I know that you cannot reproduce it from
| what I have posted. ?I also wrote that I will bring the tarball (with the
| files) into my office tomorrow to see if I can make it remotely available to
| simon or you, if you are interested.
| 
| I am trying to help...it did take me a day to reduce the code to figure out
| what went wrong,, and an hour to get it to this point where it is easily
| understandable, reproducible, and digestable by you.

Well your comment notwithstanding I actually had read your code snippet and
concluded that at least your initial report was wrong (as you blamed rbind,
not head which the comment now blames) but I have never made any promises to
debug this -- R memory internals requires sturdier souls than mine.

Rather, I was trying to explain to you that if you want your "so far non-bug
as not reproducible" report to have any effect, you have to give those whose
time you expect to be devoted to this at least the commonly required inputs
to be able to replicate the issue.  And no, the offer to supply 60gb of data
does not commonly count as a suitable offer.  A reproducible script might.

Dirk
1 day later
#
On 14 July 2013 at 12:57, ivo welch wrote:
| hi dirk---it is not 100% clear what causes it. ?it is a segfault. ?the bug
| does not show up at the head command. ?it shows up at a different place, but
| removing an unrelated print(head()) command means the bug does not appear
| later.
| 
| it weighs in at about 280MB. ?I will make it available to simon on Monday,
| after verifying first that I can replicate it on another computer in my office.

So what ever happened?  Replicable or not?

Dirk