From termcc at googlemail.com  Mon Jul 14 18:40:54 2008
From: termcc at googlemail.com (Tom McCallum)
Date: Mon, 14 Jul 2008 17:40:54 +0100
Subject: [Rd] RODBC Seg Fault
Message-ID: <op.ueajagfbcsmg07@localhost.localdomain>

Hi Everyone,

At the end of this email is a transcript of a problem I have found in  
RODBC version 2.3-1.  It appears that the bug fix in odbcClose for the  
memory leak has meant that the garbage collector is falling over when it  
tries to free up the extPtr attribute of the RODBC connection pointer.

Any advice on how to fix this?

Thanks for your help,

Tom

##---------------------------------------------------------------

platform       i686-pc-linux-gnu
arch           i686
os             linux-gnu
system         i686, linux-gnu
status
major          2
minor          7.1
year           2008
month          06
day            23
svn rev        45970
language       R
version.string R version 2.7.1 (2008-06-23)

##---------------------------------------------------------------

Run using the command
$ R -d gdb

##---------------------------------------------------------------

Starting program: /usr/local/lib/R/bin/exec/R

R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

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.

[Previously saved workspace restored]

> library("RODBC")
[Thread debugging using libthread_db enabled]
[New Thread -1208248640 (LWP 14060)]
Error while reading shared library symbols:
Cannot find new threads: generic error
> gctorture(TRUE)
> for(i in 1:10) { print(i); conn <- odbcConnect("***", "***", "***");  
> print(conn); odbcClose(conn) }
[1] 1
RODB Connection 2
Details:
   case=nochange
   DSN=***
   UID=***
   PWD=***
[1] 2
RODB Connection 3
Details:
   case=nochange
   DSN=***
   UID=***
   PWD=***
[1] 3

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208248640 (LWP 14060)]
0x08059036 in R_ClearExternalPtr (s=0x0) at memory.c:2445
2445    memory.c: No such file or directory.
         in memory.c
(gdb) bt
#0  0x08059036 in R_ClearExternalPtr (s=0x0) at memory.c:2445
#1  0x006b17cb in inRODBCClose (thisHandle=0x8c1f358) at RODBC.c:1250
#2  0x006b190d in chanFinalizer (ptr=0x9100380) at RODBC.c:1271
#3  0x0805b6eb in R_RunWeakRefFinalizer (w=0x90da4f8) at memory.c:1062
#4  0x0805b810 in RunFinalizers () at memory.c:1107
#5  0x0805cf17 in R_gc_internal (size_needed=1) at memory.c:2205
#6  0x0805da69 in Rf_allocVector (type=16, length=1) at memory.c:1968
#7  0x006b3955 in RODBCDriverConnect (connection=0x90b0208, id=0x90b0288,  
useNRows=0x90b02c8) at RODBC.c:277
#8  0x08161a19 in do_dotcall (call=0x89b9ba8, op=0x85518dc, args=<value  
optimized out>, env=0x9100e44) at dotcode.c:863
#9  0x0818683f in Rf_eval (e=0x89b9ba8, rho=0x9100e44) at eval.c:489
#10 0x0818a628 in do_set (call=0x89b9b1c, op=0x8546120, args=<value  
optimized out>, rho=0x9100e44) at eval.c:1424
#11 0x08186621 in Rf_eval (e=0x89b9b1c, rho=0x9100e44) at eval.c:463
#12 0x0818737f in do_begin (call=0x89ba260, op=0x8547788, args=0x89b9b00,  
rho=0x9100e44) at eval.c:1176
#13 0x08186621 in Rf_eval (e=0x89ba260, rho=0x9100e44) at eval.c:463
#14 0x08188a15 in Rf_applyClosure (call=0x89bbda4, op=0x89bac60,  
arglist=0x9100bf8, rho=0x9100a38, suppliedenv=0x855a084) at eval.c:669
#15 0x081864da in Rf_eval (e=0x89bbda4, rho=0x9100a38) at eval.c:507
#16 0x0818737f in do_begin (call=0x89bb90c, op=0x8547788, args=0x89bbd88,  
rho=0x9100a38) at eval.c:1176
#17 0x08186621 in Rf_eval (e=0x89bb90c, rho=0x9100a38) at eval.c:463
#18 0x08188a15 in Rf_applyClosure (call=0x8e5bcd0, op=0x89bcc80,  
arglist=0x9100894, rho=0x855a068, suppliedenv=0x855a084) at eval.c:669
#19 0x081864da in Rf_eval (e=0x8e5bcd0, rho=0x855a068) at eval.c:507
#20 0x0818a628 in do_set (call=0x8e5ba30, op=0x8546120, args=<value  
optimized out>, rho=0x855a068) at eval.c:1424
#21 0x08186621 in Rf_eval (e=0x8e5ba30, rho=0x855a068) at eval.c:463
#22 0x0818737f in do_begin (call=0x8e5991c, op=0x8547788, args=0x8e597e8,  
rho=0x855a068) at eval.c:1176
#23 0x08186621 in Rf_eval (e=0x8e5991c, rho=0x855a068) at eval.c:463
#24 0x08189fb3 in do_for (call=0x8e59820, op=0x8536d78, args=0x8e59938,  
rho=0x855a068) at eval.c:1075
#25 0x08186621 in Rf_eval (e=0x8e59820, rho=0x855a068) at eval.c:463
#26 0x080587e0 in Rf_ReplIteration (rho=0x855a068, savestack=0,  
browselevel=0, state=0xbf833d28) at main.c:257
#27 0x08058b4a in R_ReplConsole (rho=0x855a068, savestack=0,  
browselevel=0) at main.c:306
#28 0x08058e28 in run_Rmainloop () at main.c:967
#29 0x08056731 in main (ac=Cannot access memory at address 0x0
) at Rmain.c:35



[Rd] RODBC Seg Fault
Tom McCallum