Hi All,
Can anyone help me please?I don't know much about segmentation faults.I
understand what it is,but why my script's throwing the error i don't know.

This is my main function:----

*main<-function()*

*{*

*                dbName<-"xyz_database"*

*                hostName<-"xyz.com"*

*                con<-myDbconnect(dbName,hostName) *

*                *

*                #Fetching exact sub group names*

*                sub_grp_exact_num<-getSbGrpExactNum(con)*

*                sub_grp_exact_num_data<-sub_grp_exact_num$matrix*

*                sub_grp_exact_num_data_size<-sub_grp_exact_num$dim*

                there's is some other code following the above....i thought
this much code is enough to explain my problem......error occurs when the
myDbconnect function is called at teh third line
**

*}*

myDbconnect  function is here:--

*myDbconnect<-function(dbName, hostName)*

*{*

*                print("myDbconnect ")*

*                drv<-MySQL()*

*                #print(drv)*


*                con <- dbConnect(drv, user="xyz", password="xyz",dbname =
dbName, host = hostName)*

*                #return(con)*

*}*

When  print("myDbconnect print") is the first line of the myDbconnect
function  "myDbconnect print" gets printed.Though followed by  error
messages,shown below:-----------------

*> source("new_regression.R")*

*Loading required package: DBI*

*[1] "myDbconnect print"*

* *** caught segfault ****

*address 0x55, cause 'memory not mapped'*

* *

*Traceback:*

* 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",
"dbConnect")*

* 7: dbConnect(drv, user = "xyz", password = "xyz", dbname = dbName,     host
= hostName)*

* 8: myDbconnect(dbName, hostName)*

* 9: main()*

*10: eval.with.vis(expr, envir, enclos)*

*11: eval.with.vis(ei, envir)*

*12: source("new_regression.R")*

* *

*Possible actions:*

*1: abort (with core dump)*

*2: normal R exit*

*3: exit R without saving workspace*

*4: exit R saving workspace*

*Selection:*

Now  if I change the position of the print statement  from first line to
fourth line after  dbConnect function:------

myDbconnect<-function(dbName, hostName)

{

                drv<-MySQL()

                #print(drv)

                con <- dbConnect(drv, user="xyz", password="xyz",dbname =
dbName, host = hostName)

                print("myDbconnect  print")

#return(con)

}

In this case the text  ("myDbconnect  print") is not printed ,otherwise what
I see is same as above i.e.:--

> source("new_regression.R")

Loading required package: DBI

*** caught segfault ***

address 0x55, cause 'memory not mapped'

Traceback:

 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",
"dbConnect")

 7: dbConnect(drv, user = "xyz", password = "xyz", dbname = dbName,     host
= hostName)

 8: myDbconnect(dbName, hostName)

 9: main()

10: eval.with.vis(expr, envir, enclos)

11: eval.with.vis(ei, envir)

12: source("new_regression.R")



Possible actions:

1: abort (with core dump)

2: normal R exit

3: exit R without saving workspace

4: exit R saving workspace

Selection:

*CONCLUSION:-- So the problem arises in the* *dbconnect function* *inside
myDbconnect  function.*

*i.e this line :--*

con <- dbConnect(drv, user="xyz", password="xyz",dbname = dbName, host =
hostName)

It's a segfault. A segmentation fault occurs when a program *attempts to
access a memory location that it is not allowed to access*, or *attempts to
access a memory location in a way that is not allowed* (for example,
attempting to write to a read-only location, or to overwrite part of the
operating system).Don't understand how I am trying to do any of these
incorrect operations.

Moreover  *traceback()  *is a function in R that is used for debugging ;
prints the call stack of the last uncaught error, i.e., the sequence of
calls that lead to the error.I have not used it anywhere in  my script
but  still
it shows the errors.



P.S:--- I  found these links,buti don't understand,where am I going wrong
:--

http://tolstoy.newcastle.edu.au/R/e2/devel/06/12/1436.html

http://www.ens.gu.edu.au/ROBERTK/R/HELP/00a/0111.HTML

http://tolstoy.newcastle.edu.au/R/e2/devel/06/12/1438.html


Any help is welcome..Even if anybody doesn't know to solve the problem,is
there anyother way ,i can get some more information,out of my script
regarding the cause of the error.do i need to make any changes,somewhere
else other than the script,to get rid of this problem.

-- 
Thanks in advance
Moumita


-- 
Thanks
Moumita

	[[alternative HTML version deleted]]


