Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmod-saintmode: Allow using blacklist in vcl_backend_error #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

delthas
Copy link

@delthas delthas commented Jul 20, 2023

In a way, this reverts 1.

Previously, we would prevent users from blacklisting a backend from vcl_backend_error. But this is actually useful to users: when a backend fails to respond (and is considered healthy due to e.g. a varnishadm call), we may want to blacklist it for a short while, in order to return (retry) and be sure that we do not use this backend for our second try.

This changes the behavior to checking if there is an available backend, e.g. if we are in vcl_backend_response or vcl_backend_error.

@gquintard
Copy link
Collaborator

gquintard commented Jul 20, 2023 via email

@gquintard
Copy link
Collaborator

@delthas ?

@gquintard
Copy link
Collaborator

one last bump

@delthas
Copy link
Author

delthas commented Oct 27, 2023

@gquintard Ack, have seen the comment, I'll work on it later

@gquintard
Copy link
Collaborator

@delthas , bump :-)

In a way, this reverts [1].

Previously, we would prevent users from blacklisting a backend
from vcl_backend_error. But this is actually useful to users:
when a backend fails to respond (and is considered healthy due
to e.g. a varnishadm call), we may want to blacklist it for a
short while, in order to `return (retry)` and be sure that we
do not use this backend for our second try.

This changes the behavior to checking if there is an available
backend, e.g. if we are in vcl_backend_response or
vcl_backend_error.

[1]: varnish/libvmod-saintmode@d8658c9
@delthas delthas force-pushed the feature-blacklist-error branch from ca99b67 to 5d39951 Compare October 10, 2024 13:32
@delthas
Copy link
Author

delthas commented Oct 10, 2024

Hi,

Actually I'm not using this anymore. I had to mix dynamic backends with blacklists so I ended up making a patch on libvmod-dynamic to add a blacklist support and I'm not using saintmode anymore. But the patch still makes sense for other users I think.

Regarding the test, I just pushed a trivial test that just calls blacklist from vcl_backend_error (and so that implicitly checks that we are not asserting). I suppose we could do something more clever to actually check that the backend was indeed blacklisted by making the backend error then be available again.

@@ -118,9 +118,9 @@ vmod_denylist(VRT_CTX, struct vmod_priv *priv, VCL_DURATION expires) {
}

CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (ctx->method != VCL_MET_BACKEND_RESPONSE) {
if (!ctx->bo || !ctx->bo->director_resp) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, we can get rid of this, and just use $Restrict in the VCC.
@delthas, do you want to do it, or should I?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants