[Rd] file descriptor leak in getSrcLines in R 2.10.0 svn 48590

Duncan Murdoch murdoch at stats.uwo.ca
Sat May 23 17:14:33 CEST 2009


On 22/05/2009 11:29 AM, Duncan Murdoch wrote:
> On 5/21/2009 2:17 PM, William Dunlap wrote:
>> I noticed the following file descriptor leak when I couldn't remove
>> a package unless I shut down the R session that had loaded and
>> used it.  The function that triggered the problem printed the output
>> of a call to parse().  Each time one prints a srcref a connection is
>> opened and not closed.  It looks like it happens in
>> as.character.srcref's
>> call to getSrcLines, which has some logic I don't understand about
>> closing 'srcfile' on exit only if !.is.Open(srcfile):
> 
> I have a simpler recipe to reproduce the crash now:
> 
> tf <- tempfile()
> con <- file(tf, open="w", encoding="unknown")
> 
> This gives an error message about an unsupported conversion
> and leaves the con object only partially built. closeAllConnections() 
> will then crash.
> 
> Should be relatively easy to fix...I'll take a look.

Fixed now in R-devel and R-patched.

Duncan Murdoch



More information about the R-devel mailing list