From murdoch at stats.uwo.ca  Sat May 23 17:14:33 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Sat, 23 May 2009 11:14:33 -0400
Subject: [Rd] file descriptor leak in getSrcLines in R 2.10.0 svn 48590
In-Reply-To: <4A16C4C6.8010100@stats.uwo.ca>
References: <77EB52C6DD32BA4D87471DCD70C8D70001336538@NA-PA-VBE03.na.tibco.com>
	<4A16C4C6.8010100@stats.uwo.ca>
Message-ID: <4A1812D9.3000707@stats.uwo.ca>

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



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