From murdoch at stats.uwo.ca  Mon Jun 18 17:18:24 2007
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 18 Jun 2007 11:18:24 -0400
Subject: [Rd] X11 help please
In-Reply-To: <46768B1C.2030706@stats.uwo.ca>
References: <46759924.5020103@stats.uwo.ca>	<Pine.LNX.4.64.0706180419440.7264@gannet.stats.ox.ac.uk>	<467672F8.9040105@cimr.cam.ac.uk>
	<46768B1C.2030706@stats.uwo.ca>
Message-ID: <4676A240.1060103@stats.uwo.ca>

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



[Rd] X11 help please
Duncan Murdoch