Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

xauth error on network change



Hello,

I am using X11.app 1.0 on Mac OS X 10.3.5 with an iBook using the wireless
airport for networking. I experience the following problem. When I move
from one location to another at work I can no longer launch X11
applications. I have narrowed the problem.

First when I start X11.app:

% xauth list
d-r12345.dhcp.foo.bar/unix:1  MIT-MAGIC-COOKIE-1  cookie
d-r12345.dhcp.foo.bar:1  MIT-MAGIC-COOKIE-1  cookie
localhost:1  MIT-MAGIC-COOKIE-1  cookie
My-Computer.local/unix:1  MIT-MAGIC-COOKIE-1  cookie

(The details have been changed and yes I have two instances of X11.app
running using FUS.)

The cookie for d-r12345.dhcp.foo.bar/unix:1 is key because this is what
allows me to run local X11 applications on my iBook.

Now if I move to a different location, I will get a new IP address from
DHCP, after this change in network status my cookies will look something
like this:

% xauth list
My-Computer.local/unix:1  MIT-MAGIC-COOKIE-1  cookie
d-r67890.dhcp.foo.bar:1  MIT-MAGIC-COOKIE-1  cookie
localhost:1  MIT-MAGIC-COOKIE-1  cookie

Now local X11 applications will not launch:

% xclock
Xlib: connection to ":1.0" refused by server
Xlib: No protocol specified

Error: Can't open display: :1.0

The error is that there is no unix socket cookie entry, specifically
after:

% xauth add d-r67890.dhcp.foo.bar/unix:1  MIT-MAGIC-COOKIE-1  cookie

Now local X11 applications work again.

This problem can be reproduced with wireless by turning the airport
network off and then on again. If the airport is ON and X11.app is
launched, both the remote and local cookies are in the the .Xauthority
file. When the airport is turned OFF, both cookies are removed
automatically. When the airport is turned ON again, only the remote cookie
is added. (Even if you recieve the same IP address.) There is no /unix
cookie for local connection to the X11 server using the unix socket.

I was curious what program monitors the change in Network status and adds
and removes cookies automatically so I ran this:

# fs_usage -e -w -f filesys > fs_usage.out

Then I looked for references to .Xauthority:

17:06:13.318  lstat [  2] /Users/baz/.XauthoritykL2FhF       0.000111   X11
17:06:13.318  stat  [  2] /Users/baz/.Xauthority-c           0.000015   X11
17:06:13.319  open  F=13  /Users/baz/.Xauthority-c           0.000594 W X11
17:06:13.319  close F=13                                     0.000019   X11
17:06:13.319  link        /Users/baz/.Xauthority-c           0.000567   X11
17:06:13.320  open  F=13  /Users/baz/.XauthoritykL2FhF       0.000232   X11
17:06:13.320  open  F=14  /Users/baz/.Xauthority             0.000243   X11
17:06:13.320  fstat F=14                                     0.000007   X11
17:06:13.320  read  F=14   B=0xc8                            0.000046   X11
17:06:13.320  read  F=14   B=0x0                             0.000003   X11
17:06:13.320  close F=14                                     0.000012   X11
17:06:13.320  close F=13                                     0.000002   X11
17:06:13.321  unlink      /Users/baz/.Xauthority             0.000359   X11
17:06:13.321  rename      /Users/baz/.XauthoritykL2FhF       0.000267   X11
17:06:13.321  unlink      /Users/baz/.Xauthority-c           0.000198   X11
17:06:13.322  unlink      /Users/baz/.Xauthority-l           0.000437   X11
17:06:13.322  open  F=13  /dev/random                        0.000131   X11
17:06:13.322  read  F=13   B=0x10                            0.000153   X11
17:06:13.322  lstat [  2] /Users/baz/.XauthorityHLOmRm       0.000046   X11
17:06:13.322  stat  [  2] /Users/baz/.Xauthority-c           0.000015   X11
17:06:13.322  open  F=14  /Users/baz/.Xauthority-c           0.000279   X11
17:06:13.322  close F=14                                     0.000012   X11
17:06:13.323  link        /Users/baz/.Xauthority-c           0.000490   X11
17:06:13.323  open  F=14  /Users/baz/.XauthorityHLOmRm       0.000189   X11
17:06:13.323  fstat F=14                                     0.000003   X11
17:06:13.323  open  F=15  /Users/baz/.Xauthority             0.000041   X11
17:06:13.323  fstat F=15                                     0.000002   X11
17:06:13.323  read  F=15   B=0x0                             0.000020   X11
17:06:13.323  close F=15                                     0.000004   X11
17:06:13.323  write F=14   B=0x80                            0.000134   X11
17:06:13.324  close F=14                                     0.000346   X11
17:06:13.324  unlink      /Users/baz/.Xauthority             0.000240   X11
17:06:13.324  rename      /Users/baz/.XauthorityHLOmRm       0.000243   X11
17:06:13.324 WrData[async] D=0x03b03680 B=0x200 /dev/disk0s5 0.000818 W X11

This was repeated later on with another similar list of syscalls and fs
activity for the other instance of X11.app. It is clear from this that it
is X11.app itself that removes/adds the cookie(s) with some -c and -l
locking and writing to a temporary file and renaming it to the .Xauthority
file.

So it would appear that there is a bug in X11.app, it should in fact add
both the remote (:) and local (/unix:) cookies. Also why is X11.app not
forking and using xauth to do this? (Whatever that is just style.) I can
perform the xauth add command when I remember but when I forget the
consequences are annoying because of an in-house X11 application I use.
When it fails to spawn a new X11 application, the program becomes unusable
andI must quit it and restart losing all progress to that point.

Maybe there is a simple work around like making the machine name static,
or a convuluted solution using /System/Library/SystemConfiguration/Kicker
but I hope that either I misubderstand something or that someone on this
list has a simple work around that allows me to still have a dynamic
host name.

On another note, there is possibly a file descriptor leak in X11.app.
Granted I only captured a small portion of the running of X11.app with
fs_usage, if you notice this:

17:06:13.322  open  F=13  /dev/random                        0.000131   X11

I would have expected a close of /dev/random soon after the subsequent
read. Again, it is possible I simply did not capture enough of the output
of fs_usage, but I did have in excess of five seconds after this in the
output. Or possibly X11.app caches the descriptor after opening the file
for the first time.

Thanks for any help or suggestions,
mzs
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/x11-users/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.