views:

66

answers:

1

I'm running R via Rpy on a redhat linux distribution. Periodically I'll encounter this error message:

*** caught segfault ***
address (nil), cause 'unknown'

And the entire program dies right there. It usually occurs when I run a lot of regression r.lm(). But by simply running the identical code again, the problem may or may not go away (so not always reproduceable). Does anyone know what might be causing this, and/or how I can prevent it from happening?

+1  A: 

There are a few possibilities.

  1. The problem is with the R code. To test this, run the code in R itself and see if you can replicate the issue.

  2. The problem is with Rpy. Run the program in a debugger and see what exactly you are passing from Python to R and from R to Python. At a guess, you have some kind of variable mismatch that only occurs under some conditions.

  3. The problem is with the environment. Does some other software need to be loaded for the progam to run? Does it work once then fail when you run it again? (Perhaps you aren't closing a connection to a file?) Does it fail on other people's machines or just yours?

  4. The problem is with the data. Are you randomly generating anything? That would explain the intermittent nature of the problem.

If you're still stuck, read some tips on debugging.

Richie Cotton