[6.0] 161a783b4 Make it explicit that vcl.discard are not allowed to fail in the child process.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Dec 19 18:25:07 UTC 2019


commit 161a783b4e72f95acc4c45d8521bcc5b610a17b0
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 0ed9274f6..85bd56f5f 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -765,9 +765,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