[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#519009: Xtrans should not return TRANS_TRY_CONNECT_AGAIN when it cannot connect to abstract socket

Package: xtrans-dev
Version: 1.2.3-3

The following code (lines 2058-2066 of Xtranssock.c) is wrong:

	    else if (olderrno == ENOENT || olderrno == ECONNREFUSED) {
		/* If opening as abstract socket failed, try again normally */
		if (abstract) {
		    ciptr->transptr->flags &= ~(TRANS_ABSTRACT);
		} else {
	    } else {

What this intends to do is that if Xtrans can't connect on an abstract
domain socket, it will retry on the concrete Unix socket of the same
name: to do this, whoever wrote this code thought that returning
TRANS_TRY_CONNECT_AGAIN would do the trick, as the caller would then

Unfortunatly, TRANS_TRY_CONNECT_AGAIN actually means "try again after
a delay" and not "try again immediately".  So this code means that,
since I use a session manager that does not create an abstract domain
socket, every client trying to contact it (with the new Xtrans,
through libSM and libICE) sleeps for one second before starting,
because it first attempts to contact the abstract socket, then sleeps
for one second before trying the concrete Unix socket.

(A similar problem was already reported as Debian bug #385976 the last
time Xtrans tried to return TRANS_TRY_CONNECT_AGAIN, which was also
wrong for much the same reason.)

The correct way to do things is for Xtrans itself to try to connect
first to the abstract socket, then to the Unix one.  Not to require
the caller to try again.  Otherwise clients will uselessly waste
seconds at startup (and people like me will uselessly waste hours
tracking down why this is).

     David A. Madore
   ( http://www.madore.org/~david/ )

Reply to: