[R-SIG-Mac] [External] Re: more rgl problems

Richard M. Heiberger rmh @end|ng |rom temp|e@edu
Sat Feb 20 16:45:59 CET 2021


I am running it now on 4.0.4RC.

The cran page
https://cran.r-project.org
offers download of 4.0.3 for mac, even though 4.0.4 is available on windows.

________________________________________
From: Duncan Murdoch <murdoch.duncan using gmail.com>
Sent: Saturday, February 20, 2021 9:41 AM
To: Richard M. Heiberger; r-sig-mac using r-project.org
Subject: Re: [External] Re: more rgl problems

If you are set up to install from source, could you try this?

   devtools::install_github("dmurdoch/rgl using quartzbug", type="source")

If you only have some of the requirements (e.g. no devel versions of
packages) you might find you only get a partial build with no X11
display; that won't really test the workaround.  In that case I'll try
to build a binary for your R version.

Duncan Murdoch

On 18/02/2021 6:07 p.m., Richard M. Heiberger wrote:
> This is from my MacBook Air mid-2012 running Catalina 10.15.7
> with Xquartz 2.7.11
> I never placed the beta on this machine.
> I also see from a fresh R session
>
>     plot(1:10, col=7)
>     library(rgl)
>     open3d()
>
> is fine, whereas this:
>
>     library(rgl)
>     plot(1:10, col=7)
>     open3d()
> segfaults
>
> R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
> Copyright (C) 2020 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin17.0 (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>    Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>> setwd('/Users/rmh/Rwd/')
>>     library(rgl)
>     plot(1:10, col=7)
>     open3d()
>     library(rgl)
>>     plot(1:10, col=7)
>>     open3d()
>
> error: xp_attach_gl_context returned: 2
>
>   *** caught segfault ***
> address 0x18, cause 'memory not mapped'
>
> Traceback:
>   1: rgl.open(useNULL)
>   2: open3d()
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> Selection: 2
> Warning message:
> In rgl.open(useNULL) : RGL: ERROR: can't bind glx context to window
>
> Process R finished at Thu Feb 18 17:57:37 2021
>
>
> ________________________________________
> From: Duncan Murdoch <murdoch.duncan using gmail.com>
> Sent: Thursday, February 18, 2021 3:20 PM
> To: Richard M. Heiberger; r-sig-mac using r-project.org
> Subject: [External] Re: more rgl problems
>
> I've made some progress on this, but I don't know how to fix it properly.
>
> What's happening is that rgl is trying to open the new window that
> open3d() asks for.  It gets most of the way through that operation, then
> calls glXMakeCurrent, which associates the OpenGL context with that
> window.  That call fails, but without generating any of the documented
> errors:  it just fails, triggering an X11 error handler with error code
> 0 (which typically means no error).
>
> In the released versions of rgl, that failure leads to a segfault,
> because I wasn't doing enough error checking.  I've fixed the segfault,
> but I'm still getting the error (in fact I'm getting it a lot more than
> I used to; not sure if it's my debugging code causing that), and after I
> get the error reported on screen, the new rgl window opens but doesn't
> work to display anything.
>
> I think it's probably something wrong in the rgl initialization code;
> running this:
>
>     plot(1:10, col=7)
>     library(rgl)
>     open3d()
>
> is fine, whereas this:
>
>     library(rgl)
>     plot(1:10, col=7)
>     open3d()
>
> is always failing for me.  Or possibly this is an Xquartz bug, maybe a
> leftover from when I installed the beta.
>
> I'd guess what's happening is that calling quartz() invalidates part of
> the initialization done by rgl.init(), but I don't know what part yet.
> I do want to call rgl.init() when loading rgl, because it might fail,
> and then I can drop back to the off-screen drawing.  It's too late to do
> that later.
>
> A workaround that works for me is for the .onload() function in rgl to
> execute
>
>    dev.new()
>    dev.off()
>
> before calling rgl.init(). It is less irritating than you might guess,
> because the window doesn't have time to appear before being destroyed,
> but I still don't like it.   I'll try it out a bit, and then push it to
> Github for others to test.
>
> Duncan Murdoch
>
>
> On 18/02/2021 6:28 a.m., Duncan Murdoch wrote:
>> I can reproduce this on a Catalina machine, working in R from the terminal.
>>
>> This definitely looks similar to the problem that
>> rgl::setGraphicsDelay() was designed to solve, but even adding a 10
>> second delay doesn't help.  I get a slightly different message than you:
>>
>>    > open3d()
>> error: xp_attach_gl_context returned: 2
>>
>>     *** caught segfault ***
>> address 0x18, cause 'memory not mapped'
>>
>> but that might just be a different way of reporting the same underlying
>> issue.
>>
>> It's clearly some kind of interaction between the Quartz device and rgl.
>>     I'll see if I can track it down.
>>
>> Duncan Murdoch
>>
>> On 17/02/2021 7:36 p.m., Richard M. Heiberger wrote:
>>> This is repeatable when the lines are all pasted in at once.
>>> The example works if I allow some time delay between lines.
>>>
>>> This is might be a relative of the one from a few months ago.
>>> But this message is about invalid permissions.
>>> =====
>>>
>>> R version 4.0.4 RC (2021-02-12 r79998) -- "Lost Library Book"
>>> Copyright (C) 2021 The R Foundation for Statistical Computing
>>> Platform: x86_64-apple-darwin17.0 (64-bit)
>>>
>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>> You are welcome to redistribute it under certain conditions.
>>> Type 'license()' or 'licence()' for distribution details.
>>>
>>>      Natural language support but running in an English locale
>>>
>>> R is a collaborative project with many contributors.
>>> Type 'contributors()' for more information and
>>> 'citation()' on how to cite R or R packages in publications.
>>>
>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>> 'help.start()' for an HTML browser interface to help.
>>> Type 'q()' to quit R.
>>>
>>>> setwd('/Users/rmh/Rwd/')
>>>> library(rgl)
>>>> x <- matrix(1:3, 1,3)
>>>> plot(1:10, col=7)
>>>> open3d()
>>> error: xp_attach_gl_context returned: 2
>>>
>>>     *** caught segfault ***
>>> address 0x18, cause 'invalid permissions'
>>>
>>> Traceback:
>>>     1: rgl.open(useNULL)
>>>     2: open3d()
>>>
>>> Possible actions:
>>> 1: abort (with core dump, if enabled)
>>> 2: normal R exit
>>> 3: exit R without saving workspace
>>> 4: exit R saving workspace
>>> Selection:
>>>
>>>
>>> ====
>>> MacBookAir with the M1 chip using the regular intel version of R from CRAN.
>>> Big Sur 11.2.1.
>>> The plot(1:10), col=7) ## went by default to the quartz() device.
>>>
>>>
>>> I repeated this about 5 times in ESS, and then once in Terminal.
>>>
>>> Let me know if you need more information.
>>>
>>
>



More information about the R-SIG-Mac mailing list