答复: 答复: A question about XOpenDisplay fail

Ma, Qingyu (GE Healthcare) Qingyu.Ma at ge.com
Wed Apr 28 19:10:13 PDT 2010


> export/setenv only affect processes started from the shell after the command is
> run.   Since myProcess is already running, the second export cannot affect it.

My understanding is when my process call XOpenDisplay(NULL), current DISPLAY will be used. But there is time slice between process execution and open display. It depends on my process. Except that DISPLAY is fixed for one process after it's executed.

>XOpenDisplay can also fail if:

> - you don't have currently valid authorization (either a good
>  entry in the xauthority file for the display or a xhost entry
>   allowing access to your host/userid - see the XSecurity man
>   page for more info on the various authentication mechanisms)

> - DISPLAY specifies an invalid hostname

> - the X server is not running

This issue occurred after long time cycle test. Before it occurred, all function is perfect. That means, before the issue occurred, my process can open display successfully. Then, suddenly, open display fail.
Can any condition cause this phenomena?


> - the X server has hit it's maximum number of open connections,
>   such as if you called XOpenDisplay() every time you wanted to
>   change an LED, and never called XCloseDisplay()

I checked my code. XOpenDisplay() and XCloseDisplay() always be executed with a pair. And, if I indeed missed one XCloseDisplay(), there should be regulated occurrence in cycle test. But acutally not.

Best Regards,
Ma Qingyu

-----邮件原件-----
发件人: Alan Coopersmith [mailto:alan.coopersmith at oracle.com] 
发送时间: 2010年4月28日 22:28
收件人: Ma, Qingyu (GE Healthcare)
抄送: Peter Hutterer; xorg at lists.freedesktop.org
主题: Re: 答复: A question about XOpenDisplay fail

Ma, Qingyu (GE Healthcare) wrote:
> Thanks for your reply.
> 
> My process is executed in a script which is executed by another process. The script is like:
> 
> export DISPLAY=:0.1
> ./myProcess &
> export  DISPLAY=:0.0
> 
> I know when myProcess opens display, current DISPLAY maybe changed back to :0.0.  It's another issue. But till now, myProcess is displayed on :0.1 each time.
> Of course, I'm not sure if myProcess try to open display at the right point of changing DISPLAY, whether it can get a valid display (0 or 1)?

export/setenv only affect processes started from the shell after the command is
run.   Since myProcess is already running, the second export cannot affect it.

> Is there any other possibility to cause XOpenDisplay fail, like network, IP stack or anything?

XOpenDisplay can also fail if:

 - you don't have currently valid authorization (either a good
   entry in the xauthority file for the display or a xhost entry
   allowing access to your host/userid - see the XSecurity man
   page for more info on the various authentication mechanisms)

 - DISPLAY specifies an invalid hostname

 - the X server is not running

 - the X server has hit it's maximum number of open connections,
   such as if you called XOpenDisplay() every time you wanted to
   change an LED, and never called XCloseDisplay()

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System




More information about the xorg mailing list