r5160 - trunk/varnish-cache/bin/varnishd

martin at varnish-cache.org martin at varnish-cache.org
Tue Aug 31 09:45:29 CEST 2010


Author: martin
Date: 2010-08-31 09:45:29 +0200 (Tue, 31 Aug 2010)
New Revision: 5160

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_dir.c
Log:
Add explicit log flushing when backend connections close to keep log chronology. This is to avoid log lines for the same (reused) FD coming before the closing connection when load is high.

Fixes #739


Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-08-30 12:54:07 UTC (rev 5159)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-08-31 07:45:29 UTC (rev 5160)
@@ -370,6 +370,11 @@
 		}
 		VSC_main->backend_toolate++;
 		WSL(sp->wrk, SLT_BackendClose, vc->fd, "%s", bp->vcl_name);
+
+		/* Checkpoint log to flush all info related to this connection
+		   before the OS reuses the FD */
+		WSL_Flush(sp->wrk, 0);
+
 		TCP_close(&vc->fd);
 		VBE_DropRefConn(bp);
 		vc->backend = NULL;

Modified: trunk/varnish-cache/bin/varnishd/cache_dir.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_dir.c	2010-08-30 12:54:07 UTC (rev 5159)
+++ trunk/varnish-cache/bin/varnishd/cache_dir.c	2010-08-31 07:45:29 UTC (rev 5160)
@@ -52,6 +52,11 @@
 	bp = sp->vbc->backend;
 
 	WSL(sp->wrk, SLT_BackendClose, sp->vbc->fd, "%s", bp->vcl_name);
+
+	/* Checkpoint log to flush all info related to this connection
+	   before the OS reuses the FD */
+	WSL_Flush(sp->wrk, 0);
+
 	TCP_close(&sp->vbc->fd);
 	VBE_DropRefConn(bp);
 	sp->vbc->backend = NULL;




More information about the varnish-commit mailing list