Closed tomtau closed 10 months ago
Policy Evaluation
In Cedar 3.0, we suddenly started to get this panic with a confusing error message:
empty set of keys cannot contain a duplicate key: Evaluation(EvaluationError { error_kind: RecursionLimit, advice: None }) thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cedar-policy-core-3.0.0/src/ast/request.rs:198:14:
Context::empty shouldn't panic based on this safety comment: https://github.com/cedar-policy/cedar/blob/818aefbbc4943c51a411951f5f9c3388df1842a6/cedar-policy-core/src/ast/request.rs#L196
Context::empty
As with https://github.com/cedar-policy/cedar/issues/322 , it occurs when executing cedar-policy within a sizeable Axum web application running on AWS Lambda.
Context::empty()
AWS Lambda (Amazon Linux 2 custom runtime / cargo-lambda)
No response
Similarly to https://github.com/cedar-policy/cedar/issues/322 , the workaround is to wrap the Context::empty call inside stacker::grow.
stacker::grow
(The same behaviour is for a Context with a single pair that shouldn't return an error, given there's only a single pair.)
Thanks for filing this issue. We are investigating potential fixes.
Before opening, please confirm:
Bug Category
Policy Evaluation
Describe the bug
In Cedar 3.0, we suddenly started to get this panic with a confusing error message:
Expected behavior
Context::empty
shouldn't panic based on this safety comment: https://github.com/cedar-policy/cedar/blob/818aefbbc4943c51a411951f5f9c3388df1842a6/cedar-policy-core/src/ast/request.rs#L196Reproduction steps
As with https://github.com/cedar-policy/cedar/issues/322 , it occurs when executing cedar-policy within a sizeable Axum web application running on AWS Lambda.
Code Snippet
Log output
Additional configuration
AWS Lambda (Amazon Linux 2 custom runtime / cargo-lambda)
Operating System
No response
Additional information and screenshots
Similarly to https://github.com/cedar-policy/cedar/issues/322 , the workaround is to wrap the
Context::empty
call insidestacker::grow
.