Thanks Duncan, I'll work on reproducibility and possibly getting a core dump... If I get those I'll post to R-dev or RMySQL-dev.
Nick On Wed, Dec 30, 2009 at 9:36 AM, Duncan Murdoch <murd...@stats.uwo.ca>wrote: > On 30/12/2009 9:20 AM, Nick Torenvliet wrote: > >> I got the following after running succesfully through this loop 28 million >> times... the loop opens text files in a directory and inserts line by line >> into a database... >> >> > > This looks like a bug in RMySql or possibly R. What versions are you > using? Can you make it happen reproducibly with the same script? Can you > simplify the script so it happens quickly, rather than requiring 28 million > iterations? Without a simple recipe to reproduce it, I doubt if anyone > would be able to track down the problem. > > Duncan Murdoch > >> *** caught segfault *** >> address 0xc0000010, cause 'memory not mapped' >> >> Traceback: >> 1: .getGeneric(f, where, package) >> 2: getGeneric("coerce", where = where) >> 3: as(obj, "integer") >> 4: mysqlConnectionInfo(dbObj, ...) >> 5: dbGetInfo(conn, "rsId") >> 6: dbGetInfo(conn, "rsId") >> 7: dbListResults(con) >> 8: dbListResults(con) >> 9: mysqlQuickSQL(conn, statement, ...) >> 10: dbGetQuery(con, sql) >> 11: dbGetQuery(con, sql) >> 12: doTryCatch(return(expr), name, parentenv, handler) >> 13: tryCatchOne(expr, names, parentenv, handlers[[1L]]) >> 14: tryCatchList(expr, classes, parentenv, handlers) >> 15: tryCatch(expr, error = function(e) { call <- conditionCall(e) if >> (!is.null(call)) { if (identical(call[[1L]], >> quote(doTryCatch))) call <- sys.call(-4L) dcall <- >> deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") >> LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, >> "\n")[[1L]] if (14L + nchar(dcall, type = "w") + nchar(sm[1L], type >> = >> "w") > LONG) prefix <- paste(prefix, "\n ", sep = >> "") } else prefix <- "Error : " msg <- paste(prefix, >> conditionMessage(e), "\n", sep = "") .Internal(seterrmessage(msg[1L])) >> if (!silent && identical(getOption("show.error.messages"), TRUE)) >> { cat(msg, file = stderr()) >> .Internal(printDeferredWarnings()) } invisible(structure(msg, class >> = >> "try-error"))}) >> 16: try(dbGetQuery(con, sql)) >> 17: eval.with.vis(expr, envir, enclos) >> 18: eval.with.vis(ei, envir) >> 19: source("~/SoothSayer/EODData/DBScripts/loadEODQuotes.r") >> >> Possible actions: >> 1: abort (with core dump, if enabled) >> 2: normal R exit >> 3: exit R without saving workspace >> 4: exit R saving workspace >> Selection: >> >> >> The code is pretty simple... >> >> >> library(RMySQL) >> drv <- dbDriver("MySQL") >> con <- dbConnect(drv, host="localhost", dbname="markets", user="root", >> pass="embryoni3") >> fileList <- list.files(pattern = "[[:upper:]]{2,}", all.files = FALSE, >> full.names = FALSE, recursive = FALSE, ignore.case = FALSE) >> for (x in 1:length(fileList)){ >> string <- strsplit(fileList[x], "_", fixed = TRUE) >> string <- string[[1]][1] >> fileLines <- read.csv(fileList[x],header = FALSE,row.names = NULL ) >> >> for ( j in 1:length(fileLines[,1])){ >> sql <- paste("insert into endOfDayData >> (date,market,symbol,open,high,low,close,volume) values ('", >> >> fileLines[j,2],"','",string,"','",as.character(fileLines[j,1]),"','",fileLines[j,3],"','",fileLines[j,4],"','",fileLines[j >> ,5],"','",fileLines[j,6],"','",fileLines[j,7],"')",sep="") >> #print(sql) >> atmpt <- try(dbGetQuery(con,sql)) >> options(show.error.messages = TRUE) >> if(inherits(atmpt, "try-error")){ >> >> } >> >> } >> >> } >> >> dbDisconnect(con) >> >> My understanding was that in general R liked to put a placekeeper like NA >> or >> NULL in for non-existent elements of defined structures... so I was >> surprised to see a seg fault... I'm having trouble interpretting the >> error... any clues would be appreciated. >> >> Nick >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.