[R] debug an error that incapacitates R?

Brian Diggs diggsb at ohsu.edu
Mon Dec 14 22:55:39 CET 2009


> -----Original Message-----
> From: Liviu Andronic [mailto:landronimirc at gmail.com]
> Sent: Sunday, December 13, 2009 4:05 AM
> To: Duncan Murdoch
> Cc: r-help at r-project.org Help
> Subject: Re: [R] debug an error that incapacitates R?
> 
> Hello
> And thank you for the quick answer.
> 
> On 12/13/09, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> >  I think you need to go back to old-fashioned debugging methods.
> > Identify
> > the line the triggers the error, by using debug() and single stepping
> > through sosInit(), or by adding print() or cat() statements to it (or
> > setting tracepoints with trace()), and seeing how many succeed before
> > things
> > go bad.
> >
> Experimenting with browser() and subsequently with the step-through
> debug() I managed to identify the first line that triggers the
> "invalid connection" error:
> doItAndPrint(paste("## Launching RSiteSearch, please be patient.."))

I have seen this "invalid connection" type error when there is a sink()
active that does not have a valid connection associated with it.  In that
case, any output generates the error.  Try issuing sink() commands (without
any arguments) to remove any active sinks.  When there are not any more 
sinks you will get the message:

Warning message:
In sink() : no sink to remove

> >  Once you see the bad line, it may be obvious what's wrong with it,
> > or you
> > may need to ask for help, by putting together a minimal example that
> > triggers it.
> >
> Unfortunately, there is nothing obviously wrong with the call, nor
> with the environment. Omitting the line makes the function work in all
> my test cases. I will contact John Fox on this.

If it is an invalid sink, this would just be the first call that generates
output.  It would be a sink somewhere before that that is setting up a bad
connection (which doesn't cause problems until something is to be written).

> Thank you
> Liviu
> 

--
Brian Diggs, Ph.D.
Senior Research Associate, Department of Surgery, Oregon Health & Science University






More information about the R-help mailing list