[R] Segfault in pure R code

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Dec 12 22:01:31 CET 2006


Göran Broström wrote:
> I just caught a segfault:
>
>   
>> courses("Ingrid")
>>     
>
>  *** caught segfault ***
> address 0x99b279c, cause 'memory not mapped'
>
> Traceback:
>  1: structure(y, class = oldClass(x), row.names = attr(x, "row.names"))
>  2: `[.data.frame`(gudata, -(1:5))
>  3: gudata[-(1:5)]
>  4: names(gudata[-(1:5)])
>  5: inherits(x, "factor")
>  6: is.factor(table)
>  7: match(x, table, nomatch = 0)
>  8: who %in% names(gudata[-(1:5)])
>  9: courses("Ingrid")
>
> when running a function 'courses' in an R package without compiled
> code. Is this "possible"? I have got many segfaults when testing my
> own packages, but it has always been caused by stupidities in C or
> Fortran code, never with pure R code.
>
> So, before I start debugging, I'd like to know if a segfault in pure R
> code indicates  a bug in R itself, or if it can be in my function?
>
>   
By definition, reproducible segfaults in R code are bugs in R, unless 
caused by abuse of .C calls or similar. (Irreproducible ones are often 
hardware faults.)

However, at least presently, you are the only one with a handle on the 
bug. So either you get to do the debugging or you have to provide 
something that others can reproduce.

Astarting point could be to run R under the debugger (R -d gdb)  and 
generate a C backtrace, then look at the variables involved.

(Further discussion should probably go on r-devel instead of r-help).

-p
 
> I have used 'courses' many times before without problems.
>
> Thanks,
>
> Göran
> ++++++++++++++++++++++++++++++++++++++
>   
>> sessionInfo()
>>     
> R version 2.4.0 Patched (2006-10-29 r39744)
> i686-pc-linux-gnu
>
>
>



More information about the R-help mailing list