-
Notifications
You must be signed in to change notification settings - Fork 377
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
POC: New beresp.error VCL variable #4097
base: master
Are you sure you want to change the base?
Conversation
All call sites pass the STRINGS type, so we can inline it directly.
This otherwise fails on a technicality that suggests the original intent was to allow such a comparison: Comparison of different types: STRING '==' STRING The STRANDS <cmp> STRING comparison is denied with a different error message.
For now it is a mere string, but having a dedicated ERROR type leaves the door open to properties (eg. error.foo.errno) in the future. Error symbols are constants, not variables, but reuse the vcl-var.7 codegen infrastructure.
The same should probably be done for resp in vcl_synth. The error field can be null, meaning there was either no error, or none was reported. There could be a catch-all "Unknown error" in the FSM and a respective error.unknown constant in VCL. Considerations like return(retry) not addressed.
Bugwash summary:
Then we reevaluate the error reporting. |
I wanted to revisit this ticket this morning and noticed that I forgot about the libvcc bug. I pushed 0c8448e...b77b709 to fix it. |
bugwash label removed because this ticket needs an update |
New proposal: struct vrt_error {
const char *msg;
const char *tags; /* comma-separated list of VCL identifiers */
}; Can be produced by a VMOD and put in context, to be consumed from VCL defines new variables:
We gradually start defining ERROR constants in VCL, as we increase our
The In VCL you could do something like this: sub vcl_backend_error {
if (!bereq.error.backend || bereq.error == error.connection_refused) {
return (retry);
}
} Likewise, VMODs learn to define errors in their VCC file:
And you can use them also: import foo;
sub vcl_backend_error {
if (bereq.error.foo && bereq.error != foo.bar) {
return (abandon);
}
} edit: changed all beresp references to bereq to bind the error to the task (and only [be]req is available for the whole task, so it could be extended beyond backend_error/synth). |
Following several VDD discussions, this patch series shows how getting a backend error could look like in VCL, and how it could be articulated in the core code.
This should check the boxes from the last consensus:
beresp.error
)error.*
)The first two commits are unrelated, I found a bug in libvcc while I was working on this. I will submit a pull request once I'm done with that bug (only partly fixed here) so the relevant commits to review are the ones starting with "POC".
If we still have consensus on this approach, I will find someone™ to submit something comprehensive.