[Rd] X11 help please

Duncan Murdoch murdoch at stats.uwo.ca
Tue Jun 19 12:44:00 CEST 2007


On 19/06/2007 2:51 AM, Peter Dalgaard wrote:
> Duncan Murdoch wrote:
>> Duncan Murdoch wrote:
>>   
>>> The rgl package currently crashes R when running under Xvfb (the 
>>> "virtual frame buffer" server), at least on MacOSX.  It makes sense that 
>>> it shouldn't be able to work there (it needs interactivity), but I don't 
>>> know how to detect the problems before they cause the crash.
>>>
>>> Currently the error happens the first time you try to open an rgl 
>>> window; when rgl calls XCreateWindow R crashes with the error message
>>>
>>> X Error of failed request:  BadMatch (invalid parameter attributes)
>>>   Major opcode of failed request:  1 (X_CreateWindow)
>>>   Serial number of failed request:  28
>>>   Current serial number in output stream:  29
>>>
>>> I've checked and as far as I can see all the parameters we're sending to 
>>> XCreateWindow are valid, but I might have missed something:  I don't 
>>> know much about X11 programming.  (The call is
>>>
>>>   ::Window xwindow = XCreateWindow(
>>>     xdisplay, RootWindow(xdisplay, DefaultScreen(xdisplay)),
>>>     0, 0, 256, 256, 0,
>>>     xvisualinfo->depth,
>>>     InputOutput,
>>>     xvisualinfo->visual,
>>>     valuemask,
>>>     &attrib
>>>   );
>>>
>>> but without context that's probably not worth much to others.)
>>>
>>>
>>>     
> Just a hunch: Is it possible that "attrib" contains uninitialized 
> variables or is getting overwritten with random data?

I tried memset'ing the whole thing to zeros before setting a couple of 
fields, and that didn't help.  I also tried specifying that 
XCreateWindow should ignore all fields, or all but one, with no change.

I suspect that the attrib structure isn't really the problem, but I 
don't know what the problem is.  X11() works fine under Xvfb on MacOSX, 
and rgl works fine when the Xvfb server is on Linux or Cygwin (with the 
identical line to invoke Xvfb as I was using on MacOSX.)  So there's 
something special about the interaction of rgl with the MacOSX Xvfb.

Duncan Murdoch

> 
>>> Are there any experienced X11 programmers out there who can suggest what 
>>> to do next?
>>>     
>> I have now committed some changes to rgl to avoid the crash -- it 
>> converts the above error into an R error.
>> I think to actually fix it, I'd need to debug the MacOSX Xvfb code to 
>> see exactly what it's complaining about.  I don't know where to find 
>> that source, so this isn't likely to happen soon.
>>
>> Are there any X11/MacOSX programmers going to the UseR! meeting in 
>> August?  I'd guess if I could sit down with someone who had experience 
>> with both of those we could track this down fairly quickly, but I don't 
>> think I'll be able to do it without that.
>>
>> Duncan Murdoch
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>



More information about the R-devel mailing list