sync_client stalls the rest of cyrus while 'no route to host'

Bron Gondwana brong at fastmail.fm
Wed Sep 27 21:26:02 EDT 2006


On Sat, Aug 26, 2006 at 10:22:15PM +0200, Paul Dekkers wrote:
> Hi,
> 
> I don't know if this is a known issue: as soon as I enable replication
> and the sync_client gets a "No route to host" from the replica, the rest
> of the cyrus startup seems to stall: no imap, no lmtp... just because a
> replica is unreachable. (In this case because iptables was to
> restrictive on the replica ;-))
> 
> Aug 26 22:13:19 haver master[24203]: about to exec
> /usr/lib/cyrus-imapd/idled
> Aug 26 22:13:19 haver master[24205]: about to exec
> /usr/lib/cyrus-imapd/sync_client
> Aug 26 22:13:19 haver sync_client[24205]: connect(192.87.109.20) failed:
> No route to host
> Aug 26 22:14:04 haver last message repeated 2 times
> Aug 26 22:17:04 haver last message repeated 2 times
> Aug 26 22:21:04 haver sync_client[24205]: connect(192.87.109.20) failed:
> No route to host
> 
> It takes quite long, not sure if the server will ever respond...

Here's a patch that allows you to avoid this issue by specifying "-o"
on the command line to sync_client (put it in your cyrus.conf).

Bron.


-------------- next part --------------
diff -ur --new-file cyrus-imapd-cvs.orig/imap/sync_client.c cyrus-imapd-cvs/imap/sync_client.c
--- cyrus-imapd-cvs.orig/imap/sync_client.c	2006-07-26 20:03:15.000000000 -0400
+++ cyrus-imapd-cvs/imap/sync_client.c	2006-09-19 01:16:35.000000000 -0400
@@ -121,6 +121,7 @@
 
 static int verbose         = 0;
 static int verbose_logging = 0;
+static int connect_once    = 0;
 
 static int do_meta(char *user);
 
@@ -3165,7 +3166,7 @@
 	be = backend_connect(be, servername, &protocol[PROTOCOL_CSYNC],
 			     "", cb, NULL);
 
-	if (be || wait > 1000) break;
+	if (be || connect_once || wait > 1000) break;
 
 	fprintf(stderr,
 		"Can not connect to server '%s', retrying in %d seconds\n",
@@ -3173,6 +3174,12 @@
 	sleep(wait);
     }
 
+    if (!be) {
+		    fprintf(stderr, "Can not connect to server '%s'\n",
+			    servername);
+		    _exit(1);
+    }
+
     return be;
 }
 
@@ -3279,12 +3286,16 @@
 
     setbuf(stdout, NULL);
 
-    while ((opt = getopt(argc, argv, "C:vlS:F:f:w:t:d:rums")) != EOF) {
+    while ((opt = getopt(argc, argv, "C:vlS:F:f:w:t:d:rumso")) != EOF) {
         switch (opt) {
         case 'C': /* alt config file */
             alt_config = optarg;
             break;
 
+        case 'o': /* only try to connect once */
+            connect_once = 1;
+            break;
+
         case 'v': /* verbose */
             verbose++;
             break;
diff -ur --new-file cyrus-imapd-cvs.orig/man/sync_client.8 cyrus-imapd-cvs/man/sync_client.8
--- cyrus-imapd-cvs.orig/man/sync_client.8	2005-03-31 15:27:53.000000000 -0500
+++ cyrus-imapd-cvs/man/sync_client.8	2006-09-19 01:16:07.000000000 -0400
@@ -109,6 +109,10 @@
 .BI \-l
 Verbose logging mode.
 .TP
+.BI \-o
+Only attempt to connect to the backend server once rather than waiting
+up to 1000 seconds before giving up.
+.TP
 .BI \-C " config-file"
 Read configuration options from \fIconfig-file\fR.
 .TP


More information about the Info-cyrus mailing list