splitstackshape:::read.concat may open too many textConnections
gagolews opened this issue · comments
Referring to http://stackoverflow.com/questions/23528882, it seems that splitstackshape:::read.concat
may sometimes open too many textConnection
s at a time.
According to ?connections
, A maximum of 128 connections can be allocated.
@gagolews, thanks for the bug report. Didn't see that one on SO. Will try to look into it soon, but I'm also thinking of moving my efforts on this package in an entirely different direction. (See: https://gist.github.com/mrdwab/11380733).
👍
Possible fix with 4e509b9, but not ready to close until I can recreate the error in some way.
Hmmm... I cannot reproduce the error too, even with this:
# using splitstackshape from CRAN
library(splitstackshape)
x <- "a"
n <- 124 # 124 files + stderr+stdout+stdin == 127 == 2 slots left
cons <- vector("list", n)
for (i in 1:n)
cons[[i]] <- file("~/.bash_history", "r")
print(showConnections(TRUE))
for (i in 1:10000)
splitstackshape:::read.concat(x, "", "")
for (i in 1:n)
close(cons[[i]])
It seems that the connection closes automatically on gc, and the gcollector is fired very often (R 3.0.2, Linux, I played with gcinfo(TRUE)
).
Maybe the StackOverflow guy just opened too many file connections himself and forgot to close them?
But closing a textConnection object causes no harm anyway :)
Closed because have not been able to reproduce error.