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

Log decisions when context is already cancelled #647

Open
ashutosh-narkar opened this issue Nov 5, 2021 · 2 comments
Open

Log decisions when context is already cancelled #647

ashutosh-narkar opened this issue Nov 5, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@ashutosh-narkar
Copy link
Member

Currently the opa-envoy plugins logs decisions in all conditions (ie. presence/absence of errors). For example, when the context is cancelled or deadline is reached before query execution, the plugin passes the same context to the decision logger routine in order to log the decision. The decision log plugin then tries to evaluate the log masking policy and passes it the same context. The rego.eval method eventually gets called and it contains a custom query cancellation mechanism which leads to a race between the context cancellation and query evaluation completion. As a result in some cases the decision event does not get logged. This scenario can be reproduced by running this test multiple times.

Something that needs to be explored here is whether a decision event should even be logged when the context is cancelled or deadline is reached before query execution. One could argue that users may expect to see a corresponding decision log event.

@ashutosh-narkar ashutosh-narkar added the bug Something isn't working label Nov 5, 2021
@srenatus
Copy link
Collaborator

srenatus commented Nov 9, 2021

Something that needs to be explored here is whether a decision event should even be logged when the context is cancelled or deadline is reached before query execution. One could argue that users may expect to see a corresponding decision log event.

💯 I'd think so, too. Decisions should be logged regardless of the context being cancelled, they might unveil issues that would otherwise go unnoticed...?

@stale
Copy link

stale bot commented Dec 9, 2021

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.

@anderseknert anderseknert transferred this issue from open-policy-agent/opa Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants