[Dovecot] Bug in dovecot 1.2 dict

Sascha Wilde wilde at intevation.de
Thu Oct 2 13:51:49 EEST 2008


Hi Timo,
Hi *,

in 1.2 the dict server (tested with sqlite backend) is somewhat broken.
It bails out regularly with "Fatal: dict: Socket already exists: ..."
(looks like a race condition as it doesn't fail always).

We discovered that this new code in dict-server.c seems to be the problem:

	server->fd = net_listen_unix_unlink_stale(path, 64);
	if (server->fd == -1) {
		if (errno == EADDRINUSE)
			i_fatal("Socket already exists: %s", path);
		else
			i_fatal("net_listen_unix(%s) failed: %m", path);
	}

replacing it with the old code:

        int i = 0;
  [...]
	while (server->fd == -1) {
		server->fd = net_listen_unix(path, 64);
		if (server->fd != -1)
			break;

		if (errno != EADDRINUSE || ++i == 2)
			i_fatal("net_listen_unix(%s) failed: %m", path);

		/* see if it really exists */
		if (net_connect_unix(path) != -1 || errno != ECONNREFUSED)
			i_fatal("Socket already exists: %s", path);

		/* delete and try again */
		if (unlink(path) < 0)
			i_fatal("unlink(%s) failed: %m", path);
	}

"fixes" the problem.  But I think the real fix would have to be done in
the new function `net_listen_unix_unlink_stale'.

cheers
sascha
-- 
Sascha Wilde                                      OpenPGP key: 4BB86568
Intevation GmbH, Osnabrück             http://www.intevation.de/~wilde/
Amtsgericht Osnabrück, HR B 18998             http://www.intevation.de/
Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20081002/7586d877/attachment.bin 


More information about the dovecot mailing list