Re: [Rd] X11 help please

2007-06-20 Thread Hin-Tak Leung
Duncan Murdoch wrote:

> 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.


While it is exceedingly rare (xorg developers are some of the best...)
are you talking about it working on x86/x86_64 lihux and cygwin/x86,
and not working on powerpc Mac OS X? - i.e. as opposed to possibly
  alpha/sparc/powerpc linux and x86 mac OS X?

The reason why I am asking is that intel is small-endian and
powerpc is big-endian. It is very rare, but can't say if there could
be endian-issues in the interaction. (given that most Xvfb users are
on small-endian platforms?)

It might be useful to ask at the IRC channel [EMAIL PROTECTED] for 
debug tips - there are some seriously hardcore X11 guru's there... I am 
sure they like to know if you can bring Xvfb down :-).

HTL

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-19 Thread Duncan Murdoch
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@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-18 Thread Peter Dalgaard
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?

>> 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@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-18 Thread Duncan Murdoch
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.)
>
>
> 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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-18 Thread Duncan Murdoch
On 6/18/2007 9:39 AM, Duncan Murdoch wrote:
> On 6/18/2007 7:56 AM, Hin-Tak Leung wrote:
>> Prof Brian Ripley wrote:
>>> rgl normally works under Xvfb on Linux: we've been using that for the 
>>> testing 'for ever'.
>>> 
>>> However R should not 'crash' on an error in a package, and the X11 device 
>>> has error handlers set up by
>>> 
>>> XSetErrorHandler(R_X11Err);
>>> XSetIOErrorHandler(R_X11IOErr);
>>> 
>>> I don't see anything comparable in rgl.
>>> 
>>> The error seems to be in the attributes, so I would have a closer look at 
>>> those.  In particular, how are you running Xvfb?: you may need something 
>>> like
>>> 
>>> Xvfb :5 -screen 0 1280x1024x24 &
>>> setenv DISPLAY :5
>>> 
>>> to ensure that you have a reasonable visual and hence colormap.
>>> (On my system the default is 12 bit.)
>> 
>> That's interesting - my first thought of Duncan's problem was unusual
>> colour depth as well, but I thought very few people run their X servers
>> in anything other than 24-bit or true-color mode these days (and any
>> MacOSX hardware should be capable of that anyway); if 12-bit is the
>> Xvfb default it is hightly likely that's the reason.
> 
> I don't know the default, but I've been specifying 24 or 32 bit depth 
> each time, and rgl is seeing 32 bit depth.
> 
>> I have also seen that sort of error messages in CJK related issues,
>> if the X server's font path has some unsual and broken fonts; so it 
>> might be a good idea to disable any non-english locale, etc and try not 
>> to do anything clever in that direction for the time being.
> 
> I do get a warning about a missing font when I run Xvfb; Simon Urbanek 
> thought it was ignorable, but maybe not:
> 
> Could not init font path element /usr/X11R6/lib/X11/fonts/CID/
> 
> This happens before R is running, and sometimes again during the run.
> 
> I've now implemented XSetErrorHandler(R_X11Err) as Brian suggested, and 
> this moves the error elsewhere:  R doesn't quit when it hits that error, 
> but it dies later because rgl isn't handling its incomplete 
> initialization properly.  I think that will be relatively easy to track 
> down and fix, but I'm still left with two problems I don't know how to 
> solve:
> 
> 1.  Why am I getting this error in the first place?  Since things work 
> on Linux, this may be a bug in the MacOSX implementation of Xvfb, but 
> Google doesn't turn up other reports of that, so it's more likely an rgl 
> problem.
> 
> 2.  XSetErrorHandler() is a global setting.  If rgl sets it, then it 
> will override the setting that X11() used.  Is there a way to retrieve 
> the previous setting, so I can set it only temporarily?  There doesn't 
> appear to be any XGetErrorHandler() function.

This one was easy:  the value of the XSetErrorHandler call is the 
previous handler.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-18 Thread Duncan Murdoch
On 6/18/2007 7:56 AM, Hin-Tak Leung wrote:
> Prof Brian Ripley wrote:
>> rgl normally works under Xvfb on Linux: we've been using that for the 
>> testing 'for ever'.
>> 
>> However R should not 'crash' on an error in a package, and the X11 device 
>> has error handlers set up by
>> 
>>  XSetErrorHandler(R_X11Err);
>>  XSetIOErrorHandler(R_X11IOErr);
>> 
>> I don't see anything comparable in rgl.
>> 
>> The error seems to be in the attributes, so I would have a closer look at 
>> those.  In particular, how are you running Xvfb?: you may need something 
>> like
>> 
>> Xvfb :5 -screen 0 1280x1024x24 &
>> setenv DISPLAY :5
>> 
>> to ensure that you have a reasonable visual and hence colormap.
>> (On my system the default is 12 bit.)
> 
> That's interesting - my first thought of Duncan's problem was unusual
> colour depth as well, but I thought very few people run their X servers
> in anything other than 24-bit or true-color mode these days (and any
> MacOSX hardware should be capable of that anyway); if 12-bit is the
> Xvfb default it is hightly likely that's the reason.

