[master] c2a62c3 Allow up to clock_step error when checking the session timestamps

Martin Blix Grydeland martin at varnish-software.com
Fri Nov 4 13:23:05 CET 2016


commit c2a62c39c5e3addd82003bdc24bbe293f30b9fdb
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Oct 27 14:59:17 2016 +0200

    Allow up to clock_step error when checking the session timestamps
    
    When checking the timestamps on deleting a session, allow up to
    clock_step seconds error before bailing.
    
    Fixes: #1874

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 2eeec0a..5e263e2 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -518,11 +518,15 @@ SES_Delete(struct sess *sp, enum sess_close reason, double now)
 	if (isnan(now))
 		now = VTIM_real();
 	AZ(isnan(sp->t_open));
+	if (now < sp->t_open) {
+		if (now + cache_param->clock_step < sp->t_open)
+			WRONG("Clock step detected");
+		now = sp->t_open; /* Do not log negatives */
+	}
 
 	if (reason == SC_NULL)
 		reason = (enum sess_close)-sp->fd;
 
-	assert(now >= sp->t_open);
 	assert(VTAILQ_EMPTY(&sp->privs->privs));
 	VSL(SLT_SessClose, sp->vxid, "%s %.3f",
 	    sess_close_2str(reason, 0), now - sp->t_open);



More information about the varnish-commit mailing list