From murdoch.duncan at gmail.com  Fri Sep  3 13:42:01 2010
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 03 Sep 2010 07:42:01 -0400
Subject: [Rd] Weird erratic error and illogical error message,
 could someone explain this?
In-Reply-To: <4C80B1FA.9060403@sciviews.org>
References: <4C80B1FA.9060403@sciviews.org>
Message-ID: <4C80DF09.9030805@gmail.com>

Philippe Grosjean wrote:
> Hello,
>
> It's several days I try to track this bug, and even cannot cook a 
> reproducible example. Yet, it occurs consistently in a long-running task 
> after a variable period of time. Here is an example:
>   

I would look closely at the other software that is running in your long 
example.  Does it include C (or other external) code?  Look closely at 
that, it might be writing outside it's own allocated memory.  Also check 
for correct protection of intermediate results, if you're producing 
SEXPs in the external code.  (Running under gctorture might flush out 
the bug more quickly if the latter is the problem.)

If you're only running R code, then this looks like a bug in R, but it 
might still be worth trying gctorture to make it reproducible.  We won't 
be able to fix it if we can't reproduce it.

Duncan Murdoch
> ... my long-running code [as I said, cannot give something simple
> that produces this bug in a reproducible manner]
>
> Error in match(x, table, nomatch = 0L) :
>      formal argument "nomatch" matched by multiple actual arguments
>  > traceback()
> 6: match(x, table, nomatch = 0L)
> 5: "factor" %in% attrib[["class", exact = TRUE]]
> 4: structure(.Internal(Sys.time()), class = c("POSIXt", "POSIXct"))
> 3: Sys.time()
> 2: chemTrigger() at chemostat_1.0-1.R#1132
> 1: chemRun()
>
> So, the culprid is a call inside `%in%` (from within structure() in 
> Sys.time()). But I can run millions times `%in%`, or structure(), or 
> Sys.time() on my machine without producing this bug. Arguments at 5: are 
> simple character strings. They don't hurt!
>
> Also, I am lost because the message is totally illogical in the context 
> where it appears: I can understand this message here:
>
>  > match(1, 2, nomatch = 0L, nomatch = NA)
> Error in match(1, 2, nomatch = 0L, nomatch = NA) :
>    formal argument "nomatch" matched by multiple actual arguments
>
> or here:
>
>  > test <- function (...) match(1, ..., nomatch = 0L)
>  > test(2, nomatch = NA)
> Error in match(1, ..., nomatch = 0L) :
>    formal argument "nomatch" matched by multiple actual arguments
>
> but in the call "match(x, table, nomatch = 0L)" where x is the character 
> string "factor" and table is another character string ("numeric") 
> extracted from a list, I don't understand why it produces this error 
> message. '.Internal(Sys.time())' uses do_systime c code that returns a 
> one-element double... not something that can hurt here?!
>
> Can someone explain me, or give me an example where an argument is NOT 
> duplicated in the call (well, as I understand it here) and where one 
> gets such an error message? And why?
>
> Many thanks, I am desperate :-(
>
> I got this error on R 2.11.1 on Mac OS X 10.6.4, and on R 2.10.1 on 
> Windows XP SP3 (but it does not matter, since I cannot cook a 
> reproducible example).
>
> Philippe
>
> P.S.: seems related to this: 
> http://finzi.psych.upenn.edu/Rhelp10/2008-June/165101.html
>



[Rd] Weird erratic error and illogical error message, could someone explain this?
Duncan Murdoch