[Rd] grid error message when resizing graphics window after tcltk loaded

Erik Iverson iverson at biostat.wisc.edu
Fri May 23 19:00:43 CEST 2008


One more follow-up here before I head out for the weekend.

I added a PrintValue(gvp); immediately after the gvp = ... around line 
647 in grid.c in function L_unsetviewport.

Then I recompile R, and run the code loop below, and resize the window, 
very small, then large, repeated) until I see the offending error message.

I obviously am getting a long list of thing that look like

viewport[GRID.VP.262]

while I resize the window, with '262' varying.  But eventually, I will see,

viewport[ROOT]
Error: 11Cannot pop the top-level viewport (grid and graphics output mixed?)

I'm a bit in over my head at this point, but maybe this can give someone 
a clue.  If there's anything I can try on this end to further diagnose 
the problem, please let me know.

One more piece of information.

At work (on the RHEL4 machine described below), if I have a graphic that 
takes a 'long time' to draw (e.g., print 100000's of characters using 
grid.text at random points), I can hit the "close" button on the device 
window while it is drawing, which will almost always cause a 
segmentation fault.

Contrasted at home (setup described below), I could click the button, 
but it would not respond to my request to close the window until after 
it had finished drawing, at which point it would close the graphics 
window gracefully as expected.

Erik

Erik Iverson wrote:
> Dear R-devel / Dr. Murrell  -
> 
> This is similar but ultimately unrelated (I think) to something I posted 
> about in February.  See my original post here:
> 
> https://stat.ethz.ch/pipermail/r-devel/2008-February/048278.html
> 
> I start R with the --vanilla option, and run the following code.
> 
> ## BEGIN SAMPLE R CODE
> 
> library(grid)
> for(i in seq(0, 1, by = .1)) {
>   for(j in seq(0, 1, by = .1)) {
>     angle <- runif(1, 1, 180)
>     col <- sample(colors(), 1)
>     pushViewport(viewport(x = i, y= j, width = .1, height = .1,
>                           angle = angle, gp = gpar(col = col)))
>     grid.rect()
>     popViewport()
>   }
> }
> 
> ## END SAMPLE R CODE
> 
> I can then resize the resulting R Graphics Device window and everything 
> seems to work fine.
> 
> If I then do issue 'library(tcltk)', and reissue the above code, and 
> then resize the resulting window to something fairly small, I get the 
> following error that shows up at my R prompt:
> 
> Error: Cannot pop the top-level viewport (grid and graphics output mixed?)
> 
> The error seems harmless, but eventually, after doing this "enough", and 
> closing the graphics window, R may segfault,
> 
>  *** caught segfault ***
> address 0xfc, cause 'memory not mapped'
> 
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> 
> I have tracked down the error message I am receiving with some very 
> rudimentary techniques, and narrowed it down to the L_unsetviewport 
> function defined in grid.c.  The error string in question appears two 
> places in that function, and I determined in my case that it is the 
> first instance that is actually outputting the error.  That's about as 
> far as I can take it unfortunately.
> 
> Again, this only seems to happen after I load the tcltk package.
> 
> I am running RHEL version 4 with KDE on a 32-bit Intel processor.
> 
> Here is my session info, immediately after starting R...
> 
> sessionInfo()
> R version 2.7.0 (2008-04-22)
> i686-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
> 
> 
> Thanks,
> Erik Iverson
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list