[master] 0c45870ee Revert "Retire the kill(SIGNULL) test in VSM"
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Jun 10 13:42:07 UTC 2024
commit 0c45870ee7e476a0a9786f849734989e97d13d7d
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Sat May 25 07:21:46 2024 +0200
Revert "Retire the kill(SIGNULL) test in VSM"
This reverts commit b845c2789cae4f165e30a3d0f3af1bfbbeca98ee.
The liveness check is brought back with its deficiencies that will be
solved separately.
diff --git a/bin/varnishtest/tests/u00008.vtc b/bin/varnishtest/tests/u00008.vtc
index 59eafd517..61de29818 100644
--- a/bin/varnishtest/tests/u00008.vtc
+++ b/bin/varnishtest/tests/u00008.vtc
@@ -39,6 +39,10 @@ process p1 -expect-text 0 0 "VBE.vcl1.s1.req"
process p1 -expect-text 0 0 "DIAG"
process p1 -screen_dump
+varnish v1 -stop
+process p1 -expect-text 2 1 "Uptime child: Not Running"
+process p1 -screen_dump
+
process p1 -write {dek}
process p1 -expect-text 0 1 "Concurrent connections used:"
process p1 -screen_dump
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index ad5438428..5226bf828 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -151,6 +151,8 @@ struct vsm {
int attached;
double patience;
+
+ int couldkill;
};
/*--------------------------------------------------------------------*/
@@ -362,6 +364,8 @@ VSM_New(void)
vd->child->vsm = vd;
vd->wdfd = -1;
vd->patience = 5;
+ if (getenv("VSM_NOPID") != NULL)
+ vd->couldkill = -1;
return (vd);
}
@@ -488,13 +492,17 @@ vsm_vlu_hash(struct vsm *vd, struct vsm_set *vs, const char *line)
int i;
uintmax_t id1, id2;
- (void)vd;
-
i = sscanf(line, "# %ju %ju", &id1, &id2);
if (i != 2) {
vs->retval |= VSM_MGT_RESTARTED | VSM_MGT_CHANGED;
return (0);
}
+ if (vd->couldkill >= 0 && !kill(id1, 0)) {
+ vd->couldkill = 1;
+ } else if (vd->couldkill > 0 && errno == ESRCH) {
+ vs->retval |= VSM_MGT_RESTARTED | VSM_MGT_CHANGED;
+ return (0);
+ }
vs->retval |= VSM_MGT_RUNNING;
if (id1 != vs->id1 || id2 != vs->id2) {
vs->retval |= VSM_MGT_RESTARTED | VSM_MGT_CHANGED;
@@ -693,7 +701,8 @@ vsm_refresh_set(struct vsm *vd, struct vsm_set *vs)
vs->fst.st_size = lseek(vs->fd, 0L, SEEK_CUR);
- vs->retval |= vs->flag_running;
+ if (vd->couldkill < 1 || !kill(vs->id1, 0))
+ vs->retval |= vs->flag_running;
return (vs->retval);
}
More information about the varnish-commit
mailing list