[R-sig-DB] PostgreSQL killed on dbDisconnect (RPostgreSQL)
McGehee, Robert
Robert@McGehee @end|ng |rom geodec@p|t@|@com
Tue Feb 12 16:05:31 CET 2013
Hi,
Has anyone had an issue where a PostgreSQL connection was forcibly killed (SIGKILL) by RPostgreSQL, causing a full database crash/recovery/restart?
This seems to happen about twice a week when a RPostgreSQL connection is closed using dbDisconnect (or when an R session ends) while other queries are running. The Linux OOM killer is not enabled on this server and I can find no evidence of hardware problems or any evidence of problems with the PostgreSQL database. This left me to wonder if there was a problem with the way RPostgreSQL (or R) disconnects that causes the database crash.
I generally interface with RPostgreSQL inside a function like this:
FUN <- function() {
conn <- dbConnect(dbDriver("PostgreSQL"), host="xx", user="xx", password="xx", dbname="xx")
on.exit(dbDisconnect(conn), add=TRUE)
dbGetQuery("SELECT 1;", conn=conn)
}
I found record of a similar problem with the RpgSQL package here (from 2009):
https://stat.ethz.ch/pipermail/r-help/2009-January/184707.html
which indicates that dbDisconnect() caused a crash under similar circumstances in RpgSQL. However, in this case there was a crash in R; in my case there is a crash in PostgreSQL (and it's a different package).
Has anyone else had a problem like this with RPostgreSQL or know if it is even possible for RPostgreSQL to send a SIGKILL signal to a PostgreSQL connection? I'm reluctant to remove dbDisconnect everywhere, as I don't want zombie connections accumulating. Also, I'm not the only user of the database.
Thanks, Robert
More information about the R-sig-DB
mailing list