Skip to content

Segmentation fault in .Call() (PR#4761)

4 messages · Duncan Temple Lang, Brian Ripley, Jerome Asselin

#
Full_Name: Jerome Asselin
Version: 1.8.0
OS: RedHat Linux 7.2
Submission from: (NULL) (142.103.177.13)



I would not expect a segmentation fault; perhaps an error message.
Segmentation fault

This is always reproducable for me.

Sincerely,
Jerome Asselin
#
jerome@hivnet.ubc.ca wrote:
Thanks for the info.  This should definitely not cause a segfault.
However, the explanation means that the cure is not obvious without
upsetting quite a lot of people.  Let me explain what happens.

Without the PACKAGE argument in the .Call(), we look for the symbol
"log" by walking through the array of previously loaded DLLs/shared
libraries.  Many of the standard packages use registration of the
routines that are to be called by R via the
.C/.Call/.Fortran/.External interaces. However, they also permit the
DLL to be searched using regular dynamic lookup.  This is the default
so as not to break anyone's S code that uses non-registered routines.
And this is what causes the problem!  In my case, we first look in the
methods library (although this is not important) and as for the symbol
"log". And we find it there on Linux.  Precisely why is very much
system-dependent and installation depdenent.  

Peforming the dynamic lookup is the problem.  If everyone were to use
registration, then we could turn this off, but that is a little too
much to ask (currently :-)).  If you had asked for a different symbol
and not something that was in the system libraries, the result would
have been better.

This did reveal a bug in that the base library has the dynamic lookup
turned on which it should not.  Trivial fix in progress.

I doubt too many people will get into this particular situation, so I
am not certain the fix is better than the event of small
probability. Opinions?

Thanks,

 D.

  
    
#
Your expectations are wrong: please re-read the section on BUGS in the
FAQ. It *starts*:

If R executes an illegal instruction, or dies with an operating system
error message that indicates a problem in the program (as opposed to
something like "disk full"), then it is certainly a bug.  If you call
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
yourself (or in a function you wrote), you can always crash R by using
wrong argument types (modes).  This is not a bug.
On Fri, 24 Oct 2003 jerome@hivnet.ubc.ca wrote:

            
So you never learn from your mistakes?


We look forward to receiving your apologies.
2 days later
#
I have reviewed the BUGS section of the FAQ. I did not realise that 
.Call() was an exception in this case.

Please accept my sincere apologies.

Jerome Asselin
On October 24, 2003 11:44 pm, Prof Brian Ripley wrote: