From plummer at iarc.fr  Thu Dec 18 08:59:53 2008
From: plummer at iarc.fr (Martyn Plummer)
Date: Thu, 18 Dec 2008 08:59:53 +0100
Subject: [Rd] [R]   "Error: bad value" problem
In-Reply-To: <4949BE58.2020805@stats.uwo.ca>
References: <20081217223408.F3D214CA07@egon.stats.ucl.ac.uk>
	<D667981B-6F7E-4242-AC9D-50FD2AC3EAD8@auckland.ac.nz>
	<4949949F.7080101@biostat.ku.dk>	<49499C78.9020700@biostat.ku.dk>
	<21065458.post@talk.nabble.com> <4949ADC9.40409@biostat.ku.dk>
	<4949B9CB.1000308@stats.uwo.ca>  <4949BE58.2020805@stats.uwo.ca>
Message-ID: <1229587193.2948.11.camel@localhost.localdomain>

This has all the hallmarks of a bug I found and fixed in R-devel
(r46998).  I did not port the patch over to the R release branch because
I could not reproduce the bug.

In R-devel, I was seeing problems with "make test-Segfault". This would
occasionally segfault, but most of the time would create the "bad value"
error, and of course would also run perfectly fine a lot of the time.
The error came from exactly the same place that Ben found.  It was due
to an invalid SrcRefs being used because SrcFile is not set to zero when
it should be.

I'll have a look and see if it is the same problem, or a close cousin.

Martyn


On Wed, 2008-12-17 at 22:07 -0500, Duncan Murdoch wrote:
> On 17/12/2008 9:47 PM, Duncan Murdoch wrote:
> > On 17/12/2008 8:56 PM, Peter Dalgaard wrote:
> >> Ben Bolker wrote:
> >>>   I can get the errors to happen on Ubuntu 8.10 with R --vanilla (*without*
> >>> valgrind) -- but
> >>> editing momfit.r line 742 so that plot.progress=FALSE seems to make the
> >>> problem go away.  (This was a lucky guess, it looked like there was
> >>> something
> >>> odd going on with the plots.)
> >>>
> >>>   Hope that helps someone ...
> >> Probably not. The problem is to reproduce the error state in a way so 
> >> that we can understand what is causing it.
> >>
> >> I can debug this to
> >> (gdb) bt
> >> #0  Rf_error (format=0x8220c65 "bad value") at 
> >> ../../../R/src/main/errors.c:704
> >> #1  0x0805a924 in SETCDR (x=0x8f89348, y=0x9b276e8)
> >>      at ../../../R/src/main/memory.c:2728
> >> #2  0x0819fa46 in GrowList (l=0x951e8f4, s=<value optimized out>) at 
> >> gram.y:958
> >> #3  0x081a2a7b in xxvalue (v=0x8f89348, k=4, lloc=<value optimized out>)
> >>      at gram.y:440
> >>
> >> and the problem in GrowList is that CAR(l) is R_NilValue (==0x8f89348), 
> >> which supposedly "cannot happen", and the thing that calls GrowList is 
> >> something with srcrefs (DuncanM?).
> >>
> >> Digging deeper probably has to wait till the weekend for my part. (The 
> >> natural next step is figuring out how the R_NilValue got into that 
> >> location, but I should try to sleep off this cold....)
> >>
> >> I'm CCing r-devel on this. Can we move the discussion there?
> > 
> > I can probably take a look tomorrow.  I wasn't getting an error, but 
> > maybe I'll see the same corruption if I watch it run.
> 
> I had time to see if I was getting a NilValue there tonight, and the 
> answer was no, with the Windows RC.  I don't get the error in any 
> version I've tried on Windows, though I can see it in 2.8.0 on MacOSX.
> 
> Duncan
> > 
> > Duncan Murdoch
> > 
> >>
> >>
> >>>   Ben Bolker
> >>>
> >>>> sessionInfo()
> >>> R version 2.8.0 (2008-10-20) 
> >>> i486-pc-linux-gnu 
> >>>
> >>> locale:
> >>> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
> >>>
> >>> attached base packages:
> >>> [1] stats     graphics  grDevices utils     datasets  methods   base    
> >>
> > 
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}



[Rd] [R] "Error: bad value" problem
Martyn Plummer