I don't know the default, but I've been specifying 24 or 32 bit depth 
each time, and rgl is seeing 32 bit depth.

> I have also seen that sort of error messages in CJK related issues,
> if the X server's font path has some unsual and broken fonts; so it 
> might be a good idea to disable any non-english locale, etc and try not 
> to do anything clever in that direction for the time being.

I do get a warning about a missing font when I run Xvfb; Simon Urbanek 
thought it was ignorable, but maybe not:

Could not init font path element /usr/X11R6/lib/X11/fonts/CID/

This happens before R is running, and sometimes again during the run.

I've now implemented XSetErrorHandler(R_X11Err) as Brian suggested, and 
this moves the error elsewhere:  R doesn't quit when it hits that error, 
but it dies later because rgl isn't handling its incomplete 
initialization properly.  I think that will be relatively easy to track 
down and fix, but I'm still left with two problems I don't know how to 
solve:

1.  Why am I getting this error in the first place?  Since things work 
on Linux, this may be a bug in the MacOSX implementation of Xvfb, but 
Google doesn't turn up other reports of that, so it's more likely an rgl 
problem.

2.  XSetErrorHandler() is a global setting.  If rgl sets it, then it 
will override the setting that X11() used.  Is there a way to retrieve 
the previous setting, so I can set it only temporarily?  There doesn't 
appear to be any XGetErrorHandler() function.

Duncan Murdoch
> 
> - I do run my old laptop at 16-bit only, as it is old and I get better 
> performance that way with little sacrifice on visual appearance,
> but that's my choice...
> 
>> On Sun, 17 Jun 2007, 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.)
>>>
>>>
>>> Are there any experienced X11 programmers out there who can suggest what
>>> to do next?
>>>
>>> Duncan Murdoch
>>>
>>> __
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-18 Thread Hin-Tak Leung
Prof Brian Ripley wrote:
> rgl normally works under Xvfb on Linux: we've been using that for the 
> testing 'for ever'.
> 
> However R should not 'crash' on an error in a package, and the X11 device 
> has error handlers set up by
> 
>   XSetErrorHandler(R_X11Err);
>   XSetIOErrorHandler(R_X11IOErr);
> 
> I don't see anything comparable in rgl.
> 
> The error seems to be in the attributes, so I would have a closer look at 
> those.  In particular, how are you running Xvfb?: you may need something 
> like
> 
> Xvfb :5 -screen 0 1280x1024x24 &
> setenv DISPLAY :5
> 
> to ensure that you have a reasonable visual and hence colormap.
> (On my system the default is 12 bit.)

That's interesting - my first thought of Duncan's problem was unusual
colour depth as well, but I thought very few people run their X servers
in anything other than 24-bit or true-color mode these days (and any
MacOSX hardware should be capable of that anyway); if 12-bit is the
Xvfb default it is hightly likely that's the reason.

I have also seen that sort of error messages in CJK related issues,
if the X server's font path has some unsual and broken fonts; so it 
might be a good idea to disable any non-english locale, etc and try not 
to do anything clever in that direction for the time being.

- I do run my old laptop at 16-bit only, as it is old and I get better 
performance that way with little sacrifice on visual appearance,
but that's my choice...

> On Sun, 17 Jun 2007, 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.)
>>
>>
>> Are there any experienced X11 programmers out there who can suggest what
>> to do next?
>>
>> Duncan Murdoch
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] X11 help please

2007-06-17 Thread Prof Brian Ripley
rgl normally works under Xvfb on Linux: we've been using that for the 
testing 'for ever'.

However R should not 'crash' on an error in a package, and the X11 device 
has error handlers set up by

XSetErrorHandler(R_X11Err);
XSetIOErrorHandler(R_X11IOErr);

I don't see anything comparable in rgl.

The error seems to be in the attributes, so I would have a closer look at 
those.  In particular, how are you running Xvfb?: you may need something 
like

Xvfb :5 -screen 0 1280x1024x24 &
setenv DISPLAY :5

to ensure that you have a reasonable visual and hence colormap.
(On my system the default is 12 bit.)


On Sun, 17 Jun 2007, 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.)
>
>
> Are there any experienced X11 programmers out there who can suggest what
> to do next?
>
> Duncan Murdoch
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] X11 help please

2007-06-17 Thread Duncan Murdoch
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.)


Are there any experienced X11 programmers out there who can suggest what 
to do next?

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel