[master] f36328435 Make it explicit that vcl.discard are not allowed to fail in the child process.

Poul-Henning Kamp phk at FreeBSD.org
Fri Feb 22 09:07:06 UTC 2019


commit f3632843589a0d5095f60cec2ed1589268f59b86
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Feb 22 09:05:40 2019 +0000

    Make it explicit that vcl.discard are not allowed to fail in
    the child process.
    
    Inspired by: #2471

diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index d9773c78f..28fc35579 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -784,9 +784,9 @@ mcf_vcl_discard(struct cli *cli, const char * const *av, void *priv)
 	else
 		(void)mgt_vcl_setstate(cli, vp, VCL_STATE_COLD);
 	if (MCH_Running()) {
-		/* XXX If this fails the child is crashing, figure that later */
 		assert(vp->state != VCL_STATE_WARM);
-		(void)mgt_cli_askchild(&status, &p, "vcl.discard %s\n", av[2]);
+		if (mgt_cli_askchild(&status, &p, "vcl.discard %s\n", av[2]))
+			assert(status == CLIS_OK || status == CLIS_COMMS);
 		free(p);
 	}
 	mgt_vcl_del(vp);


More information about the varnish-commit mailing list