Bug#385976: strange (and annoying) delay on startup
Loïc Minier
lool at dooz.org
Mon Sep 11 14:19:57 UTC 2006
reassign 385976 libice6
retitle 385976 SocketUNIXConnect shouldn't return TRANS_TRY_CONNECT_AGAIN when the socket file doesn't exist
severity 385976 minor
stop
Hi,
On Sun, Sep 10, 2006, Robert Millan wrote:
> Interesting... it turns out my shell's $SESSION_MANAGER is pointing to
> a socket that belonged to an older X session. As to why this happens,
> my shell was spawned by a screen session that's much older than my X
> server (when I have to restart X I just detach from screen, and later
> reattach).
>
> However, that doesn't explain the delay. You can tell the socket is
> not there inmediately.
This is presumably a bug in libICE (Inter-Client Exchange library), or
even in xtrans.
When libICE fails connecting (in ConnectToPeer), and gets
TRANS_TRY_CONNECT_AGAIN, it will retry the connection 5 times with a 1
second sleep() between retries.
The "local" Xtrans transport can either be implemented in Xtranslcl
which never returns TRANS_TRY_CONNECT_AGAIN, but returns
TRANS_CONNECT_FAILED, or in Xtranssock. Hence, here it's obviously in
Xtranssock that the code is.
Looking at the code, when connect() fails with ENOENT ("No such file or
directory"), SocketUNIXConnect returns TRANS_TRY_CONNECT_AGAIN, and a
comment says (Xtranssock.c:2048):
* If the error was ENOENT, the server may be starting up
* and we should try again.
(This is the typical error code you get when the UNIX socket file
doesn't exist.)
I'm reassigning to libice6. From what I read, the connection string
seems correct, so it should fail fast when it notices the socket is
missing; perhaps another workaround can be found for slow starting
servers?
Or perhaps the semantics should be extended to permit both behaviors,
for example programs such as "gnome-session" would typically want to
wait for the socket, while other clients, such as clients launched by
gnome-session or later during the session by the user, might not
consider that the "server is starting up".
Bye,
PS: note to self:
Connection is made via TRANS(Connect), with the literal connection
string from the env, in my case local/bee:/tmp/.ICE-unix/00000, and is
parsed in TRANS(ParseAddress). You can check this by using:
SESSION_MANAGER=local/bee:/tmp/.ICE-unix/00000 gcalctool
SESSION_MANAGER=local/:0 gcalctool
SESSION_MANAGER=/:0 gcalctool
--
Loïc Minier <lool at dooz.org>
More information about the Pkg-gnome-maintainers
mailing list