[R-SIG-Mac] Segfault with rWishart in R 2.15.1

Michael Braun braunm at mit.edu
Wed Jul 4 03:12:07 CEST 2012


I just upgraded to R 2.15.1, and I am getting a segmentation fault when using the rWishart function (from the stats package) to sample moderately-size matrices.

Here is the output when I run R within gdb.  720 appears to be the dimensionality cut-off.  Anything smaller works fine.  Anything larger crashes.

> x=rWishart(1,700,diag(700)) // this works
> x=rWishart(1,720,diag(720))
Error: C stack usage is too close to the limit
> x=rWishart(1,722,diag(722))

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3fff88
0x00007fff88b9c68b in __vfprintf ()
(gdb) bt
#0  0x00007fff88b9c68b in __vfprintf ()
#1  0x00007fff88b9c18e in vfprintf_l ()
#2  0x00007fff88ba52d0 in printf ()
#3  0x0000000100198619 in Rstd_WriteConsoleEx (
    buf=<value temporarily unavailable, due to optimizations>, 
    len=<value temporarily unavailable, due to optimizations>, 
    otype=<value temporarily unavailable, due to optimizations>)
    at ../../../../R-2.15.1/src/unix/sys-std.c:963
#4  0x00000001001497b7 in REvprintf (format=0x100253820 "%s", 
    arg=0x7fff5f4029f0) at ../../../../R-2.15.1/src/main/printutils.c:813
#5  0x0000000100149a02 in REprintf (
    format=<value temporarily unavailable, due to optimizations>)
    at ../../../../R-2.15.1/src/main/printutils.c:698
#6  0x0000000100099e45 in verrorcall_dflt (call=0x10080db78, 
    format=0x10025b9d8 "C stack usage is too close to the limit", 
    ap=0x7fff5f408cc0) at ../../../../R-2.15.1/src/main/errors.c:656
#7  0x000000010009a86e in Rf_errorcall (call=0x10080db78, 
    format=0x10025b9d8 "C stack usage is too close to the limit")
    at ../../../../R-2.15.1/src/main/errors.c:698
#8  0x000000010009c95c in R_CheckStack ()
    at ../../../../R-2.15.1/src/main/errors.c:93
#9  0x0000000102704e80 in R_rWishart ()
#10 0x000000010007af0c in do_dotcall (call=0x102f63710, 
---Type <return> to continue, or q <return> to quit---
    op=<value temporarily unavailable, due to optimizations>, 
    args=<value temporarily unavailable, due to optimizations>, 
    env=<value temporarily unavailable, due to optimizations>)
    at ../../../../R-2.15.1/src/main/dotcode.c:543
#11 0x00000001000a128f in bcEval (
    body=<value temporarily unavailable, due to optimizations>, 
    rho=0x103df1140, 
    useCache=<value temporarily unavailable, due to optimizations>)
    at ../../../../R-2.15.1/src/main/eval.c:4442
#12 0x00000001000aa1f5 in Rf_eval (e=0x102f63748, rho=0x103df1140)
    at ../../../../R-2.15.1/src/main/eval.c:397
#13 0x00000001000af5d1 in Rf_applyClosure (call=0x103df0b58, op=0x102f62470, 
    arglist=0x103df0df8, rho=0x10085b6a8, suppliedenv=0x10085b6e0)
    at ../../../../R-2.15.1/src/main/eval.c:859
#14 0x00000001000aa402 in Rf_eval (e=0x103df0b58, rho=0x10085b6a8)
    at ../../../../R-2.15.1/src/main/eval.c:510
#15 0x00000001000ad705 in do_set (call=0x103df0c38, op=0x100832030, 
    args=0x103df0c00, rho=0x10085b6a8)
    at ../../../../R-2.15.1/src/main/eval.c:1715
#16 0x00000001000aa4ec in Rf_eval (e=0x103df0c38, rho=0x10085b6a8)
    at ../../../../R-2.15.1/src/main/eval.c:466
#17 0x00000001000e3822 in Rf_ReplIteration (rho=0x10085b6a8, savestack=0, 
    browselevel=<value temporarily unavailable, due to optimizations>, 
---Type <return> to continue, or q <return> to quit---
    state=0x7fff5fbfe7d0) at ../../../../R-2.15.1/src/main/main.c:256
#18 0x00000001000e3b11 in R_ReplConsole (rho=0x10085b6a8, savestack=0, 
    browselevel=0) at ../../../../R-2.15.1/src/main/main.c:305
#19 0x00000001000e4020 in run_Rmainloop ()
    at ../../../../R-2.15.1/src/main/main.c:987
#20 0x0000000100000eeb in main ()

Here is my sessionInfo() output.  I am running R on a brand new (as in, yesterday) Macbook Pro.  This is the CRAN binary version.  I did not link to an optimized BLAS on this computer (yet).  However, I did try this on my office computer (Mac Pro) that I compiled from source, linking to Intel MKL, and that also crashes around k=722.  

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> 

Anyway, since R is segfaulting on a brand new computer, I thought you would like to know.

Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1579 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20120704/88a80332/attachment.bin>


More information about the R-SIG-Mac mailing list