[R] segfault in RMySQL dbConnect error handling

Alex Brown alex at transitive.com
Mon Nov 13 16:57:22 CET 2006

Hi there.  I see in a post from 2002 that you got the following  
problem with RMySQL:
 > con <- dbConnect(m)

Process R segmentation fault at Wed Aug 28 08:21:11 2002

I have the same problem today:


dbConnect(drv) # or with pretty much any other failing options

Program received signal SIGSEGV, Segmentation fault.
0x00002b28d60c9fa0 in strlen () from /lib/libc.so.6
(gdb) bt
#0  0x00002b28d60c9fa0 in strlen () from /lib/libc.so.6
#1  0x00002b28d609c7f4 in vfprintf () from /lib/libc.so.6
#2  0x00002b28d60b6a69 in vsprintf () from /lib/libc.so.6
#3  0x00002b28d60a1f76 in sprintf () from /lib/libc.so.6
#4  0x00002b28d7f66b1b in ?? ()
#5  0x0000000000fbda01 in ?? ()
#6  0x000000000000a285 in ?? ()
#7  0x00000000011eda68 in ?? ()
#8  0x0000000000d982a0 in ?? ()
#9  0x0000000000000000 in ?? ()

(gdb) info regi
rax            0x8d     141
rbx            0x1      1
rcx            0x3      3
rdx            0x7fffff9ccb08   140737481853704
rsi            0x2b28d7f67f01   47454421942017 (argument 2)  
"nrecognised R/S type for group"
rdi            0x8d     141 (argument 1)
rbp            0x7fffff9cc990   0x7fffff9cc990
rsp            0x7fffff9cc2f8   0x7fffff9cc2f8

(gdb) c

*** caught segfault ***
address 0x8d, cause 'memory not mapped'

1: .Call("RS_MySQL_newConnection", drvId, con.params, groups,  
default.file,     PACKAGE = .MySQLPkgName)
2: mysqlNewConnection(drv, ...)
3: .class1(object)
4: .class1(object)
5: is(object, Cl)
6: .valueClassTest(standardGeneric("dbConnect"), "DBIConnection",      
7: dbConnect(drv)

Possible actions:
1: abort (with core dump)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
It appears that it is crashing while handling an error relating to  
the database.

If I give it parameters which allow it to connect, it does not segfault.

System information:

XEON x86_64 with VT

Ubuntu 6.06.1 LTS \n \lRN)

MySQL 5.0.22-Debian_0ubuntu6.06.2-log

R 2.4.0 R version 2.4.0 (2006-10-03) from deb http://cran.R- 
project.org/bin/linux/ubuntu dapper/

It's a pristine 2.4.0 R install with the following libraries:

DBI_0.1-11.tar.gz  RMySQL_0.5-10.tar.gz

installed in a custom library location /export/downloads/R/packages

(normal location seems to behave the same)

note: it also failed on 2.3.0 on this machine

--Alex Brown

More information about the R-help mailing list