-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Bundle's Etag is cached if activation failes #2220
Comments
|
This does indeed look like an issue, I think the original design assumed that if the bundle failed to activate it would have required an update (and a new etag) so none of the test cases look for this behavior. I see in the bundle plugin we do the "right" thing with the etag for the bundle status, only updating the etag if activation succeeds: Lines 305 to 318 in d0a760c
But over in the downloader we just always set the etag: Lines 128 to 132 in d0a760c
Couple options come to mind to correct this...
|
Thanks @patrick-east I came to a similar understanding of the problem when looking at plugin.go/download.go. Unfortunately, I'm not an experienced go programmer. If I had to rearrange a few lines I would feel comfortable making the change. But this requires go skills that I don't have. |
@michaelwittig no worries! Its on the OPA teams radar now so its just a matter of time until someone picks it up |
Earlier the Etag on the downloader would be updated unconditionally after every attempt to download a bundle. This could lead to a situation wherein a bundle fails to activate and would remain in an unactivated state since any subsequent downloads of the same version of the bundle would not trigger the activation process. This change attempts to resolve the issue by allowing the client to reset the Etag on the downloader incase of downloader errors and bundle activation failures. The drawback now is that we could end up re-downloading the same version of a bundle multiple times till it successfully activates. This situtation is likely to occur when using multiple bundle sources where a bundle may depend on some other. Generally using multiple bundle sources isn't recommended so the extra network traffic as a result of the re-downloads although not ideal may not too harmful. Fixes open-policy-agent#2220 Fixes open-policy-agent#2279 Signed-off-by: Ashutosh Narkar <[email protected]>
Earlier the Etag on the downloader would be updated unconditionally after every attempt to download a bundle. This could lead to a situation wherein a bundle fails to activate and would remain in an unactivated state since any subsequent downloads of the same version of the bundle would not trigger the activation process. This change attempts to resolve the issue by allowing the client to reset the Etag on the downloader incase of downloader errors and bundle activation failures. The drawback now is that we could end up re-downloading the same version of a bundle multiple times till it successfully activates. This situtation is likely to occur when using multiple bundle sources where a bundle may depend on some other. Generally using multiple bundle sources isn't recommended so the extra network traffic as a result of the re-downloads although not ideal may not too harmful. Fixes #2220 Fixes #2279 Signed-off-by: Ashutosh Narkar <[email protected]>
I think I found a bug: If bundles come with an Etag header but fail during activation they are still considered “downloaded/activated” and activation is never retried.
Expected Behavior
If a bundle can not be activated, the activation should be retried in the next cycle even if the Etag stays the same.
Actual Behavior
If a bundle ca nnot be activated, the activation is never retried if the Etag stays the same.
Steps to Reproduce the Problem
Configure two bundles
bundle a depends on bundle b
make the download of bundle b slow, so that bundle a loads before bundle b
Additional Info
Context:
we have OPA configured to fetch two bundles. A “global” bundle that contains some helper functions and a “service” specific bundle with the rules to protect a specific service. The “service” bundle depends on the “global” bundle.
If the global bundle loads/activates before the service bundle, things are working as expected.
If the service bundle loads/activates before the global bundle I get an error like this: rego_type_error: undefined function data.comp.authz.check which is correct because the global helper is not available
I expected that this ordering problem will be solved with the next download cycle of the bundles. But I think there might be a bug:
If no Etag headers are used, it works: The service bundle will be activated on the 2nd try.
If the Etag headers are used, it does not work: The service bundle activation will not be retried.
The text was updated successfully, but these errors were encountered: